Документация/API-справочник

AI Chaos API

API для генерации и редактирования изображений, удаления фона и LLM-совместимого чата.

OpenAPI 3.1 YAML

POST /v1/web/search

Поиск в интернете

Запросы к поисковым API проходят через RSRouter в режиме remote-only, без прямого выхода сервера.
Параметры, запрос и ответы
{
  "operationId": "webSearch",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Поиск в интернете",
  "description": "Запросы к поисковым API проходят через RSRouter в режиме remote-only, без прямого выхода сервера.",
  "tags": [
    "Поиск"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "query"
          ],
          "properties": {
            "query": {
              "type": "string"
            },
            "provider": {
              "type": "string",
              "enum": [
                "auto",
                "brave",
                "exa",
                "perplexity"
              ]
            },
            "mode": {
              "type": "string",
              "enum": [
                "auto",
                "web",
                "context"
              ],
              "description": "Brave search mode; ignored by other providers"
            },
            "limit": {
              "type": "integer"
            },
            "freshness": {
              "type": "string",
              "enum": [
                "day",
                "week",
                "month",
                "year"
              ]
            },
            "include_domains": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "exclude_domains": {
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "max_tokens": {
              "type": "integer"
            },
            "country": {
              "type": "string"
            },
            "language": {
              "type": "string"
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Нормализованные результаты поиска"
    },
    "400": {
      "description": "Некорректный запрос"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "402": {
      "description": "Недостаточно спарков или исчерпан лимит API-ключа"
    },
    "503": {
      "description": "Сбой поискового провайдера"
    }
  }
}

POST /v1/web/fetch

Получить читаемый текст веб-страниц

По умолчанию auto и rsrouter загружают страницы через RSRouter, сначала напрямую, затем через удалённые узлы при сетевой ошибке или повторяемом HTTP-отказе. Эта загрузка не вызывает платный поисковый API. Явный выбор прежнего провайдера сохраняет его API и тариф.
Параметры, запрос и ответы
{
  "operationId": "webFetch",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Получить читаемый текст веб-страниц",
  "description": "По умолчанию auto и rsrouter загружают страницы через RSRouter, сначала напрямую, затем через удалённые узлы при сетевой ошибке или повторяемом HTTP-отказе. Эта загрузка не вызывает платный поисковый API. Явный выбор прежнего провайдера сохраняет его API и тариф.",
  "tags": [
    "Поиск"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "required": [
            "urls"
          ],
          "properties": {
            "urls": {
              "type": "array",
              "items": {
                "type": "string",
                "format": "uri"
              }
            },
            "provider": {
              "type": "string",
              "enum": [
                "auto",
                "rsrouter",
                "brave",
                "exa",
                "perplexity"
              ]
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Страницы с читаемым текстом и результатом каждого URL"
    },
    "400": {
      "description": "Некорректный запрос"
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "402": {
      "description": "Недостаточно спарков или исчерпан лимит API-ключа"
    },
    "503": {
      "description": "Не удалось загрузить страницы"
    }
  }
}

POST /v1/chat/completions

Создать завершение чата, совместимое с OpenAI

Accepts the OpenAI Chat Completions request format. Streaming responses are sent as server-sent events.
Параметры, запрос и ответы
{
  "operationId": "createChatCompletion",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать завершение чата, совместимое с OpenAI",
  "description": "Accepts the OpenAI Chat Completions request format. Streaming responses are sent as server-sent events.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ChatCompletionRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Chat completion",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ChatCompletion"
          },
          "example": {
            "id": "chatcmpl_123",
            "object": "chat.completion",
            "created": 1735689600,
            "model": "qwen",
            "choices": [
              {
                "index": 0,
                "message": {
                  "role": "assistant",
                  "content": "Hello!"
                },
                "finish_reason": "stop"
              }
            ],
            "usage": {
              "prompt_tokens": 10,
              "completion_tokens": 2,
              "total_tokens": 12
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/messages

Создать сообщение, совместимое с Anthropic

Accepts the Anthropic Messages API request format.
Параметры, запрос и ответы
{
  "operationId": "createMessage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать сообщение, совместимое с Anthropic",
  "description": "Accepts the Anthropic Messages API request format.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Message response",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnthropicMessage"
          },
          "example": {
            "id": "msg_123",
            "type": "message",
            "role": "assistant",
            "model": "qwen",
            "content": [
              {
                "type": "text",
                "text": "Hello!"
              }
            ],
            "stop_reason": "end_turn",
            "usage": {
              "input_tokens": 10,
              "output_tokens": 2
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /anthropic/messages

Создать сообщение, совместимое с Anthropic (базовый URL Anthropic)

Accepts the Anthropic Messages API request format.
Параметры, запрос и ответы
{
  "operationId": "createAnthropicMessage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать сообщение, совместимое с Anthropic (базовый URL Anthropic)",
  "description": "Accepts the Anthropic Messages API request format.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Message response",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnthropicMessage"
          },
          "example": {
            "id": "msg_123",
            "type": "message",
            "role": "assistant",
            "model": "qwen",
            "content": [
              {
                "type": "text",
                "text": "Hello!"
              }
            ],
            "stop_reason": "end_turn",
            "usage": {
              "input_tokens": 10,
              "output_tokens": 2
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/messages/count_tokens

Подсчитать токены сообщения, совместимого с Anthropic

Параметры, запрос и ответы
{
  "operationId": "countMessageTokens",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Подсчитать токены сообщения, совместимого с Anthropic",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Token count",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "input_tokens"
            ],
            "properties": {
              "input_tokens": {
                "type": "integer",
                "example": 10
              }
            }
          },
          "example": {
            "input_tokens": 10
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}

POST /anthropic/messages/count_tokens

Подсчитать токены сообщения (базовый URL Anthropic)

Параметры, запрос и ответы
{
  "operationId": "countAnthropicMessageTokens",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Подсчитать токены сообщения (базовый URL Anthropic)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Token count",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "input_tokens"
            ],
            "properties": {
              "input_tokens": {
                "type": "integer",
                "example": 10
              }
            }
          },
          "example": {
            "input_tokens": 10
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}

GET /api/v1/ais

Получить список доступных моделей

Параметры, запрос и ответы
{
  "operationId": "listModels",
  "summary": "Получить список доступных моделей",
  "tags": [
    "LLM"
  ],
  "security": [],
  "parameters": [
    {
      "name": "purpose",
      "in": "query",
      "schema": {
        "type": "string",
        "enum": [
          "generation",
          "video",
          "chat",
          "llm"
        ],
        "default": "generation"
      }
    },
    {
      "name": "provider",
      "in": "query",
      "schema": {
        "type": "string"
      },
      "description": "Comma-separated provider codes."
    },
    {
      "name": "family",
      "in": "query",
      "schema": {
        "type": "string"
      },
      "description": "Comma-separated family names."
    },
    {
      "name": "grouped",
      "in": "query",
      "schema": {
        "type": "boolean",
        "default": false
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Models, or groups when `grouped=true`",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ModelList"
          },
          "example": {
            "models": [
              {
                "id": 1,
                "code": "flux-schnell",
                "name": "FLUX Schnell",
                "cost": 1,
                "routes": [
                  {
                    "id": 2,
                    "provider_code": "fal",
                    "priority": 1
                  }
                ]
              }
            ]
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/ais/families

Получить список семейств моделей генерации изображений

Параметры, запрос и ответы
{
  "operationId": "listModelFamilies",
  "summary": "Получить список семейств моделей генерации изображений",
  "tags": [
    "LLM"
  ],
  "security": [],
  "responses": {
    "200": {
      "description": "Model family names",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "families"
            ],
            "properties": {
              "families": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          },
          "example": {
            "families": [
              "FLUX",
              "SDXL"
            ]
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/generations

Получить список недавних генераций

Returns the authenticated caller's recent generation history. Anonymous requests receive an empty list. Because an authenticated call returns private per-user history, an OAuth token must carry the `generations` scope; API keys and signed-in sessions are unaffected.
Параметры, запрос и ответы
{
  "operationId": "listGenerations",
  "summary": "Получить список недавних генераций",
  "tags": [
    "Генерация изображений"
  ],
  "description": "Returns the authenticated caller's recent generation history. Anonymous requests receive an empty list. Because an authenticated call returns private per-user history, an OAuth token must carry the `generations` scope; API keys and signed-in sessions are unaffected.\n",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "parameters": [
    {
      "name": "limit",
      "in": "query",
      "schema": {
        "type": "integer",
        "minimum": 1,
        "maximum": 100,
        "default": 6
      }
    },
    {
      "name": "queue_type",
      "in": "query",
      "schema": {
        "type": "string",
        "enum": [
          "generate",
          "upscale",
          "rembg",
          "background",
          "outpaint"
        ]
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Recent generations",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "generations"
            ],
            "properties": {
              "generations": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Generation"
                }
              }
            }
          },
          "example": {
            "generations": [
              {
                "id": 42,
                "status": "completed",
                "image_url": "/download/42/token/image.png",
                "width": 1024,
                "height": 1024,
                "model": "flux-schnell"
              }
            ]
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/generations

Создать генерацию изображения

Submit text-to-image, image-to-image, or reference-resolution work. Supply at most one of `source_image` and `uploaded_image_id`.
Параметры, запрос и ответы
{
  "operationId": "createGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Создать генерацию изображения",
  "description": "Submit text-to-image, image-to-image, or reference-resolution work. Supply at most one of `source_image` and `uploaded_image_id`.",
  "tags": [
    "Генерация изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/GenerationRequest"
        },
        "encoding": {
          "source_image": {
            "contentType": "image/*"
          },
          "mask": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Generation queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GenerationCreated"
          },
          "example": {
            "id": 42,
            "status": "queued",
            "batch_id": "9de8d8d7-7f2c-4dcb-aad9-60a5c5a6ed67",
            "quantity": 1,
            "generation_ids": [
              42
            ]
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/generations/{id}

Получить статус и результат генерации

Параметры, запрос и ответы
{
  "operationId": "getGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Получить статус и результат генерации",
  "tags": [
    "Генерация изображений"
  ],
  "responses": {
    "200": {
      "description": "Generation",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Generation"
          },
          "example": {
            "id": 42,
            "status": "generated",
            "image_url": "/download/42/token/image.png",
            "mask_url": "/api/v1/generations/42/mask",
            "width": 1024,
            "height": 1024
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

DELETE /api/v1/generations/{id}

Безвозвратно удалить генерацию

Параметры, запрос и ответы
{
  "operationId": "deleteGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Безвозвратно удалить генерацию",
  "tags": [
    "Генерация изображений"
  ],
  "responses": {
    "200": {
      "description": "Deleted",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Success"
          },
          "example": {
            "success": true,
            "id": 42,
            "permanent": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

POST /api/v1/generations/{id}/cancel

Отменить генерацию в очереди

Параметры, запрос и ответы
{
  "operationId": "cancelGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Отменить генерацию в очереди",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "responses": {
    "200": {
      "description": "Cancelled",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Success"
          },
          "example": {
            "success": true,
            "id": 42,
            "status": "cancelled"
          }
        }
      }
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/generations/{id}/retry

Повторить неудачную генерацию

Параметры, запрос и ответы
{
  "operationId": "retryGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Повторить неудачную генерацию",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "responses": {
    "201": {
      "description": "Retry queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GenerationCreated"
          },
          "example": {
            "id": 43,
            "status": "pending",
            "batch_id": "9de8d8d7-7f2c-4dcb-aad9-60a5c5a6ed67",
            "quantity": 1,
            "generation_ids": [
              43
            ]
          }
        }
      }
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/generations/{id}/publish

Опубликовать завершенную генерацию

Параметры, запрос и ответы
{
  "operationId": "publishGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Опубликовать завершенную генерацию",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "responses": {
    "200": {
      "description": "Publication updated",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Publication"
          },
          "example": {
            "generation_ids": [
              42
            ],
            "private_generation_ids": [],
            "publication_status": "published",
            "is_private": false
          }
        }
      }
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/generations/{id}/unpublish

Сделать генерацию приватной

Параметры, запрос и ответы
{
  "operationId": "unpublishGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Сделать генерацию приватной",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "responses": {
    "200": {
      "description": "Publication updated",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Publication"
          },
          "example": {
            "generation_ids": [
              42
            ],
            "private_generation_ids": [],
            "publication_status": "published",
            "is_private": false
          }
        }
      }
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/generations/{id}/upscale

Увеличить разрешение существующей генерации

Параметры, запрос и ответы
{
  "operationId": "upscaleGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Увеличить разрешение существующей генерации",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/UpscaleGenerationRequest"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Upscale queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AsyncGeneration"
          },
          "example": {
            "id": 43,
            "status": "pending",
            "status_url": "/api/v1/generations/43"
          }
        }
      }
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/generations/{id}/mask

Скачать маску генерации

Returns the mask without changing generation state.
Параметры, запрос и ответы
{
  "operationId": "downloadGenerationMask",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Скачать маску генерации",
  "description": "Returns the mask without changing generation state.",
  "tags": [
    "Генерация изображений"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/GenerationId"
    }
  ],
  "responses": {
    "200": {
      "description": "Mask image",
      "content": {
        "image/png": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

POST /api/v1/rembg

Удалить фон изображения

Параметры, запрос и ответы
{
  "operationId": "removeBackground",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Удалить фон изображения",
  "tags": [
    "Инструменты изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/RembgRequest"
        },
        "encoding": {
          "image": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Background removal queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AsyncGeneration"
          },
          "example": {
            "id": 42,
            "status": "pending",
            "status_url": "/api/v1/generations/42"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/background

Сгенерировать и добавить новый фон изображения

Параметры, запрос и ответы
{
  "operationId": "generateBackground",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Сгенерировать и добавить новый фон изображения",
  "tags": [
    "Инструменты изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/BackgroundRequest"
        },
        "encoding": {
          "image": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Background generation queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AsyncGeneration"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/outpaint

Расширить холст изображения генеративным outpainting

The target dimensions are derived from the source dimensions and pixel expansions. Supply exactly one source and at least one positive expansion; `width` and `height` are not accepted.
Параметры, запрос и ответы
{
  "operationId": "outpaintImage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Расширить холст изображения генеративным outpainting",
  "description": "The target dimensions are derived from the source dimensions and pixel expansions. Supply exactly one source and at least one positive expansion; `width` and `height` are not accepted.",
  "tags": [
    "Инструменты изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/OutpaintRequest"
        },
        "encoding": {
          "image": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Outpaint queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AsyncGeneration"
          },
          "example": {
            "id": 44,
            "status": "pending",
            "status_url": "/api/v1/generations/44"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /api/v1/upscale

Увеличить разрешение загруженного изображения, URL или генерации

Параметры, запрос и ответы
{
  "operationId": "upscaleImage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Увеличить разрешение загруженного изображения, URL или генерации",
  "tags": [
    "Инструменты изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/UpscaleRequest"
        },
        "encoding": {
          "image": {
            "contentType": "image/*"
          }
        }
      },
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/UpscaleJsonRequest"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Upscale queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AsyncGeneration"
          },
          "example": {
            "id": 43,
            "status": "pending",
            "status_url": "/api/v1/generations/43"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/storage_connectors

Получить список подключений хранилища текущего пользователя

Параметры, запрос и ответы
{
  "operationId": "listStorageConnectors",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Получить список подключений хранилища текущего пользователя",
  "tags": [
    "Хранилище"
  ],
  "responses": {
    "200": {
      "description": "Connector list",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "connectors": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/StorageConnector"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

POST /api/v1/storage_connectors

Подключить S3-совместимый бакет

Параметры, запрос и ответы
{
  "operationId": "createStorageConnector",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Подключить S3-совместимый бакет",
  "tags": [
    "Хранилище"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StorageConnectorInput"
        }
      }
    }
  },
  "responses": {
    "201": {
      "description": "Connector created",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StorageConnector"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/storage_connectors/{id}

Получить подключение хранилища

Параметры, запрос и ответы
{
  "operationId": "getStorageConnector",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Получить подключение хранилища",
  "tags": [
    "Хранилище"
  ],
  "responses": {
    "200": {
      "description": "Connector",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StorageConnector"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

PATCH /api/v1/storage_connectors/{id}

Обновить или переподключить хранилище

Параметры, запрос и ответы
{
  "operationId": "updateStorageConnector",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Обновить или переподключить хранилище",
  "tags": [
    "Хранилище"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/StorageConnectorInput"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Connector updated",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/StorageConnector"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

DELETE /api/v1/storage_connectors/{id}

Отключить хранилище и очистить его учетные данные

Параметры, запрос и ответы
{
  "operationId": "disconnectStorageConnector",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Отключить хранилище и очистить его учетные данные",
  "tags": [
    "Хранилище"
  ],
  "responses": {
    "200": {
      "description": "Connector disconnected"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

POST /api/v1/storage_connectors/{id}/test

Проверить разрешенные операции подключения

Параметры, запрос и ответы
{
  "operationId": "testStorageConnector",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Проверить разрешенные операции подключения",
  "tags": [
    "Хранилище"
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer"
      }
    }
  ],
  "requestBody": {
    "content": {
      "application/json": {
        "schema": {
          "type": "object",
          "properties": {
            "test_key": {
              "type": "string",
              "description": "Required when the connector access mode includes read access."
            }
          }
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Connection succeeded"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/generation_exports/{id}

Получить статус экспорта и кратковременный URL скачивания

Параметры, запрос и ответы
{
  "operationId": "getGenerationExport",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "storage"
      ]
    }
  ],
  "summary": "Получить статус экспорта и кратковременный URL скачивания",
  "tags": [
    "Хранилище"
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Export status",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/GenerationExport"
          }
        }
      }
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "503": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /api/v1/uploads

Получить список загруженных изображений аутентифицированного пользователя

Параметры, запрос и ответы
{
  "operationId": "listUploads",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "uploads"
      ]
    }
  ],
  "summary": "Получить список загруженных изображений аутентифицированного пользователя",
  "tags": [
    "Загрузки"
  ],
  "responses": {
    "200": {
      "description": "Upload library page",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "uploads"
            ],
            "properties": {
              "uploads": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/Upload"
                }
              },
              "next_page": {
                "type": [
                  "integer",
                  "null"
                ]
              }
            }
          },
          "example": {
            "uploads": [
              {
                "id": 12,
                "original_filename": "reference.png",
                "width": 1024,
                "height": 768,
                "preview_url": "/api/v1/uploads/12/preview"
              }
            ],
            "next_page": null
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/uploads/{id}/preview

Показать сохраненную загрузку изображения внутри страницы

Параметры, запрос и ответы
{
  "operationId": "previewUpload",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "uploads"
      ]
    }
  ],
  "summary": "Показать сохраненную загрузку изображения внутри страницы",
  "tags": [
    "Загрузки"
  ],
  "parameters": [
    {
      "name": "id",
      "in": "path",
      "required": true,
      "schema": {
        "type": "integer"
      },
      "example": 12
    }
  ],
  "responses": {
    "200": {
      "description": "Image preview",
      "content": {
        "image/jpeg": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        },
        "image/png": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        },
        "image/gif": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        },
        "image/webp": {
          "schema": {
            "type": "string",
            "format": "binary"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "415": {
      "description": "Upload MIME type cannot be previewed inline."
    }
  }
}

GET /api/v1/account/profile

Получить профиль аутентифицированного аккаунта

Returns the account bound to the presented credential. A user API key or OAuth token resolves to its owner; a public API key (no owner) returns `id: null` plus its own key summary.
Параметры, запрос и ответы
{
  "operationId": "getAccountProfile",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить профиль аутентифицированного аккаунта",
  "description": "Returns the account bound to the presented credential. A user API key or OAuth token resolves to its owner; a public API key (no owner) returns `id: null` plus its own key summary.",
  "tags": [
    "Аккаунт"
  ],
  "responses": {
    "200": {
      "description": "Account profile",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AccountProfile"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/account/balances

Получить рублёвый баланс аутентифицированного аккаунта

Параметры, запрос и ответы
{
  "operationId": "getAccountBalances",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить рублёвый баланс аутентифицированного аккаунта",
  "tags": [
    "Аккаунт"
  ],
  "responses": {
    "200": {
      "description": "RUB cash balance",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AccountBalances"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/account/usage

Получить суммарное использование аккаунта

Cumulative generation and LLM usage. `generation_spend_sparks` counts only successfully charged generations; LLM figures are metering (the public LLM proxy is not spark-billed).
Параметры, запрос и ответы
{
  "operationId": "getAccountUsage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить суммарное использование аккаунта",
  "description": "Cumulative generation and LLM usage. `generation_spend_sparks` counts only successfully charged generations; LLM figures are metering (the public LLM proxy is not spark-billed).",
  "tags": [
    "Аккаунт"
  ],
  "responses": {
    "200": {
      "description": "Aggregate usage",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AccountUsage"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/account/keys

Получить список API-ключей аккаунта

Each key includes its cumulative spend ledger (`spend`, `spend_reserved`, `spend_remaining`) and structured `permissions`. Public API keys list only themselves.
Параметры, запрос и ответы
{
  "operationId": "listAccountKeys",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить список API-ключей аккаунта",
  "description": "Each key includes its cumulative spend ledger (`spend`, `spend_reserved`, `spend_remaining`) and structured `permissions`. Public API keys list only themselves.",
  "tags": [
    "Аккаунт"
  ],
  "responses": {
    "200": {
      "description": "API keys",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "keys"
            ],
            "properties": {
              "keys": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/ApiKeySummary"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/account/keys/{id}/usage

Получить использование и расходы по ключу

Параметры, запрос и ответы
{
  "operationId": "getApiKeyUsage",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить использование и расходы по ключу",
  "tags": [
    "Аккаунт"
  ],
  "responses": {
    "200": {
      "description": "Per-key usage",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/ApiKeyUsage"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

POST /v1/completions

Создать текстовое завершение, совместимое с OpenAI

Legacy completions are translated to a chat request. `suffix`, `best_of`, `echo`, and `logprobs` are unsupported.
Параметры, запрос и ответы
{
  "operationId": "createCompletion",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать текстовое завершение, совместимое с OpenAI",
  "description": "Legacy completions are translated to a chat request. `suffix`, `best_of`, `echo`, and `logprobs` are unsupported.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CompletionRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Completion",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Completion"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/responses

Создать ответ, совместимый с OpenAI

Stateless text input only. Streaming, tools, storage, conversations, and background execution are unsupported.
Параметры, запрос и ответы
{
  "operationId": "createResponse",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать ответ, совместимый с OpenAI",
  "description": "Stateless text input only. Streaming, tools, storage, conversations, and background execution are unsupported.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/ResponseRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Completed response",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Response"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/embeddings

Создать эмбеддинги, совместимые с OpenAI

Параметры, запрос и ответы
{
  "operationId": "createEmbeddings",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать эмбеддинги, совместимые с OpenAI",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider embedding response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /anthropic/v1/messages

Создать сообщение, совместимое с Anthropic (версионированный псевдоним)

Accepts the Anthropic Messages API request format.
Параметры, запрос и ответы
{
  "operationId": "createAnthropicV1Message",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Создать сообщение, совместимое с Anthropic (версионированный псевдоним)",
  "description": "Accepts the Anthropic Messages API request format.",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Message response",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/AnthropicMessage"
          },
          "example": {
            "id": "msg_123",
            "type": "message",
            "role": "assistant",
            "model": "qwen",
            "content": [
              {
                "type": "text",
                "text": "Hello!"
              }
            ],
            "stop_reason": "end_turn",
            "usage": {
              "input_tokens": 10,
              "output_tokens": 2
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /anthropic/v1/messages/count_tokens

Подсчитать токены сообщения (версионированный псевдоним Anthropic)

Параметры, запрос и ответы
{
  "operationId": "countAnthropicV1MessageTokens",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Подсчитать токены сообщения (версионированный псевдоним Anthropic)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/AnthropicMessageRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Token count",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "required": [
              "input_tokens"
            ],
            "properties": {
              "input_tokens": {
                "type": "integer",
                "example": 10
              }
            }
          },
          "example": {
            "input_tokens": 10
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}

POST /v1/rerank

Переранжировать документы совместимой моделью

Параметры, запрос и ответы
{
  "operationId": "rerankV1",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Переранжировать документы совместимой моделью",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider reranking response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/reranking

Переранжировать документы совместимой моделью

Параметры, запрос и ответы
{
  "operationId": "rerankingV1",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Переранжировать документы совместимой моделью",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider reranking response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /rerank

Переранжировать документы (совместимость с llama.cpp)

Параметры, запрос и ответы
{
  "operationId": "rerank",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Переранжировать документы (совместимость с llama.cpp)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider reranking response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /reranking

Переранжировать документы (псевдоним совместимости с llama.cpp)

Параметры, запрос и ответы
{
  "operationId": "reranking",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Переранжировать документы (псевдоним совместимости с llama.cpp)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider reranking response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /infill

Выполнить запрос infill (совместимость с llama.cpp)

Параметры, запрос и ответы
{
  "operationId": "infill",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Выполнить запрос infill (совместимость с llama.cpp)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider capability response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /completion

Завершить промпт (совместимость с llama.cpp)

Параметры, запрос и ответы
{
  "operationId": "llamaCompletion",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Завершить промпт (совместимость с llama.cpp)",
  "tags": [
    "LLM"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/CapabilityRequest"
        }
      }
    }
  },
  "responses": {
    "200": {
      "description": "Provider capability response",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /props

Получить свойства модели, совместимой с llama.cpp

Параметры, запрос и ответы
{
  "operationId": "getModelProps",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Получить свойства модели, совместимой с llama.cpp",
  "tags": [
    "LLM"
  ],
  "parameters": [
    {
      "name": "model",
      "in": "query",
      "required": true,
      "schema": {
        "type": "string"
      }
    }
  ],
  "responses": {
    "200": {
      "description": "Model properties",
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "additionalProperties": true
          }
        }
      }
    },
    "400": {
      "$ref": "#/components/responses/ModelError"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

GET /v1/models

Получить список моделей, совместимых с OpenAI

Public model listing in the OpenAI `object: list` shape. Each entry adds capabilities such as input/output modalities, context length, per-token pricing, tool and reasoning support, model organization, and provider routes.
Параметры, запрос и ответы
{
  "operationId": "listOpenAIModels",
  "summary": "Получить список моделей, совместимых с OpenAI",
  "description": "Public model listing in the OpenAI `object: list` shape. Each entry adds capabilities such as input/output modalities, context length, per-token pricing, tool and reasoning support, model organization, and provider routes.",
  "tags": [
    "LLM"
  ],
  "security": [],
  "responses": {
    "200": {
      "description": "Model list",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAIModelList"
          }
        }
      }
    }
  }
}

GET /v1/models/{id}

Получить одну модель, совместимую с OpenAI

Returns a single published model in the same shape as the `GET /v1/models` listing.
Параметры, запрос и ответы
{
  "operationId": "getOpenAIModel",
  "summary": "Получить одну модель, совместимую с OpenAI",
  "description": "Returns a single published model in the same shape as the `GET /v1/models` listing.",
  "tags": [
    "LLM"
  ],
  "security": [],
  "responses": {
    "200": {
      "description": "Model",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAIModel"
          },
          "example": {
            "id": "qwen3-7-plus",
            "object": "model",
            "created": 0,
            "owned_by": "Alibaba",
            "capabilities": {
              "purpose": "chat",
              "context_length": 1000000,
              "supports_tools": true,
              "supports_reasoning": false
            }
          }
        }
      }
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

GET /llms.txt

Получить индекс для LLM-агентов

Plain-text `llms.txt` index that links developer resources such as API documentation, OpenAPI, the MCP server, model catalog, monitor, pricing, and data policy.
Параметры, запрос и ответы
{
  "operationId": "getLlmIndex",
  "summary": "Получить индекс для LLM-агентов",
  "description": "Plain-text `llms.txt` index that links developer resources such as API documentation, OpenAPI, the MCP server, model catalog, monitor, pricing, and data policy.",
  "tags": [
    "LLM"
  ],
  "security": [],
  "responses": {
    "200": {
      "description": "Agent index",
      "content": {
        "text/plain": {
          "schema": {
            "type": "string"
          }
        }
      }
    }
  }
}

POST /v1/images/generations

Поставить в очередь генерацию изображения, совместимую с OpenAI

This is asynchronous. A `202` response contains job IDs; poll each `status_url` for completion rather than expecting image data.
Параметры, запрос и ответы
{
  "operationId": "createOpenAIImageGeneration",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Поставить в очередь генерацию изображения, совместимую с OpenAI",
  "description": "This is asynchronous. A `202` response contains job IDs; poll each `status_url` for completion rather than expecting image data.",
  "tags": [
    "Генерация изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/OpenAIImageRequest"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Image jobs queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAIImageJobResponse"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/images/edits

Поставить в очередь редактирование изображения, совместимое с OpenAI

This is asynchronous. Submit a multipart `image` upload (or `uploaded_image_id`); poll the returned job `status_url`.
Параметры, запрос и ответы
{
  "operationId": "createOpenAIImageEdit",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Поставить в очередь редактирование изображения, совместимое с OpenAI",
  "description": "This is asynchronous. Submit a multipart `image` upload (or `uploaded_image_id`); poll the returned job `status_url`.",
  "tags": [
    "Генерация изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/OpenAIImageEditRequest"
        },
        "encoding": {
          "image": {
            "contentType": "image/*"
          },
          "mask": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Image jobs queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/OpenAIImageJobResponse"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /v1/audio/speech

Конечная точка совместимости синтеза речи

Routed for client compatibility but not implemented because media work is asynchronous.
Параметры, запрос и ответы
{
  "operationId": "createSpeech",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Конечная точка совместимости синтеза речи",
  "description": "Routed for client compatibility but not implemented because media work is asynchronous.",
  "tags": [
    "Аудио"
  ],
  "responses": {
    "501": {
      "$ref": "#/components/responses/NotImplemented"
    }
  }
}

POST /v1/audio/transcriptions

Конечная точка совместимости транскрибации аудио

Routed for client compatibility but not implemented because media work is asynchronous.
Параметры, запрос и ответы
{
  "operationId": "createTranscription",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Конечная точка совместимости транскрибации аудио",
  "description": "Routed for client compatibility but not implemented because media work is asynchronous.",
  "tags": [
    "Аудио"
  ],
  "responses": {
    "501": {
      "$ref": "#/components/responses/NotImplemented"
    }
  }
}

GET /v1/audio/voices

Конечная точка совместимости каталога голосов

Routed for client compatibility but not implemented because media work is asynchronous.
Параметры, запрос и ответы
{
  "operationId": "listVoices",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Конечная точка совместимости каталога голосов",
  "description": "Routed for client compatibility but not implemented because media work is asynchronous.",
  "tags": [
    "Аудио"
  ],
  "responses": {
    "501": {
      "$ref": "#/components/responses/NotImplemented"
    }
  }
}

POST /v1/audio/voices

Конечная точка совместимости каталога голосов

Routed for client compatibility but not implemented because media work is asynchronous.
Параметры, запрос и ответы
{
  "operationId": "createVoice",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "llm"
      ]
    }
  ],
  "summary": "Конечная точка совместимости каталога голосов",
  "description": "Routed for client compatibility but not implemented because media work is asynchronous.",
  "tags": [
    "Аудио"
  ],
  "responses": {
    "501": {
      "$ref": "#/components/responses/NotImplemented"
    }
  }
}

POST /sdapi/v1/txt2img

Поставить в очередь задачу Stable Diffusion WebUI «текст в изображение»

This compatibility endpoint is asynchronous. Poll the returned `status_url`; it does not return encoded images.
Параметры, запрос и ответы
{
  "operationId": "sdapiTxt2Img",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Поставить в очередь задачу Stable Diffusion WebUI «текст в изображение»",
  "description": "This compatibility endpoint is asynchronous. Poll the returned `status_url`; it does not return encoded images.",
  "tags": [
    "Генерация изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "application/json": {
        "schema": {
          "$ref": "#/components/schemas/SdapiImageRequest"
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Image jobs queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SdapiJobResponse"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

POST /sdapi/v1/img2img

Поставить в очередь задачу Stable Diffusion WebUI «изображение в изображение»

This compatibility endpoint is asynchronous. Poll the returned `status_url`; it does not return encoded images.
Параметры, запрос и ответы
{
  "operationId": "sdapiImg2Img",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Поставить в очередь задачу Stable Diffusion WebUI «изображение в изображение»",
  "description": "This compatibility endpoint is asynchronous. Poll the returned `status_url`; it does not return encoded images.",
  "tags": [
    "Генерация изображений"
  ],
  "requestBody": {
    "required": true,
    "content": {
      "multipart/form-data": {
        "schema": {
          "$ref": "#/components/schemas/SdapiImageRequest"
        },
        "encoding": {
          "init_images": {
            "contentType": "image/*"
          },
          "mask": {
            "contentType": "image/*"
          }
        }
      }
    }
  },
  "responses": {
    "202": {
      "description": "Image jobs queued",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/SdapiJobResponse"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "422": {
      "$ref": "#/components/responses/ModelError"
    }
  }
}

GET /sdapi/v1/loras

Получить список LoRA для Stable Diffusion WebUI

AI Chaos does not expose provider LoRA weights as runnable assets, so this always returns an empty list.
Параметры, запрос и ответы
{
  "operationId": "listSdapiLoras",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "generations"
      ]
    }
  ],
  "summary": "Получить список LoRA для Stable Diffusion WebUI",
  "description": "AI Chaos does not expose provider LoRA weights as runnable assets, so this always returns an empty list.",
  "tags": [
    "LLM"
  ],
  "responses": {
    "200": {
      "description": "Empty LoRA list",
      "content": {
        "application/json": {
          "schema": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    }
  }
}

GET /health

Проверить состояние базы данных и Redis

Параметры, запрос и ответы
{
  "operationId": "getHealth",
  "summary": "Проверить состояние базы данных и Redis",
  "tags": [
    "Система"
  ],
  "security": [],
  "responses": {
    "200": {
      "description": "Dependencies are healthy",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Health"
          }
        }
      }
    },
    "503": {
      "description": "One or more dependencies are unavailable",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/Health"
          }
        }
      }
    }
  }
}

GET /api/v1/quests/catalog

Получить каталог заданий

Returns every code-defined quest with its one-time spark reward and target, regardless of the user's progress.
Параметры, запрос и ответы
{
  "operationId": "listQuests",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить каталог заданий",
  "description": "Returns every code-defined quest with its one-time spark reward and target, regardless of the user's progress.",
  "tags": [
    "Задания"
  ],
  "responses": {
    "200": {
      "description": "Quest catalog",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/QuestCatalog"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

GET /api/v1/quests/progress

Получить прогресс заданий текущего пользователя

Recomputes and returns normalized per-quest progress for the authenticated user. Completed quests are claimable until claimed.
Параметры, запрос и ответы
{
  "operationId": "getQuestProgress",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить прогресс заданий текущего пользователя",
  "description": "Recomputes and returns normalized per-quest progress for the authenticated user. Completed quests are claimable until claimed.",
  "tags": [
    "Задания"
  ],
  "responses": {
    "200": {
      "description": "Per-quest progress",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/QuestProgressList"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    }
  }
}

POST /api/v1/quests/{quest_key}/check

Повторно проверить одно задание

Recomputes eligibility for one quest and returns its current state. Terminal quests are throttled by a short cooldown.
Параметры, запрос и ответы
{
  "operationId": "checkQuest",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Повторно проверить одно задание",
  "description": "Recomputes eligibility for one quest and returns its current state. Terminal quests are throttled by a short cooldown.",
  "tags": [
    "Задания"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/QuestKey"
    }
  ],
  "responses": {
    "200": {
      "description": "Quest state after evaluation",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/QuestProgress"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    }
  }
}

POST /api/v1/quests/{quest_key}/claim

Получить награду за выполненное задание

Atomically credits the one-time spark reward exactly once and is idempotent — repeated claims are no-ops.
Параметры, запрос и ответы
{
  "operationId": "claimQuestReward",
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "BearerAuth": []
    },
    {
      "OAuth2": [
        "account"
      ]
    }
  ],
  "summary": "Получить награду за выполненное задание",
  "description": "Atomically credits the one-time spark reward exactly once and is idempotent — repeated claims are no-ops.",
  "tags": [
    "Задания"
  ],
  "parameters": [
    {
      "$ref": "#/components/parameters/QuestKey"
    }
  ],
  "responses": {
    "200": {
      "description": "Reward claimed (or already claimed)",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/QuestClaim"
          }
        }
      }
    },
    "401": {
      "$ref": "#/components/responses/Unauthorized"
    },
    "403": {
      "$ref": "#/components/responses/Forbidden"
    },
    "404": {
      "$ref": "#/components/responses/NotFound"
    },
    "409": {
      "description": "Quest is not completed yet",
      "content": {
        "application/json": {
          "schema": {
            "$ref": "#/components/schemas/QuestClaim"
          }
        }
      }
    }
  }
}