POST / API reference
Tool Calling
Allow a model to request the execution of functions defined by your application.
POST
/v1/chat/completionshttps://api.aonis.space/v1/chat/completionsSupported
Request example
{
"model": "claude-sonnet-5",
"messages": [{
"role": "user",
"content": "What is the weather in São Paulo? Use the get_weather tool."
}],
"tools": [{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get the current weather for a city",
"parameters": {
"type": "object",
"properties": { "city": { "type": "string", "description": "City name" } },
"required": ["city"]
}
}
}],
"tool_choice": { "type": "function", "function": { "name": "get_weather" } }
}Tool response
A tool request is returned as an assistant message with tool calls.
{
"role": "assistant",
"content": null,
"tool_calls": [{
"id": "call_...",
"type": "function",
"function": { "name": "get_weather", "arguments": "{\"city\":\"São Paulo\"}" }
}]
}