Chat With Tool Calling
Header parameters
AuthorizationstringRequiredExample:
sk-lZxzBody
modelstringRequired
streambooleanRequired
Responses
200Success
application/json
costnumberRequired
idstringRequired
modelstringRequired
rolestringRequired
stop_reasonstringRequired
stop_sequencenullRequired
typestringRequired
post/v1/messages
POST /v1/messages HTTP/1.1
Host: llm.onerouter.pro
Authorization: text
Content-Type: application/json
Accept: */*
Content-Length: 616
{
"model": "anthropic/claude-opus-4.6",
"messages": [
{
"role": "user",
"content": "What is the weather like in San Francisco?"
}
],
"tools": [
{
"name": "get_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. San Francisco, CA"
},
"unit": {
"type": "string",
"enum": [
"celsius",
"fahrenheit"
],
"description": "The unit for temperature"
}
},
"required": [
"location"
]
}
}
],
"tool_choice": {
"type": "auto",
"disable_parallel_tool_use": false
},
"stream": false,
"stream_options": {
"include_usage": true
},
"usage": {
"include": true
}
}200Success
{
"content": [
{
"text": "\n\nLet me check the current weather in San Francisco for you.",
"type": "text"
},
{
"id": "toolu_bdrk_01H5eutNpNmrnGP16LxG3iJa",
"input": {
"location": "San Francisco, CA"
},
"name": "get_weather",
"type": "tool_use"
}
],
"cost": 0.00483,
"cost_details": {
"audio_cost": 0,
"byok_cost": 0,
"completion_cost": 0.00175,
"discount_rate": 1,
"image_cost": 0,
"is_byok": false,
"native_web_search_cost": 0,
"plugin_web_search_cost": 0,
"prompt_cache_read_cost": 0,
"prompt_cache_write_1_h": 0,
"prompt_cache_write_5_min": 0,
"prompt_cache_write_cost": 0,
"prompt_cost": 0.00308,
"reasoning_cost": 0,
"tools_cost": 0,
"video_cost": 0
},
"id": "msg_bdrk_01EykfxS7GNoxmB9NjeexTRt",
"model": "anthropic/claude-opus-4.6",
"role": "assistant",
"stop_reason": "tool_use",
"stop_sequence": null,
"type": "message",
"usage": {
"cache_creation": {
"ephemeral_1h_input_tokens": 0,
"ephemeral_5m_input_tokens": 0
},
"cache_creation_input_tokens": 0,
"cache_read_input_tokens": 0,
"input_tokens": 616,
"output_tokens": 70
}
}Last updated