APIRoutes.UtilAPI - edtomb/SwarmUI GitHub Wiki
This is a subset of the API docs, see ../API for general info.
General utility API routes.
- HTTP Route CountTokens
- HTTP Route Pickle2SafeTensor
- HTTP Route TokenizeInDetail
- HTTP Route WipeMetadata
Count the CLIP-like tokens in a given text prompt.
use_tokenizer - Use Tokenizer in group User
| Name | Type | Description | Default |
|---|---|---|---|
| text | String | The text to tokenize. | (REQUIRED) |
| skipPromptSyntax | Boolean | If false, processing prompt syntax (things like <random:). If true, don't process that. |
False |
| tokenset | String | What tokenization set to use. | clip |
| weighting | Boolean | If true, process weighting (like (word:1.5)). If false, don't process that. |
True |
"count": 0Trigger bulk conversion of models from pickle format to safetensors.
pickle2safetensors - Pickle2SafeTensors in group Control
| Name | Type | Description | Default |
|---|---|---|---|
| type | String | What type of model to convert, eg Stable-Diffusion, LoRA, etc. |
(REQUIRED) |
| fp16 | Boolean | If true, convert to fp16 while processing. If false, use original model's weight type. | (REQUIRED) |
"success": trueTokenize some prompt text and get thorough detail about it.
use_tokenizer - Use Tokenizer in group User
| Name | Type | Description | Default |
|---|---|---|---|
| text | String | The text to tokenize. | (REQUIRED) |
| tokenset | String | What tokenization set to use. | clip |
| weighting | Boolean | If true, process weighting (like (word:1.5)). If false, don't process that. |
True |
"tokens":
[
{
"id": 123,
"weight": 1.0,
"text": "tok"
}
]Trigger a mass metadata reset.
reset_metadata - Reset Metadata in group Control
None.
"success": true