verboo code

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

  1. Read message.tool_calls from the response.
  2. Validate arguments JSON against your schema.
  3. Execute each function with explicit permissions and a timeout.
  4. Append the assistant message and a tool message with the same tool_call_id.
  5. Make another request so the model can produce the final answer.