Skip to main content
Declare tools in your request; the model returns tool_calls when needed, which you execute and feed back.
curl https://tokendog.io/v1/chat/completions \
  -H "Authorization: Bearer $TOKENDOG_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model":"gpt-5",
    "messages":[{"role":"user","content":"What is the weather in Beijing right now?"}],
    "tools":[{"type":"function","function":{
      "name":"get_weather",
      "description":"Get the current weather for a city",
      "parameters":{"type":"object","properties":{"city":{"type":"string"}},"required":["city"]}
    }}]
  }'
After the model returns tool_calls, run the function in your code, send the result back as a role: "tool" message, and the model produces the final answer.