跳到主要内容

OpenAPI 3.1

客户 API 参考

本页说明受支持的客户推理请求和响应。可下载机器可读的 OpenAPI 文档,以供开发工具使用。

下载 OpenAPI JSON

模型 API 示例

选择已发布的模型标识符、API 协议和语言,以查看请求示例。请仅在可信服务器上保存客户 API 密钥。

协议要求

兼容 OpenAI 的请求使用 POST /chat/completions,并发送到配置的客户 API 基础 URL(默认值为 https://fusionpointai.com/api/v1)。使用具有推理权限的客户密钥,通过 Authorization: Bearer 进行身份验证。完整默认 URL 为 https://fusionpointai.com/api/v1/chat/completions。

支持的功能

当前兼容 OpenAI 的聊天端点支持同步文本消息,不支持流式传输和工具调用。

安装客户端

Python 和 Node.js 客户端是两个独立的软件包,请分别安装:

Python: pip install openai anthropic

Node.js: npm install openai @anthropic-ai/sdk

cURL
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 密钥,并通过密钥管理器或环境变量将其提供给服务器进程。

  1. 在服务器环境中设置 FUSIONPOINTAI_API_KEY;不要将密钥嵌入浏览器代码或提交到源代码仓库。
  2. 使用 HTTPS,并将密钥限制为应用所需的账户和推理权限。
  3. 从日志、追踪记录和支持请求中删去 Authorization 和 x-api-key 标头;如果密钥可能已泄露,请立即撤销。
Bash
export FUSIONPOINTAI_API_KEY="YOUR_CUSTOMER_API_KEY"

选择准确的模型标识符

模型字段用于路由请求,不是展示名称。请选择在线模型目录中发布的标识符。

  1. 选择已启用且标记为可用于推理的模型或旧版模型。
  2. 准确复制模型标识符,包括标点和版本后缀;不要根据模型名称自行推测 ID。
  3. 如果尚未发布标识符,请等待模型目录提供,而不要填写猜测值。
Python
model_id = "Astra 6"
# Use this exact identifier with either protocol.

发送系统消息和多轮对话

请按原有顺序保留对话轮次,并仅使用所选协议和模型支持的角色及内容格式。

  1. 对于兼容 OpenAI 的请求,请按顺序发送 system、user 和 assistant 消息,并使用字符串作为内容。
  2. 对于 Claude Messages,请在协议原生字段中发送受支持的 system 指令以及按顺序排列的 user/assistant 轮次。
  3. 仅保留应用需要的对话上下文,并遵守所选模型的上下文长度限制。
Python
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 响应

如果应用需要结构化输出,请先根据应用自身的 schema 校验响应,再使用其中的数据。

  1. 使用所选协议和上游模型支持的结构化输出控制项。
  2. 将生成的 JSON 视为不可信输入:解析并校验必需字段和类型,同时妥善处理无效输出。
  3. 除非模型文档明确说明支持,否则不要假定模型与协议的组合支持 JSON 模式。
Python
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 响应并非流。

  1. 当前兼容 OpenAI 的聊天接口仅返回同步文本,不提供流式传输。
  2. 对于 Claude Messages,如果所选上游模型支持流式传输,请启用 stream 模式;代理会转发原生服务器发送事件。
  3. 逐步处理事件,在完成或出错时妥善停止;不要把部分输出当作完整答案。
Python
# 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)

处理工具、内容块和错误

保留协议原生结构,并明确规定应用对工具调用、多模态内容和失败情况的处理方式。

  1. 当前兼容 OpenAI 的聊天接口既不支持工具调用,也不支持非文本内容块。
  2. 如果所选上游模型支持,Claude 会保留原生内容块以及工具使用/结果数据;执行前请校验工具名称和参数。
  3. 检查 HTTP 状态码和响应正文,区分身份验证、权限、校验和速率限制错误,并通过退避策略重试临时性错误。
Python
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。请将其值保存在可信的服务器环境中,不要放入客户端代码或日志。

OpenAI 客户端应使用哪个 URL?

使用配置的客户 API 基础 URL,默认值为 https://fusionpointai.com/api/v1。聊天补全端点还需追加 /chat/completions。

为什么 Claude SDK 的基础 URL 与 cURL 不同?

Anthropic SDK 会追加 /v1/messages,因此其基础 URL 应设为 https://fusionpointai.com/api。直接发送 HTTP 请求时则使用完整的 /api/v1/messages URL。

兼容 OpenAI 的聊天接口支持流式传输或工具吗?

不支持。当前端点仅支持同步文本消息,不提供流式传输和工具调用。

是否保证所有 Claude 模型都支持内容块、工具或流式传输?

不保证。只有在所选上游模型支持时,才会保留这些原生功能。请查看该模型的能力说明,并妥善处理不受支持的请求。

Claude Messages · POST /messages

Claude Messages 请求使用 POST /api/v1/messages。请将客户密钥放在 x-api-key 中,并将 anthropic-version 设为 2023-06-01。Anthropic SDK 的基础 URL 为 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 否 []
Claude Messages · 示例
{
    "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 客户端,也可以通过 cURL 发送相同的 JSON 请求。

API 基础 URL: https://fusionpointai.com/api/v1

请在 Authorization: Bearer 标头中发送客户 API 密钥。密钥必须具有 ai:inference 权限范围,且账户须有权访问此服务。请将密钥保存在可信服务器上。

Shell
# 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
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
}'
Python
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)
Node.js
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 的值必须是当前已公布并注册用于推理的准确标识符。如果目录中没有已公布的标识符,请先查看提供商目录,再发送请求。

字段类型必填限制
modelstring是最多 160 个字符;请使用准确的已公布标识符。
messagesarray是包含 1 至 100 条消息,并按顺序发送。
messages[].rolestring是system、user 或 assistant。
messages[].contentstring是每条消息最多 100,000 个字符。
temperaturenumber否范围为 0 至 2。
max_tokensinteger否范围为 1 至 100,000;模型可能设有更低上限。

成功响应

成功的 JSON 响应包含 id、object(chat.completion)、created、model 和 choices。每个 choice 包含 index、一条 assistant 消息和 finish_reason。响应还可能返回 token 用量。

示例 · JSON
{
    "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
    }
}
字段类型含义
idstring唯一的 completion 标识符。
objectstring响应类型:chat.completion。
createdinteger以 Unix 时间戳表示的创建时间。
modelstring用于生成 completion 的模型标识符。
choicesarray生成结果选项,包含 assistant 消息和结束原因。
usageobject提供时返回 token 数量统计。

限流与错误

实时客户订阅不会按配额限制请求次数或 token 用量;沙盒密钥受其已公布的月度额度限制。模型上下文窗口、输出限制和临时流量控制仍然适用。Chat Completions 提供同步文本;Claude Messages 会保留所支持的原生内容块、工具和 SSE。发送请求前,请查阅各操作独立的 schema。

chat 操作将验证错误和提供商故障放在 error 对象中返回。身份验证和权限范围中间件也可能改为返回顶层 message 字段;具体状态码和响应结构取决于拒绝请求的层级。

HTTP 状态码含义
200已成功生成 completion。
400请求体或参数无效。
401缺少 bearer API 密钥或密钥无效。
403缺少所需密钥权限范围或账户访问权限。
429触发应用限流或临时上游流量控制;请采用退避策略重试。
500服务无法返回可用的 completion。
下载 OpenAPI JSON
{
    "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"
                        }
                    }
                }
            }
        }
    }
}