StableSwarmUI API Documentation - UtilAPI

May 3, 2024 ยท View on GitHub

This is a subset of the API docs, see /docs/API.md for general info.

General utility API routes.

Table of Contents:

HTTP Route /API/CountTokens

Description

Count the CLIP-like tokens in a given text prompt.

Parameters

NameTypeDescriptionDefault
textStringThe text to tokenize.(REQUIRED)
skipPromptSyntaxBooleanIf false, processing prompt syntax (things like <random:). If true, don't process that.False
tokensetStringWhat tokenization set to use.clip
weightingBooleanIf true, process weighting (like (word:1.5)). If false, don't process that.True

Return Format

"count": 0

HTTP Route /API/Pickle2SafeTensor

Description

Trigger bulk conversion of models from pickle format to safetensors.

Parameters

NameTypeDescriptionDefault
typeStringWhat type of model to convert, eg Stable-Diffusion, LoRA, etc.(REQUIRED)
fp16BooleanIf true, convert to fp16 while processing. If false, use original model's weight type.(REQUIRED)

Return Format

"success": true

HTTP Route /API/TokenizeInDetail

Description

Tokenize some prompt text and get thorough detail about it.

Parameters

NameTypeDescriptionDefault
textStringThe text to tokenize.(REQUIRED)
tokensetStringWhat tokenization set to use.clip
weightingBooleanIf true, process weighting (like (word:1.5)). If false, don't process that.True

Return Format

    "tokens":
    [
        {
            "id": 123,
            "weight": 1.0,
            "text": "tok"
        }
    ]

HTTP Route /API/WipeMetadata

Description

Trigger a mass metadata reset.

Parameters

None.

Return Format

"success": true