创建一次 chat completion
OpenAI 兼容的 chat completions。支持:
- 流式(
stream: true,SSE) - 工具 / 函数调用(
tools、tool_choice) - 结构化输出(
response_format) - 多模态 —— 通过
content: [{type: "image_url", ...}]发送 图像(见下方ChatMessageContentPartschema)。https://URL 在所有支持视觉的模型上有效;OrcaRouter 的翻译层会为各 上游(OpenAI、Anthropic、Google、xAI Grok)适配内容片段。 - 通过
extra_body.models提供的 OrcaRouter 回退链。
使用带服务商前缀的模型名(openai/gpt-4o-mini、
anthropic/claude-sonnet-4.6、google/gemini-2.5-flash)、
裸名别名(当可用时),或命名路由器(orcarouter/auto)。
授权
OrcaRouter API 密钥形如 sk-orca-...。请在
Authorization: Bearer sk-orca-... 头中传入。
请求体
模型 ID。支持三种形式:
- 带服务商前缀(默认):
openai/gpt-4o-mini、anthropic/claude-sonnet-4.6、google/gemini-2.5-flash - 裸名别名:
gpt-4o-mini(当存在裸名别名时) - 命名路由器:
orcarouter/{name}(在请求时解析为模型;orcarouter/auto在每个账户注册时自动创建,挑选最便宜的在线 chat 模型)
"gpt-4o"
"openai/gpt-4o"
"orcarouter/auto"
为 true 时响应以 server-sent events 形式流式返回。
仅在 stream: true 时生效。
auto, none, required - Text (default)
- JSON mode
- JSON Schema
0 <= x <= 20 <= x <= 1x >= 1推理模型优先用此字段(而非 max_tokens)。
x >= 1用于确定性采样。
0 <= x <= 20-2 <= x <= 2-2 <= x <= 2供 OpenAI 推理模型使用(o1、o3*、o4*、gpt-5*-pro
等)。Anthropic Claude 改用 thinking 字段;Gemini 使用
服务商特定配置。
low, medium, high 在 Chat Completions 请求上启用联网搜索。Responses API
改用 tools: [{"type": "web_search"}]。OpenAI 搜索预览
模型、接受现代 web_search 工具的 OpenAI 模型,以及
Anthropic 模型(翻译为 Anthropic 原生 web_search
服务端工具)都会识别它。
当 web_search_options 不够表达时,可使用的自由形式原始
载荷,会被转发到上游的 web-search 工具。大多数用户应优先
使用 web_search_options。
OrcaRouter 特有的请求扩展。请放在 chat completion 请求
体的顶层 extra_body 键下。
