跳轉到主要內容
POST
/
messages
創建一條消息
curl --request POST \
  --url https://api.orcarouter.ai/v1/messages \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "model": "anthropic/claude-sonnet-4.6",
  "messages": [
    {
      "content": "<string>"
    }
  ],
  "max_tokens": 123,
  "system": "<string>",
  "stop_sequences": [
    "<string>"
  ],
  "stream": true,
  "temperature": 123,
  "top_p": 123,
  "top_k": 123,
  "tools": [
    {}
  ],
  "tool_choice": {},
  "thinking": {
    "budget_tokens": 123
  },
  "mcp_servers": "<unknown>",
  "metadata": {}
}
'
{
  "id": "<string>",
  "content": [
    {
      "text": "<string>"
    }
  ],
  "model": "<string>",
  "stop_sequence": "<string>",
  "usage": {
    "input_tokens": 123,
    "output_tokens": 123,
    "cache_creation_input_tokens": 123,
    "cache_read_input_tokens": 123,
    "server_tool_use": {}
  }
}

授權

Authorization
string
header
必填

OrcaRouter API 密鑰形如 sk-orca-...。請在 Authorization: Bearer sk-orca-... 頭中傳入。

主體

application/json
model
string
必填
範例:

"anthropic/claude-sonnet-4.6"

messages
object[]
必填
max_tokens
integer
必填
system
stop_sequences
string[]
stream
boolean
temperature
number
top_p
number
top_k
integer
tools
object[]
tool_choice
object
thinking
object

Anthropic extended thinking。在支持 thinking 的 Claude 4 / Claude Opus 模型上設置。模型會在最終回答之前發出一段 隱藏的推理過程。

mcp_servers
any

自由形式的 MCP server 配置,原樣轉發到 Anthropic。

metadata
object

回應

200 - application/json

OK

id
string
type
enum<string>
可用選項:
message
role
enum<string>
可用選項:
assistant
content
object[]
model
string
stop_reason
enum<string>
可用選項:
end_turn,
max_tokens,
stop_sequence,
tool_use
stop_sequence
string | null
usage
object