Guide
Tool calling
Let the model request functions while your application remains in control of execution.
On this page
Declare available functions
cURL
curl https://code.verboo.ai/router/v1/chat/completions \
-H "Authorization: Bearer $VERBOO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "<MODEL_ID>",
"messages": [{"role": "user", "content": "Weather in São Paulo?"}],
"tools": [{"type": "function", "function": {
"name": "get_weather",
"description": "Get current weather",
"parameters": {"type": "object", "properties": {
"city": {"type": "string"}
}, "required": ["city"]}
}}]
}'The model does not execute the function
Validate the name and arguments, apply authorization, and execute the function in your backend. Never treat arguments as trusted.
Complete the loop
- Read message.tool_calls from the response.
- Validate arguments JSON against your schema.
- Execute each function with explicit permissions and a timeout.
- Append the assistant message and a tool message with the same tool_call_id.
- Make another request so the model can produce the final answer.