> ## Documentation Index
> Fetch the complete documentation index at: https://docs.radium.cloud/llms.txt
> Use this file to discover all available pages before exploring further.

# Tool calling

> Give models access to external functions

# Tool calling

Tool calling lets a model invoke external functions. The model generates structured JSON arguments, your code executes the function, and the result goes back into the conversation.

## How it works

1. Define tools as JSON schemas and pass them in the `tools` parameter.
2. The model may emit a `tool_calls` field instead of a text response.
3. Execute the function with the provided arguments.
4. Return the result as a `tool` message in the next request.

## Example

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.radium.cloud/v1/chat/completions \\
    -H "Authorization: Bearer $RADIUM_API_KEY" \\
    -H "Content-Type: application/json" \\
    -d '{
      "model": "clarke-1.0",
      "messages": [{"role": "user", "content": "What is the weather in Toronto?"}],
      "tools": [{
        "type": "function",
        "function": {
          "name": "get_weather",
          "description": "Get current weather",
          "parameters": {
            "type": "object",
            "properties": {"location": {"type": "string"}},
            "required": ["location"]
          }
        }
      }]
    }'
  ```

  ```python Python theme={null}
  from openai import OpenAI
  client = OpenAI(api_key="YOUR_RADIUM_API_KEY", base_url="https://api.radium.cloud/v1")
  response = client.chat.completions.create(
      model="clarke-1.0",
      messages=[{"role": "user", "content": "What is the weather in Toronto?"}],
      tools=[{
          "type": "function",
          "function": {
              "name": "get_weather",
              "description": "Get current weather",
              "parameters": {
                  "type": "object",
                  "properties": {"location": {"type": "string"}},
                  "required": ["location"]
              }
          }
      }],
  )
  print(response.choices[0].message.tool_calls)
  ```

  ```typescript TypeScript theme={null}
  import OpenAI from "openai";
  const client = new OpenAI({ apiKey: process.env.RADIUM_API_KEY, baseURL: "https://api.radium.cloud/v1" });
  const response = await client.chat.completions.create({
    model: "clarke-1.0",
    messages: [{ role: "user", content: "What is the weather in Toronto?" }],
    tools: [{
      type: "function",
      function: {
        name: "get_weather",
        description: "Get current weather",
        parameters: {
          type: "object",
          properties: { location: { type: "string" } },
          required: ["location"]
        }
      }
    }],
  });
  console.log(response.choices[0].message.tool_calls);
  ```
</CodeGroup>

## Anthropic format

The same flow works in the Messages API. Tool definitions and response shapes match the Anthropic schema.

## Model support matrix

| Capability | hal-1.0 | clarke-1.0 | tycho-1.0 |
| - | - | - | - |
| Single tool call | Pass | Pass | Pass |
| Multiple parallel calls | Pass | Pass | Pass |
| Multi-step tool loops | Pass | Pass | Limited |
| Streaming tool calls | Pass | Pass | Pass |
| Strict schema validation | Pass | Pass | Pass |

## Limitations

* Parallel tool calls are supported; the model chooses whether to call one or multiple tools
* For multi-step tool loops, inject the tool result back into the conversation as a `tool` message
* Some niche OpenAI tool features (e.g., `function_call: "none"` behavior) may have minor differences


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.