APIRoutes.BackendAPI - edtomb/SwarmUI GitHub Wiki
This is a subset of the API docs, see ../API for general info.
API routes to manage the server's backends.
- HTTP Route AddNewBackend
- HTTP Route DeleteBackend
- HTTP Route EditBackend
- HTTP Route FreeBackendMemory
- HTTP Route ListBackendTypes
- HTTP Route ListBackends
- HTTP Route RestartBackends
- HTTP Route ToggleBackend
Add a new backend of the specified type.
add_remove_backends - Add/Remove Backends in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| type_id | String | ID of what type of backend to add (see ListBackendTypes). |
(REQUIRED) |
"id": "idhere",
"type": "typehere",
"status": "statushere",
"settings":
{
"namehere": valuehere
},
"modcount": 0,
"features": [ "featureidhere", ... ],
"enabled": true,
"title": "titlehere",
"can_load_models": true,
"max_usages": 0Shuts down and deletes a registered backend by ID.
add_remove_backends - Add/Remove Backends in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| backend_id | Int32 | ID of the backend to delete. | (REQUIRED) |
"result": "Deleted."
// OR
"result": "Already didn't exist."Modify and re-init an already registered backend.
edit_backends - Edit Backends in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| backend_id | Int32 | ID of the backend to edit. | (REQUIRED) |
| title | String | New title of the backend. | (REQUIRED) |
| raw_inp | JObject | Input should contain a map of "settingname": value. |
(REQUIRED) |
"id": "idhere",
"type": "typehere",
"status": "statushere",
"settings":
{
"namehere": valuehere
},
"modcount": 0,
"features": [ "featureidhere", ... ],
"enabled": true,
"title": "titlehere",
"can_load_models": true,
"max_usages": 0Free memory from all backends or a specific one.
control_mem_clean - Control Memory Cleaning in group Control
| Name | Type | Description | Default |
|---|---|---|---|
| system_ram | Boolean | If true, system RAM should be cleared too. If false, only VRAM should be cleared. | False |
| backend | String | What backend ID to restart, or all for all. |
all |
"result": true,
"count": 1 // Number of backends memory was freed fromReturns of a list of all available backend types.
view_backends_list - View Backends List in group Backends Admin
None.
"list":
[
"id": "idhere",
"name": "namehere",
"description": "descriptionhere",
"settings":
[
{
"name": "namehere",
"type": "typehere",
"description": "descriptionhere",
"placeholder": "placeholderhere",
"values": ["a", "b"], // For dropdowns only
"value_names": ["Alpha", "Beta"] // For dropdowns only, optional even then
}
],
"is_standard": false
]Returns a list of currently registered backends.
view_backends_list - View Backends List in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| nonreal | Boolean | If true, include 'nonreal' backends (ones that were spawned temporarily/internally). | False |
| full_data | Boolean | If true, include nonessential data about backends (eg what model is currently loaded). | False |
"idhere":
{
"id": "idhere",
"type": "typehere",
"status": "statushere",
"settings":
{
"namehere": valuehere
},
"modcount": 0,
"features": [ "featureidhere", ... ],
"enabled": true,
"title": "titlehere",
"can_load_models": true,
"max_usages": 0,
"current_model": "modelnamehere" // Only if `full_data` is true
}Restart all backends or a specific one.
restart_backends - Restart Backends in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| backend | String | What backend ID to restart, or all for all. |
all |
"result": "Success.",
"count": 1 // Number of backends restartedDisables or re-enables a backend by ID.
toggle_backends - Toggle Backends in group Backends Admin
| Name | Type | Description | Default |
|---|---|---|---|
| backend_id | Int32 | ID of the backend to toggle. | (REQUIRED) |
| enabled | Boolean | If true, backend should be enabled. If false, backend should be disabled. | (REQUIRED) |
"result": "Success."
// OR
"result": "No change."