stream: true ๆถ๏ผๆฅๅฃไผไปฅ SSE ็ๅฝขๅผ่ฟๅ็ปๆใClaude ็ๅฝๆฐ่ฐ็จไผ้่ฟ tool_use ๅ
ๅฎนๅๅ input_json_delta ๅข้็ๆฎต่ฟ่กๆตๅผ่พๅบใtext/event-streammessage_startใcontent_block_startใcontent_block_deltaใmessage_delta ๅ message_stoptool_use ๅ
ๅฎนๅ็ๅฝขๅผ่ฟๅstop_reason ้ๅธธไธบ tool_usemessages ่ฟ่กๆ ๅๅฏน่ฏใtools ๅ input_schema ่ฟ่กๅฝๆฐ่ฐ็จใmodel ๅญๆฎตไธญไผ ๅ
ฅๅฝๅๆจกๅๅ็งฐใmessages ไผ ้ๅฏน่ฏไธไธๆใtools ๅฃฐๆๅฏ่ฐ็จๅฝๆฐใstream: true ๅฏ่ทๅพ SSE ๆตๅผ่ฟๅใX-Api-Key ๅ anthropic-version๏ผไธไฝไธบๆฎ้่ฏทๆฑๅๆฐๅกซๅใcurl --location 'https://api.emix.ai/claude/v1/messages' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"model": "claude-opus-5",
"messages": [
{
"role": "user",
"content": "What is the weather like in Boston today?"
}
],
"tools": [
{
"name": "get_current_weather",
"description": "Get the current weather in a given location",
"input_schema": {
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and state, e.g. Boston, MA"
}
},
"required": [
"location"
]
}
}
],
"thinkingFlag": true,
"stream": false,
"max_tokens": 4096
}'{
"role": "assistant",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"output_tokens": 57,
"service_tier": "standard",
"cache_creation_input_tokens": 0,
"input_tokens": 600,
"cache_read_input_tokens": 0,
"inference_geo": "not_available"
},
"stop_reason": "tool_use",
"model": "claude-opus-5-20251101",
"id": "msg_01VSoxV4a8YWB3DBh9TdM63W",
"credits_consumed": 0.25,
"type": "message",
"content": [
{
"input": {
"location": "Beijing, China"
},
"caller": {
"type": "direct"
},
"name": "get_current_weather",
"id": "toolu_018gdqs2FHxrRjQHLZv1qvbF",
"type": "tool_use"
}
]
}