Clatter LabsHelp Center

How do I test tool calling with cURL?

How-toUpdated

Step 1: send the tools. The reply has finish_reason: "tool_calls" and a tool_calls array.

curl https://api.gateway.clatterlabs.xyz/v1/chat/completions \
  -H "Authorization: Bearer $CLATTER_API_KEY" \
  -H "X-Clatter-Account: $CLATTER_ACCOUNT_ID" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "supercosmos-max",
    "messages": [{"role": "user", "content": "What is the weather in Paris?"}],
    "tools": [{"type": "function", "function": {
      "name": "get_weather",
      "description": "Get the current weather for a city.",
      "parameters": {"type": "object", "properties": {"city": {"type": "string"}}, "required": ["city"]}
    }}]
  }'

Step 2: send the conversation again with the assistant message (including its tool_calls) and a {"role": "tool", "tool_call_id": "<id>", "content": "..."} message, and the model writes its final answer.

Set CLATTER_API_KEY (a clsk_ key with models:invoke) and CLATTER_ACCOUNT_ID (your CL- Account ID from Console › Settings) first. Reference: Model API reference.

Good to know#

  • Every response has an X-Request-Id; log it so a request can be found later. Why log it
  • If calls fail unexpectedly, check status.clatterlabs.com before debugging further.
  • Your key's account is responsible for your end users' text under the Abuse policy. What it means for apps

Still need help?#

We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Related articles

Still need help?

Tried the steps above and still stuck? Email us. We usually reply within the first hour, and always within 24 hours. A full support team is with you.

Infrastructure questions, or permanent deletion of your data
infrastructure@clatterlabs.xyz
For deleting your whole account or the data of one service.