curl --request POST \
--url https://api.caprioletech.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai-latest",
"messages": [
{
"role": "user",
"content": "Hello World!"
}
]
}
'{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{}
],
"usage": {}
}端点
Chat completions
通过 Capriole AI 模型创建 OpenAI 兼容的 Chat Completions。
POST
/
v1
/
chat
/
completions
curl --request POST \
--url https://api.caprioletech.com/v1/chat/completions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "openai-latest",
"messages": [
{
"role": "user",
"content": "Hello World!"
}
]
}
'{
"id": "<string>",
"object": "chat.completion",
"created": 123,
"model": "<string>",
"choices": [
{}
],
"usage": {}
}当应用、SDK 或网关需要 OpenAI Chat Completions 请求与响应格式时,请使用此端点。
发送包含
model 和 messages 的标准 Chat Completions 请求体。Capriole AI 会在转发给上游前,把 latest alias 解析为所选提供商的模型 ID;继续转发 messages、tools、tool_choice、response_format 和 stream 等兼容字段;并返回上游 JSON 或 SSE 流,以下 GLM SSE 修正除外。对于流式请求,Capriole AI 会在转发前设置 stream_options.include_usage=true,以便记录用量。
对于所配置的 Tian、RelayRouter 或 VE 网关提供的 model="zai/glm-5.3-flash" SSE 响应,Capriole AI 仅移除流式增量中空的旧式 function_call={"name":"","arguments":""} 字段。真实或尚未拼完的函数调用、tool_calls、文本和用量保持不变。此例外不影响非流式响应或其他模型。
POST /v1/chat/completions 接受 openai-latest、claude-latest、google-latest,以及 GET /v1/models 返回的公开具体模型 ID。使用 latest alias 可以让 Capriole AI 为对应提供商选择当前推荐的旗舰模型。
Latest alias 只是请求输入的快捷方式。用量按解析后的具体模型记录,响应体则保留所选兼容端点原有的模型命名方式。
Capriole 原生文本生成使用 POST /v1/chat。需要 OpenAI 兼容的传输格式时,请使用 POST /v1/chat/completions。授权
Use an API key created in the Capriole AI page. Send it as Authorization: Bearer sk-....
请求体
application/json
Public model identifier or latest alias returned by GET /v1/models
可用选项:
openai-latest, openai/gpt-6-astra, openai/gpt-5.6-terra, openai/gpt-5.6-luna, openai/gpt-5.5, openai/gpt-5.4-mini, claude-latest, anthropic/claude-fable-5-1, anthropic/claude-fable-5, anthropic/claude-opus-5, anthropic/claude-opus-4-8, anthropic/claude-opus-4-7, anthropic/claude-opus-4-6, anthropic/claude-sonnet-4-6, google-latest, google/gemini-3.1-pro-preview, google/gemini-3.8-flash, xai/grok-4.6, xai/grok-4.5, zai/glm-5.3-flash, zai/glm-5.2, moonshot/kimi-k3 OpenAI-compatible conversation messages.
Show child attributes
Show child attributes
OpenAI-compatible tool definitions.
OpenAI-compatible tool choice.
OpenAI-compatible response format.
Stream the response as OpenAI-compatible server-sent events.
OpenAI-compatible stream options. For streaming requests, Capriole AI sets include_usage=true before upstream dispatch for usage accounting.
最后修改于 2026年9月8日