創建一次 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 鍵下。
