{"components":{"parameters":{"VideoID":{"description":"Идентификатор задачи из ответа POST /videos.","example":"video_trace_abc","in":"path","name":"id","required":true,"schema":{"type":"string"}}},"responses":{"BadRequest":{"content":{"application/json":{"example":{"error":{"code":400,"message":"Unknown model: 'vendor/x'.","metadata":{"param":"model"}}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Запрос неверен или его стоимость нельзя ограничить заранее. Ничего не списано; параметр — в metadata.param."},"Expired":{"content":{"application/json":{"example":{"error":{"code":410,"message":"The generated video is no longer available from the provider.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Видео было готово, но провайдер его уже не хранит."},"InsufficientBalance":{"content":{"application/json":{"example":{"error":{"code":402,"message":"Insufficient balance for this request.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Баланса не хватает на резерв этого запроса."},"Moderation":{"content":{"application/json":{"example":{"error":{"code":403,"message":"The input was flagged by moderation.","metadata":{"reasons":["violence"]}}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Входные данные не прошли модерацию; причины — в metadata.reasons."},"NotFound":{"content":{"application/json":{"example":{"error":{"code":404,"message":"No such video job.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"У этого аккаунта нет такого объекта."},"NotReady":{"content":{"application/json":{"example":{"error":{"code":409,"message":"The video is not ready yet.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Видео ещё генерируется."},"ProviderRejected":{"content":{"application/json":{"example":{"error":{"code":422,"message":"The model provider rejected the request.","metadata":{"provider_message":"Image too large."}}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Провайдер модели отклонил запрос; его статус сохраняется (400, 404, 413 или 422), объяснение провайдера — в metadata.provider_message."},"RateLimited":{"content":{"application/json":{"example":{"error":{"code":429,"message":"The model provider is busy. Retry later.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Слишком много запросов или провайдер модели перегружен. Повторите позже; заголовок Retry-After, если он есть, говорит, через сколько секунд."},"Unauthorized":{"content":{"application/json":{"example":{"error":{"code":401,"message":"Incorrect API key provided.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Ключ не передан, неверен или отозван, либо аккаунт приостановлен."},"Unavailable":{"content":{"application/json":{"example":{"error":{"code":503,"message":"Billing is temporarily unavailable.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Списания или провайдер модели временно недоступны. Повторите позже."},"Upstream":{"content":{"application/json":{"example":{"error":{"code":502,"message":"The model provider returned an error.","metadata":null}},"schema":{"$ref":"#/components/schemas/Error"}}},"description":"Провайдер модели не ответил или вернул ошибку."}},"schemas":{"ChatMessage":{"additionalProperties":true,"description":"Сообщение диалога.","properties":{"content":{"description":"Текст сообщения или список частей (текст, картинки, файлы).","nullable":true,"oneOf":[{"description":"Текст сообщения.","type":"string"},{"description":"Части сообщения.","items":{"$ref":"#/components/schemas/ContentPart"},"type":"array"}]},"name":{"description":"Имя участника, если их несколько.","type":"string"},"role":{"description":"Автор: system и developer — инструкции модели, user — пользователь, assistant — прошлые ответы модели, tool — результат вызова функции.","enum":["system","developer","user","assistant","tool"],"type":"string"},"tool_call_id":{"description":"Для role: tool — id вызова функции, на который это ответ.","type":"string"},"tool_calls":{"description":"Вызовы функций в прошлом ответе модели (role: assistant), как модель их вернула.","items":{"additionalProperties":true,"description":"Вызов функции: id, type: function, function.name и function.arguments.","type":"object"},"type":"array"}},"required":["role"],"type":"object"},"ChatRequest":{"additionalProperties":true,"description":"Запрос к модели чата.","properties":{"frequency_penalty":{"description":"Штраф за частые повторы слов: выше — меньше повторов.","maximum":2,"minimum":-2,"type":"number"},"max_completion_tokens":{"description":"Предел длины ответа в токенах. Если не задан, шлюз подставит наименьший предел из моделей запроса; резерв считается по нему.","minimum":1,"type":"integer"},"max_tokens":{"description":"Прежнее имя max_completion_tokens; действует так же.","minimum":1,"type":"integer"},"messages":{"description":"История диалога по порядку; последним обычно идёт сообщение пользователя.","items":{"$ref":"#/components/schemas/ChatMessage"},"type":"array"},"model":{"description":"ID модели из каталога, например openai/gpt-4o-mini. openrouter/auto — только с плагином auto-router и списком allowed_models.","type":"string"},"models":{"description":"Запасные модели: если первая недоступна, запрос уходит следующей. Каждая должна быть в каталоге; резерв — по самой дорогой.","items":{"description":"ID модели из каталога.","type":"string"},"type":"array"},"parallel_tool_calls":{"description":"Разрешить модели вызывать несколько функций за один ответ.","type":"boolean"},"plugins":{"description":"Плагины: auto-router (выбор модели из allowed_models), file-parser (разбор PDF: cloudflare-ai, mistral-ocr), context-compression, moderation, response-healing.","items":{"additionalProperties":true,"description":"Плагин: {\"id\": …} и его настройки.","type":"object"},"type":"array"},"presence_penalty":{"description":"Штраф за слова, которые уже встречались: выше — модель чаще переходит к новым темам.","maximum":2,"minimum":-2,"type":"number"},"provider":{"additionalProperties":true,"description":"Предпочтения провайдеров модели (порядок, исключения). Свой max_price ниже закупочной цены сохраняется, выше — шлюз ограничивает.","type":"object"},"reasoning":{"additionalProperties":true,"description":"Рассуждения для моделей, которые их поддерживают. Токены рассуждений входят в completion_tokens и в предел вывода.","properties":{"effort":{"description":"Сколько модель рассуждает перед ответом: больше — точнее и дороже.","enum":["none","minimal","low","medium","high","xhigh","max"],"type":"string"}},"type":"object"},"response_format":{"additionalProperties":true,"description":"Формат ответа: {\"type\": \"json_object\"} — любой JSON, {\"type\": \"json_schema\", \"json_schema\": {…}} — JSON по вашей схеме. Поддерживают не все модели.","type":"object"},"seed":{"description":"Зерно случайности: одинаковый запрос с тем же seed даёт похожий ответ. Поддерживают не все модели.","type":"integer"},"service_tier":{"description":"Уровень обслуживания у провайдера; другие значения отклоняются с кодом 400.","enum":["auto","default","flex"],"type":"string"},"stop":{"description":"Строка или до четырёх строк, на которых модель остановит ответ.","oneOf":[{"description":"Одна стоп-строка.","type":"string"},{"description":"Несколько стоп-строк.","items":{"description":"Стоп-строка.","type":"string"},"type":"array"}]},"stream":{"default":false,"description":"Отдавать ответ потоком событий (text/event-stream) по мере генерации.","type":"boolean"},"stream_options":{"description":"Настройки потока.","properties":{"include_usage":{"description":"Прислать перед data: [DONE] чанк с usage — уже после списания.","type":"boolean"}},"type":"object"},"temperature":{"description":"Случайность ответа: 0 — предсказуемо, выше — разнообразнее. Обычно 0–1.","maximum":2,"minimum":0,"type":"number"},"tool_choice":{"description":"Когда вызывать функции: none — никогда, auto — на усмотрение модели, required — обязательно; объект {\"type\": \"function\", \"function\": {\"name\": …}} — конкретную функцию из tools.","oneOf":[{"description":"none, auto или required.","type":"string"},{"additionalProperties":true,"description":"Конкретный инструмент из tools.","type":"object"}]},"tools":{"description":"Функции, которые модель может вызвать, и один инструмент веб-поиска openrouter:web_search с движком exa, parallel или perplexity.","items":{"additionalProperties":true,"description":"Описание инструмента: {\"type\": \"function\", \"function\": {\"name\", \"description\", \"parameters\"}} или {\"type\": \"openrouter:web_search\"}.","type":"object"},"type":"array"},"top_k":{"description":"Выбор только из k самых вероятных слов. Поддерживают не все модели.","minimum":0,"type":"integer"},"top_p":{"description":"Выбор только из самых вероятных слов с суммарной вероятностью top_p. Меняйте либо его, либо temperature.","maximum":1,"minimum":0,"type":"number"},"usage":{"description":"Учёт расхода. В обычном ответе usage приходит всегда; в потоке — только если попросить здесь или в stream_options.","properties":{"include":{"description":"Прислать в потоке перед data: [DONE] чанк с usage — уже после списания.","type":"boolean"}},"type":"object"},"user":{"description":"Стабильный идентификатор вашего пользователя — помогает провайдерам отличать злоупотребления одного клиента.","type":"string"}},"required":["model","messages"],"type":"object"},"ChatResponse":{"additionalProperties":true,"description":"Ответ модели.","properties":{"choices":{"description":"Варианты ответа; обычно один.","items":{"additionalProperties":true,"description":"Вариант ответа.","properties":{"finish_reason":{"description":"Почему ответ закончился: stop — модель закончила или встретила стоп-строку; length — упёрся в предел вывода; tool_calls — ждёт результатов функций; content_filter — сработал фильтр; error — ошибка провайдера.","nullable":true,"type":"string"},"index":{"description":"Номер варианта с нуля.","type":"integer"},"message":{"additionalProperties":true,"description":"Сообщение модели.","properties":{"content":{"description":"Текст ответа; null, если модель только вызвала функции.","nullable":true,"type":"string"},"role":{"description":"Всегда assistant.","type":"string"},"tool_calls":{"description":"Вызовы функций: выполните их и пришлите результаты сообщениями role: tool.","items":{"additionalProperties":true,"description":"Вызов: id, type: function, function.name, function.arguments (JSON строкой).","type":"object"},"type":"array"}},"type":"object"}},"type":"object"},"type":"array"},"created":{"description":"Время создания, Unix-секунды.","type":"integer"},"id":{"description":"ID генерации; его же видно в кабинете.","type":"string"},"model":{"description":"Модель, которая ответила (может отличаться от запрошенной при models или auto-router).","type":"string"},"object":{"description":"Всегда chat.completion.","type":"string"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["id","choices"],"type":"object"},"ContentPart":{"additionalProperties":true,"description":"Часть сообщения: текст, картинка или файл.","properties":{"file":{"additionalProperties":true,"description":"Файл — для type: file, например PDF.","properties":{"file_data":{"description":"Содержимое как data URL в base64 (data:application/pdf;base64,…). Файлы по ссылке и file_id не принимаются.","type":"string"},"filename":{"description":"Имя файла с расширением.","type":"string"}},"type":"object"},"image_url":{"additionalProperties":true,"description":"Картинка — для type: image_url.","properties":{"detail":{"description":"Детализация: auto, low или high; original не поддерживается.","type":"string"},"url":{"description":"Ссылка https:// или data:image/…;base64,…","type":"string"}},"type":"object"},"text":{"description":"Текст — для type: text.","type":"string"},"type":{"description":"Вид части.","enum":["text","image_url","file"],"type":"string"}},"required":["type"],"type":"object"},"EmbeddingRequest":{"additionalProperties":true,"description":"Запрос эмбеддингов.","properties":{"dimensions":{"description":"Длина вектора, если модель умеет её сокращать (например, text-embedding-3).","minimum":1,"type":"integer"},"encoding_format":{"description":"float — массив чисел; base64 — те же числа упакованы строкой, ответ короче.","enum":["float","base64"],"type":"string"},"input":{"description":"Текст или список текстов; на каждый вернётся свой вектор.","oneOf":[{"description":"Один текст.","type":"string"},{"description":"Несколько текстов.","items":{"description":"Текст.","type":"string"},"type":"array"}]},"input_type":{"description":"Назначение текста для моделей, которые различают запросы и документы: search_query или search_document.","type":"string"},"model":{"description":"ID модели эмбеддингов из каталога, например openai/text-embedding-3-small.","type":"string"}},"required":["model","input"],"type":"object"},"EmbeddingResponse":{"additionalProperties":true,"description":"Векторы.","properties":{"data":{"description":"По одному элементу на каждый входной текст.","items":{"additionalProperties":true,"description":"Вектор одного текста.","properties":{"embedding":{"description":"Вектор: массив чисел, при encoding_format: base64 — строка.","oneOf":[{"description":"Массив чисел.","items":{"description":"Компонента вектора.","type":"number"},"type":"array"},{"description":"Числа float32, упакованные в base64.","type":"string"}]},"index":{"description":"Номер текста во входе.","type":"integer"},"object":{"description":"Всегда embedding.","type":"string"}},"type":"object"},"type":"array"},"model":{"description":"Модель, которая посчитала векторы.","type":"string"},"object":{"description":"Всегда list.","type":"string"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["data"],"type":"object"},"Error":{"properties":{"error":{"description":"Описание ошибки.","properties":{"code":{"description":"HTTP-статус ответа числом.","type":"integer"},"message":{"description":"Причина по-английски, для журнала и разработчика.","type":"string"},"metadata":{"additionalProperties":true,"description":"Подробности или null: param — параметр запроса, из-за которого отказ; reasons — причины модерации; provider_message — объяснение провайдера.","nullable":true,"type":"object"}},"required":["code","message","metadata"],"type":"object"}},"required":["error"],"type":"object"},"ImageRequest":{"additionalProperties":true,"description":"Запрос генерации изображений.","properties":{"aspect_ratio":{"description":"Соотношение сторон: 1:1, 16:9, 9:16, 4:3, 3:2 и другие; модель берёт ближайшее из тех, что умеет.","type":"string"},"background":{"description":"Фон; transparent — только с output_format png или webp.","enum":["auto","transparent","opaque"],"type":"string"},"model":{"description":"ID модели изображений из каталога, например google/gemini-2.5-flash-image.","type":"string"},"n":{"default":1,"description":"Сколько изображений сделать. Больше, чем допускает модель, — отказ 400; резерв — на все n.","minimum":1,"type":"integer"},"output_compression":{"description":"Сжатие для jpeg и webp: 100 — без потерь качества.","maximum":100,"minimum":0,"type":"integer"},"output_format":{"description":"Формат файла изображения; svg — только у моделей векторизации, разметка SVG приходит в b64_json.","enum":["png","jpeg","webp","svg"],"type":"string"},"prompt":{"description":"Описание изображения: что изображено, стиль, свет, композиция.","type":"string"},"quality":{"description":"Качество отрисовки. Модели без такой настройки её не учитывают.","enum":["auto","low","medium","high","xhigh","max"],"type":"string"},"resolution":{"description":"Ступень разрешения: 512, 768, 1K, 1.5K, 2K или 4K; точный размер в пикселях выбирает модель.","type":"string"},"seed":{"description":"Зерно случайности для повторяемого результата. Поддерживают не все модели.","type":"integer"},"size":{"description":"Размер одной строкой: ступень (2K) или пиксели (2048x2048). Заменяет resolution и aspect_ratio.","type":"string"}},"required":["model","prompt"],"type":"object"},"ImageResponse":{"additionalProperties":true,"description":"Готовые изображения.","properties":{"created":{"description":"Время создания, Unix-секунды.","type":"integer"},"data":{"description":"Изображения; провайдер может вернуть меньше, чем n.","items":{"additionalProperties":true,"description":"Одно изображение.","properties":{"b64_json":{"description":"Файл изображения в base64.","type":"string"}},"type":"object"},"type":"array"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["data"],"type":"object"},"ModelList":{"additionalProperties":true,"description":"Список моделей.","properties":{"data":{"description":"Модели.","items":{"additionalProperties":true,"description":"Модель.","properties":{"created":{"description":"Пока всегда 0: дата появления модели не передаётся.","type":"integer"},"id":{"description":"ID модели для поля model.","type":"string"},"object":{"description":"Всегда model.","type":"string"},"owned_by":{"description":"Разработчик модели; aireplica, если он не указан в каталоге.","type":"string"}},"type":"object"},"type":"array"},"object":{"description":"Всегда list.","type":"string"}},"required":["data"],"type":"object"},"RerankRequest":{"additionalProperties":true,"description":"Запрос ранжирования.","properties":{"documents":{"description":"Документы, которые нужно упорядочить.","items":{"description":"Текст документа.","type":"string"},"type":"array"},"model":{"description":"ID модели ранжирования из каталога, например cohere/rerank-v3.5.","type":"string"},"query":{"description":"Поисковый запрос.","type":"string"},"top_n":{"description":"Сколько лучших документов вернуть; по умолчанию — все.","minimum":1,"type":"integer"}},"required":["model","query","documents"],"type":"object"},"RerankResponse":{"additionalProperties":true,"description":"Результат ранжирования.","properties":{"id":{"description":"ID генерации.","type":"string"},"model":{"description":"Модель, которая ранжировала.","type":"string"},"results":{"description":"Документы по убыванию релевантности.","items":{"additionalProperties":true,"description":"Документ и его оценка.","properties":{"index":{"description":"Номер документа во входном documents.","type":"integer"},"relevance_score":{"description":"Релевантность от 0 до 1: выше — ближе к запросу.","type":"number"}},"type":"object"},"type":"array"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["results"],"type":"object"},"SpeechRequest":{"additionalProperties":true,"description":"Запрос синтеза речи.","properties":{"input":{"description":"Текст, который нужно озвучить. Только строка: реплики нескольких голосов списком не поддерживаются.","type":"string"},"instructions":{"description":"Как читать: тон, темп, эмоция. Поддерживают не все модели.","type":"string"},"model":{"description":"ID модели синтеза из каталога, например openai/gpt-4o-mini-tts.","type":"string"},"response_format":{"default":"pcm","description":"Формат аудио: mp3 — сжатый, pcm — несжатый.","enum":["mp3","pcm"],"type":"string"},"speed":{"description":"Скорость речи, 1 — обычная. Модели без такой настройки её не учитывают или отклоняют запрос.","type":"number"},"voice":{"description":"Голос модели, например alloy; голоса своей модели смотрите в каталоге.","type":"string"}},"required":["model","input"],"type":"object"},"TranscriptionRequest":{"additionalProperties":true,"description":"Запрос расшифровки с записью в base64.","properties":{"input_audio":{"description":"Запись речи.","properties":{"data":{"description":"Аудио в base64 (без префикса data:).","type":"string"},"format":{"description":"Формат записи: wav, mp3, m4a, ogg, flac, webm.","type":"string"}},"required":["data"],"type":"object"},"language":{"description":"Язык записи кодом ISO 639-1 (ru, en). Если не задан, модель определит сама.","type":"string"},"model":{"description":"ID модели расшифровки из каталога, например openai/whisper-1.","type":"string"},"response_format":{"description":"json — только текст; verbose_json — ещё язык, длительность и отрезки с временем (поддерживают не все модели).","enum":["json","verbose_json"],"type":"string"},"temperature":{"description":"Случайность расшифровки; обычно не нужна.","maximum":1,"minimum":0,"type":"number"}},"required":["model","input_audio"],"type":"object"},"TranscriptionResponse":{"additionalProperties":true,"description":"Расшифровка.","properties":{"duration":{"description":"Длительность записи в секундах (при verbose_json).","type":"number"},"language":{"description":"Язык записи (при verbose_json).","type":"string"},"text":{"description":"Текст записи.","type":"string"},"usage":{"$ref":"#/components/schemas/Usage"}},"required":["text"],"type":"object"},"TranscriptionUpload":{"description":"Запрос расшифровки с файлом в форме.","properties":{"file":{"description":"Файл записи; формат — по расширению имени файла.","format":"binary","type":"string"},"language":{"description":"Язык записи кодом ISO 639-1 (ru, en).","type":"string"},"model":{"description":"ID модели расшифровки из каталога.","type":"string"}},"required":["model","file"],"type":"object"},"Usage":{"additionalProperties":true,"description":"Расход и стоимость запроса.","properties":{"completion_tokens":{"description":"Токенов в ответе, включая рассуждения модели.","type":"integer"},"cost":{"description":"Списанная сумма в рублях, пять знаков после точки (тысячные доли копейки). null, пока стоимость уточняется (pending) или списание на проверке (review).","nullable":true,"type":"number"},"cost_status":{"description":"Как определена стоимость: final — по фактической цене провайдера; estimated — по нашему прайсу; pending — уточняется, списание будет позже; review — решает оператор.","enum":["final","estimated","pending","review"],"type":"string"},"prompt_tokens":{"description":"Токенов во входе.","type":"integer"},"total_tokens":{"description":"Всего токенов.","type":"integer"}},"type":"object"},"VideoAccepted":{"description":"Принятая задача.","properties":{"id":{"description":"Идентификатор задачи.","type":"string"},"polling_url":{"description":"Адрес для опроса статуса (GET /videos/{id}).","type":"string"},"status":{"description":"Статус у провайдера; pending, если провайдер его не сообщил.","type":"string"}},"required":["id","status","polling_url"],"type":"object"},"VideoJob":{"description":"Состояние задачи.","properties":{"content_url":{"description":"Адрес файла (GET /videos/{id}/content); появляется при completed.","type":"string"},"error":{"description":"generation_failed — провайдер не сделал видео, резерв возвращён; provider_unavailable — провайдер не отвечает, опрос повторяется; billing_review — списание на проверке у оператора, статус может оставаться in_progress до суток.","enum":["generation_failed","provider_unavailable","billing_review"],"type":"string"},"id":{"description":"Идентификатор задачи.","type":"string"},"polling_url":{"description":"Адрес этого же запроса для следующего опроса.","type":"string"},"status":{"description":"in_progress — генерируется; completed — готово, можно скачивать; failed — не получилось.","enum":["in_progress","completed","failed"],"type":"string"}},"required":["id","status","polling_url"],"type":"object"},"VideoRequest":{"additionalProperties":true,"description":"Запрос генерации видео.","properties":{"aspect_ratio":{"description":"Соотношение сторон вместе с resolution: 16:9, 9:16, 1:1 и другие.","type":"string"},"duration":{"description":"Длительность в секундах. Если не задана — наибольшая, которую допускает модель, и резерв по ней.","minimum":1,"type":"integer"},"frame_images":{"description":"Первый и последний кадр ролика. Если модель берёт за входную картинку доплату, она входит в резерв.","items":{"additionalProperties":true,"description":"Картинка кадра: frame_type (first_frame или last_frame) и сама картинка.","type":"object"},"type":"array"},"generate_audio":{"description":"Сгенерировать звук вместе с видео — у моделей, которые это умеют.","type":"boolean"},"input_references":{"description":"Картинки-референсы для стиля и персонажей. Доплата за картинку, если она есть у модели, входит в резерв.","items":{"additionalProperties":true,"description":"Референс: картинка по ссылке или в base64.","type":"object"},"type":"array"},"model":{"description":"ID модели видео из каталога, например google/veo-3.1-fast.","type":"string"},"prompt":{"description":"Описание ролика. Можно не задавать модели, которая делает видео по одной картинке.","type":"string"},"resolution":{"description":"Разрешение вместо size: 480p, 720p, 1080p, 4K и другие, которые есть у модели.","type":"string"},"seed":{"description":"Зерно случайности для повторяемого результата. Поддерживают не все модели.","type":"integer"},"size":{"description":"Размер кадра ШИРИНАxВЫСОТА, например 1280x720. Если не задан ни он, ни resolution, — наибольший кадр модели.","type":"string"}},"required":["model"],"type":"object"}},"securitySchemes":{"bearerAuth":{"description":"Ключ API из кабинета: заголовок Authorization: Bearer \u003cключ\u003e.","scheme":"bearer","type":"http"}}},"info":{"description":"API в формате OpenRouter: чат, эмбеддинги, ранжирование, изображения, речь и видео. Перед отправкой модели каждый платный запрос резервирует наибольшую возможную стоимость, после ответа списывается фактическая; usage.cost — списанная сумма в рублях. Ключ передаётся в заголовке Authorization: Bearer \u003cключ\u003e.","title":"AIReplica API","version":"2026-10-13"},"openapi":"3.0.3","paths":{"/chat/completions":{"post":{"description":"Отправляет историю сообщений модели и возвращает её ответ — целиком или потоком (stream: true). Формат запроса и ответа — как у OpenRouter и OpenAI Chat Completions. Шлюз дописывает в тело учёт расхода, предел вывода (если он не задан) и provider.max_price; остальное доходит до модели без изменений. Запрос, стоимость которого нельзя ограничить заранее, отклоняется с кодом 400 до списания.","operationId":"createChatCompletion","requestBody":{"content":{"application/json":{"example":{"max_tokens":200,"messages":[{"content":"Отвечай кратко.","role":"system"},{"content":"Как называется столица Франции?","role":"user"}],"model":"openai/gpt-4o-mini","temperature":0.7},"schema":{"$ref":"#/components/schemas/ChatRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"example":{"choices":[{"finish_reason":"stop","index":0,"message":{"content":"Париж.","role":"assistant"}}],"created":1760270000,"id":"gen-1760270000-abc","model":"openai/gpt-4o-mini","object":"chat.completion","usage":{"completion_tokens":3,"cost":0.03124,"cost_status":"final","prompt_tokens":24,"total_tokens":27}},"schema":{"$ref":"#/components/schemas/ChatResponse"}},"text/event-stream":{"example":"data: {\"id\":\"gen-1760270000-abc\",\"choices\":[{\"index\":0,\"delta\":{\"role\":\"assistant\",\"content\":\"Па\"}}]}\n\ndata: {\"id\":\"gen-1760270000-abc\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"риж.\"},\"finish_reason\":\"stop\"}]}\n\ndata: [DONE]\n\n","schema":{"description":"Поток событий: каждая строка data: — JSON-чанк с choices[].delta, в конце data: [DONE].","type":"string"}}},"description":"Ответ модели. При stream: true — поток text/event-stream: чанки ChatChunk в строках data: и последняя строка data: [DONE]."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientBalance"},"403":{"$ref":"#/components/responses/Moderation"},"404":{"$ref":"#/components/responses/ProviderRejected"},"413":{"$ref":"#/components/responses/ProviderRejected"},"422":{"$ref":"#/components/responses/ProviderRejected"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/Upstream"},"503":{"$ref":"#/components/responses/Unavailable"}},"summary":"Ответ модели в чате"}},"/embeddings":{"post":{"description":"Переводит текст или список текстов в векторы чисел для поиска по смыслу, кластеризации и рекомендаций. Близкие по смыслу тексты дают близкие векторы.","operationId":"createEmbedding","requestBody":{"content":{"application/json":{"example":{"input":["Как оплатить заказ?","Способы оплаты и возврат"],"model":"openai/text-embedding-3-small"},"schema":{"$ref":"#/components/schemas/EmbeddingRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"example":{"data":[{"embedding":[0.0123,-0.0456,0.0789],"index":0,"object":"embedding"},{"embedding":[0.0111,-0.0402,0.0815],"index":1,"object":"embedding"}],"model":"openai/text-embedding-3-small","object":"list","usage":{"cost":0.00009,"cost_status":"final","prompt_tokens":12,"total_tokens":12}},"schema":{"$ref":"#/components/schemas/EmbeddingResponse"}}},"description":"Векторы в порядке входных текстов."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientBalance"},"403":{"$ref":"#/components/responses/Moderation"},"404":{"$ref":"#/components/responses/ProviderRejected"},"413":{"$ref":"#/components/responses/ProviderRejected"},"422":{"$ref":"#/components/responses/ProviderRejected"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/Upstream"},"503":{"$ref":"#/components/responses/Unavailable"}},"summary":"Эмбеддинги текста"}},"/models":{"get":{"description":"Модели, которые обслуживает API. Схема ответа ещё изменится: пока используйте только id. Цены и возможности моделей — в каталоге на сайте.","operationId":"listModels","responses":{"200":{"content":{"application/json":{"example":{"data":[{"created":0,"id":"openai/gpt-4o-mini","object":"model","owned_by":"openai"}],"object":"list"},"schema":{"$ref":"#/components/schemas/ModelList"}}},"description":"Список моделей."},"401":{"$ref":"#/components/responses/Unauthorized"},"502":{"$ref":"#/components/responses/Upstream"}},"summary":"Список моделей","x-unstable":true}},"/openapi.json":{"get":{"description":"Описание API в формате OpenAPI 3.0 — только маршруты, которые сервис сейчас обслуживает. Ключ не нужен.","operationId":"getOpenAPI","responses":{"200":{"content":{"application/json":{"example":{"openapi":"3.0.3"},"schema":{"additionalProperties":true,"description":"Документ OpenAPI 3.0.","type":"object"}}},"description":"Документ OpenAPI."}},"security":[],"summary":"Описание API"}},"/rerank":{"post":{"description":"Упорядочивает документы по релевантности поисковому запросу. Обычно применяется вторым шагом поиска: сначала кандидаты находят эмбеддинги, затем ранжирование выбирает лучшие.","operationId":"createRerank","requestBody":{"content":{"application/json":{"example":{"documents":["Париж — столица Франции.","Берлин находится в Германии."],"model":"cohere/rerank-v3.5","query":"столица Франции","top_n":2},"schema":{"$ref":"#/components/schemas/RerankRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"example":{"id":"gen-rerank-1","model":"cohere/rerank-v3.5","results":[{"index":0,"relevance_score":0.98},{"index":1,"relevance_score":0.02}],"usage":{"cost":0.17,"cost_status":"final"}},"schema":{"$ref":"#/components/schemas/RerankResponse"}}},"description":"Документы по убыванию релевантности."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"402":{"$ref":"#/components/responses/InsufficientBalance"},"403":{"$ref":"#/components/responses/Moderation"},"404":{"$ref":"#/components/responses/ProviderRejected"},"413":{"$ref":"#/components/responses/ProviderRejected"},"422":{"$ref":"#/components/responses/ProviderRejected"},"429":{"$ref":"#/components/responses/RateLimited"},"502":{"$ref":"#/components/responses/Upstream"},"503":{"$ref":"#/components/responses/Unavailable"}},"summary":"Ранжирование документов"}},"/videos/{id}":{"get":{"description":"Возвращает состояние задачи. Опрашивайте раз в 10–30 секунд, пока status не станет completed или failed; при completed в ответе появится content_url.","operationId":"getVideo","parameters":[{"$ref":"#/components/parameters/VideoID"}],"responses":{"200":{"content":{"application/json":{"example":{"content_url":"https://api.aireplica.ru/v1/videos/video_trace_abc/content","id":"video_trace_abc","polling_url":"https://api.aireplica.ru/v1/videos/video_trace_abc","status":"completed"},"schema":{"$ref":"#/components/schemas/VideoJob"}}},"description":"Состояние задачи."},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"502":{"$ref":"#/components/responses/Upstream"}},"summary":"Статус задачи на видео"}},"/videos/{id}/content":{"get":{"description":"Отдаёт готовый ролик файлом MP4. Провайдер хранит его ограниченное время: после этого ответ — 410.","operationId":"getVideoContent","parameters":[{"$ref":"#/components/parameters/VideoID"},{"description":"Какой ролик скачать, если модель сделала несколько; 0 — первый.","in":"query","name":"index","required":false,"schema":{"default":0,"minimum":0,"type":"integer"}}],"responses":{"200":{"content":{"video/mp4":{"schema":{"description":"Ролик в формате MP4.","format":"binary","type":"string"}}},"description":"Видеофайл."},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"409":{"$ref":"#/components/responses/NotReady"},"410":{"$ref":"#/components/responses/Expired"},"502":{"$ref":"#/components/responses/Upstream"}},"summary":"Скачать видео"}}},"security":[{"bearerAuth":[]}],"servers":[{"url":"https://api.aireplica.ru/v1"},{"url":"https://api.aireplica.ru/api/v1"}]}