OpenAPI 3.1
Справочник клиентского API
На этой странице описаны поддерживаемые запросы и ответы клиентского API инференса. Для инструментов можно скачать машиночитаемый документ OpenAPI.
Скачать JSON OpenAPIПримеры API моделей
Выберите опубликованный идентификатор модели, протокол API и язык, чтобы увидеть пример запроса. Храните API-ключи клиентов на доверенном сервере.
Требования протоколов
Для запросов, совместимых с OpenAI, используется POST /chat/completions по настроенному базовому URL API клиента (по умолчанию https://fusionpointai.com/api/v1). Для аутентификации передайте ключ клиента с доступом к инференсу в заголовке Authorization: Bearer. Полный URL по умолчанию: https://fusionpointai.com/api/v1/chat/completions.
Для запросов Claude Messages используется POST /api/v1/messages. Передайте ключ клиента в заголовке x-api-key и укажите anthropic-version: 2023-06-01. Базовый URL Anthropic SDK — https://fusionpointai.com/api, поскольку SDK сам добавляет /v1/messages. Также поддерживается аутентификация Bearer.
Поддерживаемые возможности
Текущая конечная точка чата, совместимая с OpenAI, обрабатывает текстовые сообщения синхронно. Потоковая передача и вызов инструментов этой конечной точкой не поддерживаются.
Прокси Claude Messages сохраняет исходные блоки содержимого и данные инструментов, а также передаёт в реальном времени события, отправляемые сервером (SSE), если выбранная вышестоящая модель их поддерживает.
Установка клиентских библиотек
Установите библиотеки для Python и Node.js как отдельные пакеты:
Python: pip install openai anthropic
Node.js: npm install openai @anthropic-ai/sdk
curl 'https://fusionpointai.com/api/v1/chat/completions' \
-H "Authorization: Bearer $FUSIONPOINTAI_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "Astra 6",
"messages": [
{
"role": "user",
"content": "Summarize this in one sentence."
}
],
"temperature": 0.7,
"max_tokens": 300
}'
Сценарии запросов
Безопасная настройка API-ключей
Создайте API-ключ клиента с доступом к инференсу и передайте его серверному процессу через менеджер секретов или переменные окружения.
- Задайте
FUSIONPOINTAI_API_KEYв окружении сервера. Не встраивайте ключ в код браузера и не добавляйте его в систему контроля версий. - Используйте HTTPS и ограничьте ключ учётной записью и правами на инференс, которые необходимы приложению.
- Удаляйте из журналов, трассировок и обращений в поддержку заголовки Authorization и
x-api-key. Отзовите ключ, если он мог стать известен посторонним.
export FUSIONPOINTAI_API_KEY="YOUR_CUSTOMER_API_KEY"
Точный идентификатор модели
Поле model задаёт маршрутизацию запроса, а не отображаемое название. Выбирайте идентификатор, опубликованный в актуальном каталоге моделей.
- Выберите активную или устаревшую модель, для которой указан статус доступности инференса.
- Скопируйте идентификатор без изменений, включая знаки препинания и суффикс версии. Не составляйте его по названию модели.
- Если идентификатор не опубликован, дождитесь его появления в каталоге, а не подставляйте предполагаемое значение.
model_id = "Astra 6"
# Use this exact identifier with either protocol.
Системные инструкции и диалог из нескольких сообщений
Сохраняйте исходный порядок реплик и используйте только те роли и форматы содержимого, которые поддерживают выбранные протокол и модель.
- В запросах, совместимых с OpenAI, передавайте сообщения system, user и assistant по порядку, в строковом формате содержимого.
- Для Claude Messages указывайте системную инструкцию и упорядоченные реплики user/assistant в предусмотренных протоколом полях.
- Оставляйте в контексте только необходимые приложению сообщения и учитывайте ограничение контекста выбранной модели.
response = client.messages.create(
model="Astra 6",
max_tokens=512,
system="Answer in clear, concise German.",
messages=[
{"role": "user", "content": "What is an API?"},
{"role": "assistant", "content": "An API lets software exchange requests and responses."},
{"role": "user", "content": "Give a practical example."},
],
)
for block in response.content:
if block.type == "text":
print(block.text)
Ответы в формате JSON
Если приложению нужны структурированные данные, прежде чем использовать ответ, проверьте его соответствие собственной схеме приложения.
- Используйте средства структурированного вывода, доступные для выбранного протокола и вышестоящей модели.
- Считайте сгенерированный JSON недоверенными данными: разберите его, проверьте обязательные поля и типы, предусмотрите обработку некорректного результата.
- Не предполагайте, что сочетание модели и протокола поддерживает режим JSON, если это не указано в документации модели.
import json
# JSON is generated content, not trusted application input.
response = client.messages.create(
model="Astra 6", max_tokens=256,
messages=[{"role": "user", "content": 'Return only JSON with a string field named "summary". Explain an API in one sentence.'}],
)
text = "".join(block.text for block in response.content if block.type == "text")
try:
result = json.loads(text)
if not isinstance(result, dict) or not isinstance(result.get("summary"), str):
raise ValueError("Unexpected response schema")
print(result["summary"])
except (json.JSONDecodeError, ValueError) as error:
print("Handle invalid model output:", error)
Потоковая передача SSE в реальном времени
Потоковый режим зависит от выбранного протокола и вышестоящей модели. Обычный ответ JSON не является потоком.
- Текущая совместимая с OpenAI конечная точка чата возвращает текст синхронно и не поддерживает потоковую передачу.
- Для Claude Messages включайте потоковый режим, если его поддерживает выбранная вышестоящая модель; прокси передаёт исходные события, отправляемые сервером (SSE).
- Обрабатывайте события по мере поступления, корректно завершайте обработку при окончании или ошибке и не считайте частичный вывод готовым ответом.
# client is the Anthropic client configured above.
with client.messages.stream(
model="Astra 6", max_tokens=512,
messages=[{"role": "user", "content": "Explain API authentication."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)
final_message = stream.get_final_message()
print("\nStop reason:", final_message.stop_reason)
Инструменты, блоки содержимого и ошибки
Сохраняйте структуры, предусмотренные протоколом, и явно задавайте поведение приложения при вызове инструментов, передаче мультимодальных данных и сбоях.
- Совместимый с OpenAI чат сейчас не поддерживает ни вызов инструментов, ни нетекстовые блоки содержимого.
- Claude сохраняет исходные блоки содержимого и данные вызова и результатов инструментов, если это поддерживает выбранная вышестоящая модель. Перед выполнением проверяйте имена инструментов и аргументы.
- Проверяйте HTTP-статус и тело ответа, различайте ошибки аутентификации, прав доступа, валидации и ограничения частоты запросов. Временные ошибки повторяйте с увеличивающимися интервалами.
import json
from datetime import datetime, timezone
from anthropic import APIError
messages = [{"role": "user", "content": "What time is it in UTC?"}]
tools = [{
"name": "current_utc_time", "description": "Read the current UTC time.",
"input_schema": {"type": "object", "properties": {}, "additionalProperties": False},
}]
try:
reply = client.messages.create(model="Astra 6", max_tokens=256, messages=messages, tools=tools)
results = []
for block in reply.content:
if block.type == "tool_use":
if block.name != "current_utc_time" or block.input != {}:
raise ValueError("Unapproved tool request")
results.append({"type": "tool_result", "tool_use_id": block.id,
"content": json.dumps({"utc": datetime.now(timezone.utc).isoformat()})})
if results:
messages.append({"role": "assistant", "content": reply.content})
messages.append({"role": "user", "content": results})
reply = client.messages.create(model="Astra 6", max_tokens=256, messages=messages, tools=tools)
print("".join(block.text for block in reply.content if block.type == "text"))
except APIError as error:
# Log status only; never log keys or private prompts.
print("API request failed:", getattr(error, "status_code", None))
Часто задаваемые вопросы
Можно ли указать в запросе отображаемое название модели?
Используйте только точный идентификатор, опубликованный для инференса. Отображаемое название не задаёт маршрутизацию; неопубликованный идентификатор нельзя угадывать.
В какой переменной окружения хранить ключ клиента?
Для обоих протоколов используйте FUSIONPOINTAI_API_KEY. Храните значение в доверенном окружении сервера, не помещайте его в клиентский код или журналы.
Какой URL указать в клиенте OpenAI?
Используйте настроенный базовый URL API клиента; по умолчанию это https://fusionpointai.com/api/v1. Конечная точка chat completions добавляет /chat/completions.
Почему базовый URL Claude SDK отличается от URL для cURL?
Anthropic SDK сам добавляет /v1/messages, поэтому задайте ему базовый URL https://fusionpointai.com/api. В прямом HTTP-запросе указывается полный URL /api/v1/messages.
Поддерживает ли совместимый с OpenAI чат потоковую передачу и инструменты?
Нет. Текущая конечная точка поддерживает только синхронные текстовые сообщения; потоковая передача и вызов инструментов недоступны.
Все ли модели Claude поддерживают блоки, инструменты и потоковую передачу?
Нет. Эти возможности сохраняются, только если их поддерживает выбранная вышестоящая модель. Проверьте возможности модели и предусмотрите обработку неподдерживаемых запросов.
Claude Messages · POST /messages
Для запросов Claude Messages используется POST /api/v1/messages. Передайте ключ клиента в заголовке x-api-key и укажите anthropic-version: 2023-06-01. Базовый URL Anthropic SDK — https://fusionpointai.com/api, поскольку SDK сам добавляет /v1/messages. Также поддерживается аутентификация Bearer.
Прокси Claude Messages сохраняет исходные блоки содержимого и данные инструментов, а также передаёт в реальном времени события, отправляемые сервером (SSE), если выбранная вышестоящая модель их поддерживает.
| Поле | Тип | Обязательное | Ограничения |
|---|---|---|---|
model |
string |
Да | {"minLength":1,"maxLength":160} |
max_tokens |
integer |
Да | {"minimum":1,"maximum":100000} |
messages |
array |
Да | {"minItems":1,"maxItems":100,"items":{"type":"object","required":["role","content"],"properties":{"role":{"type":"string","enum":["user","assistant"]},"content":{"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","required":["type"],"properties":{"type":{"type":"string","maxLength":80}},"additionalProperties":true}}]}}}} |
system |
string | array |
Нет | {"oneOf":[{"type":"string"},{"type":"array","items":{"type":"object","required":["type","text"],"properties":{"type":{"const":"text"},"text":{"type":"string"}},"additionalProperties":true}}]} |
stream |
boolean |
Нет | {"default":false} |
temperature |
number |
Нет | {"minimum":0,"maximum":1} |
top_p |
number |
Нет | {"minimum":0,"maximum":1} |
top_k |
integer |
Нет | {"minimum":0,"maximum":100000} |
stop_sequences |
array |
Нет | {"items":{"type":"string"}} |
tools |
array |
Нет | {"items":{"type":"object","additionalProperties":true}} |
tool_choice |
object |
Нет | {"additionalProperties":true} |
thinking |
object |
Нет | {"additionalProperties":true} |
metadata |
object |
Нет | {"additionalProperties":true} |
output_config |
object |
Нет | {"additionalProperties":true} |
service_tier |
string |
Нет | [] |
{
"id": "msg_example",
"type": "message",
"role": "assistant",
"model": "Astra 6",
"content": [
{
"type": "text",
"text": "A concise answer to the supplied question."
}
],
"stop_reason": "end_turn",
"stop_sequence": null,
"usage": {
"input_tokens": 12,
"output_tokens": 10
}
}
{"type":"error","error":{"type":"authentication_error","message":"Invalid or missing API key."}}
Краткие инструкции по SDK
Используйте производственный базовый URL с совместимым клиентом для Python или Node.js либо отправьте тот же запрос JSON с помощью cURL.
Базовый URL API: https://fusionpointai.com/api/v1
Передавайте клиентский API-ключ в заголовке Authorization: Bearer. Ключу необходима область действия ai:inference и доступ учётной записи к сервису. Храните ключ на доверенном сервере.
# Install the client for your application language.
# Python:
python -m pip install openai
# Node.js:
npm install openai
# Bash: enter the key without storing it in shell history.
read -rs -p 'FusionPointAI API key: ' FUSIONPOINTAI_API_KEY
export FUSIONPOINTAI_API_KEY
printf '\n'
# After finishing:
# unset FUSIONPOINTAI_API_KEY
curl 'https://fusionpointai.com/api/v1/chat/completions' \
-H "Authorization: Bearer $FUSIONPOINTAI_API_KEY" \
-H "Content-Type: application/json" \
--data '{
"model": "Jurassic-2",
"messages": [
{
"role": "user",
"content": "Summarize this in one sentence."
}
],
"temperature": 0.7,
"max_tokens": 300
}'
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ["FUSIONPOINTAI_API_KEY"],
base_url="https://fusionpointai.com/api/v1",
)
response = client.chat.completions.create(
model="Jurassic-2",
messages=[{"role": "user", "content": "Summarize this in one sentence."}],
temperature=0.7,
max_tokens=300,
)
print(response.choices[0].message.content)
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.FUSIONPOINTAI_API_KEY,
baseURL: "https://fusionpointai.com/api/v1",
});
const response = await client.chat.completions.create({
model: "Jurassic-2",
messages: [{ role: "user", content: "Summarize this in one sentence." }],
temperature: 0.7,
max_tokens: 300,
});
console.log(response.choices[0].message.content);
OpenAI · Поля запроса
Значения модели должны точно совпадать с опубликованными идентификаторами из реестра, доступными для инференса. Если таких идентификаторов нет, перед отправкой запроса обратитесь к каталогу провайдеров.
| Поле | Тип | Обязательное | Ограничения |
|---|---|---|---|
model | string | Да | Не более 160 символов; используйте точный опубликованный идентификатор. |
messages | array | Да | От 1 до 100 сообщений, передаваемых по порядку. |
messages[].role | string | Да | system, user или assistant. |
messages[].content | string | Да | Не более 100 000 символов на сообщение. |
temperature | number | Нет | От 0 до 2. |
max_tokens | integer | Нет | От 1 до 100 000; для модели может действовать более низкий предел. |
Успешный ответ
Успешный ответ JSON содержит id, object (chat.completion), created, model и choices. Элемент choices включает index, сообщение assistant и finish_reason. Также могут возвращаться сведения об использовании токенов.
{
"id": "chatcmpl_example",
"object": "chat.completion",
"created": 1700000000,
"model": "Jurassic-2",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "A concise summary of the supplied text."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 12,
"completion_tokens": 10,
"total_tokens": 22
}
}
| Поле | Тип | Значение |
|---|---|---|
id | string | Уникальный идентификатор завершения. |
object | string | Тип ответа: chat.completion. |
created | integer | Время создания в формате временной метки Unix. |
model | string | Идентификатор модели, использованной для генерации ответа. |
choices | array | Варианты завершения с сообщением assistant и причиной завершения. |
usage | object | Количество токенов, если эти сведения возвращаются. |
Ограничения частоты и ошибки
В рамках действующих клиентских подписок количество запросов и токенов не учитывается по квоте; для sandbox-ключей действует опубликованный месячный лимит. Также сохраняются ограничения контекста модели, размера ответа и временные ограничения трафика. Chat Completions передаёт текст синхронно; Claude Messages сохраняет поддерживаемые моделью исходные блоки содержимого, инструменты и SSE. Перед отправкой запросов изучите отдельные схемы операций.
Ошибки проверки и провайдера при выполнении операции чата возвращаются в объекте error. Промежуточное ПО аутентификации и проверки области действия может вместо этого вернуть поле message в корне ответа. Статус и структура ответа зависят от уровня, на котором был отклонён запрос.
| HTTP-статус | Значение |
|---|---|
200 | Ответ успешно создан. |
400 | Недопустимое тело или параметр запроса. |
401 | Bearer API-ключ отсутствует или недействителен. |
403 | Не предоставлена необходимая область действия ключа или доступ учётной записи. |
429 | Ограничение частоты запросов приложения или временное ограничение трафика вышестоящей системы; повторите запрос с увеличивающимся интервалом. |
500 | Сервис не смог вернуть пригодный ответ. |
Скачать JSON OpenAPI
{
"openapi": "3.1.0",
"info": {
"title": "FusionPointAI Customer API",
"version": "1.0.0",
"description": "OpenAI-compatible synchronous text Chat Completions and native Claude Messages. Use https://fusionpointai.com/api/v1 as the production HTTP base URL. Claude SDKs use the base without /v1 because they append /v1/messages. Model capabilities, subscription permissions and technical limits still apply. Native streaming and content blocks belong to the Messages operation, not Chat Completions."
},
"servers": [
{
"url": "https://fusionpointai.com/api/v1",
"description": "FusionPointAI Production API"
}
],
"security": [
{
"bearerAuth": []
}
],
"tags": [
{
"name": "Inference",
"description": "Synchronous JSON chat completion"
}
],
"x-rateLimitPolicy": {
"type": "unmetered_subscription",
"summary": "Live subscriptions do not meter request or token usage against a quota; sandbox keys use their published monthly allowance.",
"technical_constraints": "Model context windows, maximum output sizes, and temporary traffic controls may still apply according to the selected model or upstream provider."
},
"x-errorReference": [
{
"status": 200,
"description": "The completion was created successfully."
},
{
"status": 400,
"description": "The request body or one of its parameters is invalid."
},
{
"status": 401,
"description": "The bearer API key is missing or invalid."
},
{
"status": 403,
"description": "The key lacks the required inference scope or account access."
},
{
"status": 429,
"description": "The request was limited by application throttling or an upstream provider."
},
{
"status": 500,
"description": "The service could not complete the request."
}
],
"paths": {
"/chat/completions": {
"post": {
"tags": [
"Inference"
],
"summary": "Create a chat completion",
"operationId": "createChatCompletion",
"description": "Create a synchronous JSON completion. Messages support system, user, and assistant roles with string content. Use the separate Messages operation for native Claude content blocks and SSE.",
"security": [
{
"bearerAuth": []
}
],
"x-codeSamples": [
{
"lang": "cURL",
"label": "cURL",
"source": "curl 'https://fusionpointai.com/api/v1/chat/completions' \\\n -H \"Authorization: Bearer $FUSIONPOINTAI_API_KEY\" \\\n -H \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"Jurassic-2\",\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Summarize this in one sentence.\"\n }\n ],\n \"temperature\": 0.7,\n \"max_tokens\": 300\n}'"
},
{
"lang": "Python",
"label": "Python",
"source": "import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n api_key=os.environ[\"FUSIONPOINTAI_API_KEY\"],\n base_url=\"https://fusionpointai.com/api/v1\",\n)\n\nresponse = client.chat.completions.create(\n model=\"Jurassic-2\",\n messages=[{\"role\": \"user\", \"content\": \"Summarize this in one sentence.\"}],\n temperature=0.7,\n max_tokens=300,\n)\nprint(response.choices[0].message.content)"
},
{
"lang": "Node.js",
"label": "Node.js",
"source": "import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n apiKey: process.env.FUSIONPOINTAI_API_KEY,\n baseURL: \"https://fusionpointai.com/api/v1\",\n});\n\nconst response = await client.chat.completions.create({\n model: \"Jurassic-2\",\n messages: [{ role: \"user\", content: \"Summarize this in one sentence.\" }],\n temperature: 0.7,\n max_tokens: 300,\n});\nconsole.log(response.choices[0].message.content);"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionRequest"
}
}
}
},
"responses": {
"200": {
"description": "Completion created",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ChatCompletionResponse"
}
}
}
},
"400": {
"$ref": "#/components/responses/BadRequest"
},
"401": {
"$ref": "#/components/responses/Unauthorised"
},
"403": {
"$ref": "#/components/responses/Forbidden"
},
"429": {
"$ref": "#/components/responses/RateLimited"
},
"500": {
"$ref": "#/components/responses/ServerError"
}
}
}
},
"/messages": {
"post": {
"tags": [
"Inference"
],
"summary": "Create a Claude Messages response",
"operationId": "createMessage",
"description": "Native Messages format. The model must support the requested content blocks, tools and streaming options. The gateway forwards provider-native JSON or real SSE without translating it into Chat Completions. A configured native upstream is required. Maximum JSON request size: 12 MiB.",
"security": [
{
"claudeApiKey": []
},
{
"bearerAuth": []
}
],
"parameters": [
{
"in": "header",
"name": "anthropic-version",
"schema": {
"type": "string",
"maxLength": 64
},
"example": "2023-06-01"
},
{
"in": "header",
"name": "anthropic-beta",
"schema": {
"type": "string",
"maxLength": 512
}
}
],
"x-codeSamples": [
{
"lang": "cURL",
"label": "cURL",
"source": "curl 'https://fusionpointai.com/api/v1/messages' \\\n -H \"x-api-key: $FUSIONPOINTAI_API_KEY\" \\\n -H \"anthropic-version: 2023-06-01\" \\\n -H \"Content-Type: application/json\" \\\n --data '{\n \"model\": \"Jurassic-2\",\n \"max_tokens\": 300,\n \"messages\": [\n {\n \"role\": \"user\",\n \"content\": \"Summarize this in one sentence.\"\n }\n ]\n}'"
},
{
"lang": "Python",
"label": "Python",
"source": "import os\nfrom anthropic import Anthropic\n\nclient = Anthropic(\n api_key=os.environ[\"FUSIONPOINTAI_API_KEY\"],\n base_url=\"https://fusionpointai.com/api\",\n)\n\nresponse = client.messages.create(\n model=\"Jurassic-2\",\n max_tokens=300,\n messages=[{\"role\": \"user\", \"content\": \"Summarize this in one sentence.\"}],\n)\nprint(response.content)"
},
{
"lang": "Node.js",
"label": "Node.js",
"source": "import Anthropic from \"@anthropic-ai/sdk\";\n\nconst client = new Anthropic({\n apiKey: process.env.FUSIONPOINTAI_API_KEY,\n baseURL: \"https://fusionpointai.com/api\",\n});\n\nconst response = await client.messages.create({\n model: \"Jurassic-2\",\n max_tokens: 300,\n messages: [{ role: \"user\", content: \"Summarize this in one sentence.\" }],\n});\nconsole.log(response.content);"
}
],
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeMessagesRequest"
}
}
}
},
"responses": {
"200": {
"description": "Native message or incremental native SSE events.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeMessage"
}
},
"text/event-stream": {
"schema": {
"type": "string",
"description": "message_start, content_block_start/delta/stop, message_delta/stop and provider error events as delivered upstream."
}
}
}
},
"201": {
"description": "Invalid JSON, message structure, field type or bounds.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"202": {
"description": "Missing, invalid, conflicting or query-string credentials.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"203": {
"description": "Scope, account or training-reference permission denied.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"204": {
"description": "Request exceeds 12 MiB.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"205": {
"description": "Application or upstream rate limit.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"206": {
"description": "Inference provider or service failure.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"207": {
"description": "Inference provider or service failure.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"208": {
"description": "Native upstream or server credentials are not configured.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
},
"209": {
"description": "Upstream overloaded.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/ClaudeError"
}
}
}
}
}
}
}
},
"components": {
"securitySchemes": {
"bearerAuth": {
"type": "http",
"scheme": "bearer",
"bearerFormat": "API key"
},
"claudeApiKey": {
"type": "apiKey",
"in": "header",
"name": "x-api-key"
}
},
"schemas": {
"ChatCompletionRequest": {
"type": "object",
"required": [
"model",
"messages"
],
"properties": {
"model": {
"type": "string",
"maxLength": 160,
"enum": [
"Jurassic-2",
"Claude Fable 5.1",
"claude-opus-5-5",
"claude-sonnet-5-5",
"claude-haiku-5-5",
"Claude Opus 5",
"Claude Fable 5",
"Claude Mythos 5",
"Claude Sonnet 5",
"Claude Opus 4.8",
"Claude Haiku 4.5",
"command-a-plus-05-2026",
"command-a-reasoning-08-2025",
"command-a-vision-07-2025",
"command-a-translate-08-2025",
"embed-v5.0-pro",
"embed-v5.0-fast",
"rerank-v5.0-pro",
"rerank-v5.0-fast",
"Command R",
"Command R+",
"Embed",
"Rerank",
"deepseek-flash",
"DeepSeek V4",
"GLM-5.3",
"glm-5.3-flashx",
"GLM-5.3 Flash",
"GLM-4.7",
"kimi-k3.1-pro",
"kimi-k3.1-pro-highspeed",
"Kimi K3",
"Kimi K2.7 Code",
"Kimi K2.6",
"Kimi K2.5",
"Astra 6",
"gpt-6.1-sol",
"gpt-6.1-terra",
"gpt-6-luna",
"GPT-5.6 Sol",
"GPT-5.6 Terra",
"GPT-5.6 Luna",
"GPT-5.5",
"GPT-5.4",
"GPT-5.4 mini",
"GPT-5.4 nano",
"qwen3.8-max",
"qwen3.8-flash",
"qwen3.8-omni-flash",
"qwen3.7-plus",
"Qwen3.8",
"Qwen3 Coder Next",
"Qwen3-VL"
],
"description": "An exact registered model identifier currently published for inference."
},
"messages": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"$ref": "#/components/schemas/ChatMessage"
}
},
"temperature": {
"type": "number",
"minimum": 0,
"maximum": 2
},
"max_tokens": {
"type": "integer",
"minimum": 1,
"maximum": 100000,
"description": "The selected model may impose a lower output limit."
}
}
},
"ChatMessage": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"type": "string",
"enum": [
"system",
"user",
"assistant"
]
},
"content": {
"type": "string",
"maxLength": 100000
}
}
},
"ChatCompletionResponse": {
"type": "object",
"required": [
"id",
"object",
"model",
"choices"
],
"properties": {
"id": {
"type": "string"
},
"object": {
"type": "string",
"example": "chat.completion"
},
"created": {
"type": "integer"
},
"model": {
"type": "string"
},
"choices": {
"type": "array",
"items": {
"$ref": "#/components/schemas/ChatChoice"
}
},
"usage": {
"$ref": "#/components/schemas/TokenUsage"
}
}
},
"ChatChoice": {
"type": "object",
"properties": {
"index": {
"type": "integer"
},
"message": {
"$ref": "#/components/schemas/ChatMessage"
},
"finish_reason": {
"type": [
"string",
"null"
]
}
}
},
"TokenUsage": {
"type": "object",
"properties": {
"prompt_tokens": {
"type": "integer"
},
"completion_tokens": {
"type": "integer"
},
"total_tokens": {
"type": "integer"
}
}
},
"Error": {
"oneOf": [
{
"$ref": "#/components/schemas/OperationError"
},
{
"$ref": "#/components/schemas/MiddlewareError"
}
]
},
"OperationError": {
"type": "object",
"required": [
"error"
],
"properties": {
"error": {
"type": "object",
"required": [
"message",
"type",
"code"
],
"properties": {
"message": {
"type": "string"
},
"type": {
"type": "string"
},
"code": {
"type": [
"string",
"integer",
"null"
]
},
"details": {
"type": "object",
"additionalProperties": {
"type": "array",
"items": {
"type": "string"
}
}
}
}
}
}
},
"MiddlewareError": {
"type": "object",
"required": [
"message"
],
"properties": {
"message": {
"type": "string"
}
},
"additionalProperties": true
},
"ClaudeMessagesRequest": {
"type": "object",
"required": [
"model",
"max_tokens",
"messages"
],
"properties": {
"model": {
"type": "string",
"minLength": 1,
"maxLength": 160,
"enum": [
"Jurassic-2",
"Claude Fable 5.1",
"claude-opus-5-5",
"claude-sonnet-5-5",
"claude-haiku-5-5",
"Claude Opus 5",
"Claude Fable 5",
"Claude Mythos 5",
"Claude Sonnet 5",
"Claude Opus 4.8",
"Claude Haiku 4.5",
"command-a-plus-05-2026",
"command-a-reasoning-08-2025",
"command-a-vision-07-2025",
"command-a-translate-08-2025",
"embed-v5.0-pro",
"embed-v5.0-fast",
"rerank-v5.0-pro",
"rerank-v5.0-fast",
"Command R",
"Command R+",
"Embed",
"Rerank",
"deepseek-flash",
"DeepSeek V4",
"GLM-5.3",
"glm-5.3-flashx",
"GLM-5.3 Flash",
"GLM-4.7",
"kimi-k3.1-pro",
"kimi-k3.1-pro-highspeed",
"Kimi K3",
"Kimi K2.7 Code",
"Kimi K2.6",
"Kimi K2.5",
"Astra 6",
"gpt-6.1-sol",
"gpt-6.1-terra",
"gpt-6-luna",
"GPT-5.6 Sol",
"GPT-5.6 Terra",
"GPT-5.6 Luna",
"GPT-5.5",
"GPT-5.4",
"GPT-5.4 mini",
"GPT-5.4 nano",
"qwen3.8-max",
"qwen3.8-flash",
"qwen3.8-omni-flash",
"qwen3.7-plus",
"Qwen3.8",
"Qwen3 Coder Next",
"Qwen3-VL"
]
},
"max_tokens": {
"type": "integer",
"minimum": 1,
"maximum": 100000
},
"messages": {
"type": "array",
"minItems": 1,
"maxItems": 100,
"items": {
"type": "object",
"required": [
"role",
"content"
],
"properties": {
"role": {
"type": "string",
"enum": [
"user",
"assistant"
]
},
"content": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"maxLength": 80
}
},
"additionalProperties": true
}
}
]
}
}
}
},
"system": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "object",
"required": [
"type",
"text"
],
"properties": {
"type": {
"const": "text"
},
"text": {
"type": "string"
}
},
"additionalProperties": true
}
}
]
},
"stream": {
"type": "boolean",
"default": false
},
"temperature": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"top_p": {
"type": "number",
"minimum": 0,
"maximum": 1
},
"top_k": {
"type": "integer",
"minimum": 0,
"maximum": 100000
},
"stop_sequences": {
"type": "array",
"items": {
"type": "string"
}
},
"tools": {
"type": "array",
"items": {
"type": "object",
"additionalProperties": true
}
},
"tool_choice": {
"type": "object",
"additionalProperties": true
},
"thinking": {
"type": "object",
"additionalProperties": true
},
"metadata": {
"type": "object",
"additionalProperties": true
},
"output_config": {
"type": "object",
"additionalProperties": true
},
"service_tier": {
"type": "string"
}
},
"additionalProperties": true
},
"ClaudeMessage": {
"type": "object",
"required": [
"type",
"content"
],
"properties": {
"id": {
"type": "string"
},
"type": {
"const": "message"
},
"role": {
"const": "assistant"
},
"content": {
"type": "array",
"items": {
"type": "object",
"required": [
"type"
],
"properties": {
"type": {
"type": "string",
"maxLength": 80
}
},
"additionalProperties": true
}
},
"model": {
"type": "string"
},
"stop_reason": {
"type": [
"string",
"null"
]
},
"usage": {
"type": "object",
"properties": {
"input_tokens": {
"type": "integer"
},
"output_tokens": {
"type": "integer"
}
},
"additionalProperties": true
}
},
"additionalProperties": true
},
"ClaudeError": {
"type": "object",
"required": [
"type",
"error"
],
"properties": {
"type": {
"const": "error"
},
"error": {
"type": "object",
"required": [
"type",
"message"
],
"properties": {
"type": {
"type": "string"
},
"message": {
"type": "string"
}
}
}
}
}
},
"responses": {
"BadRequest": {
"description": "Invalid request body or parameter.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"Unauthorised": {
"description": "Missing or invalid bearer API key.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"Forbidden": {
"description": "The key lacks the required inference scope or account access.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"RateLimited": {
"description": "Application throttle or temporary upstream traffic control.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
},
"ServerError": {
"description": "The service could not return a usable completion.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/Error"
}
}
}
}
}
}
}