# Herramientas

Function calling estándar de OpenAI: declara funciones, lee `tool_calls` y
devuelve el resultado con `role: "tool"`.

```bash
curl "$APIX_BASE/v1/chat/completions" \
  -H "Authorization: Bearer $APIX_KEY" \
  -H "content-type: application/json" \
  -d '{
    "model": "2/kimi-k3",
    "messages": [{"role": "user", "content": "¿Qué tiempo hace en Caracas?"}],
    "tools": [{
      "type": "function",
      "function": {
        "name": "get_weather",
        "description": "Tiempo actual",
        "parameters": {
          "type": "object",
          "properties": {"ciudad": {"type": "string"}},
          "required": ["ciudad"]
        }
      }
    }]
  }'
```

La respuesta trae `finish_reason: "tool_calls"` y:

```json
{
  "tool_calls": [{
    "id": "call_1",
    "type": "function",
    "function": {"name": "get_weather", "arguments": "{\"ciudad\":\"Caracas\"}"}
  }]
}
```

Devuelve el resultado y vuelve a preguntar:

```json
{"role": "tool", "tool_call_id": "call_1", "content": "{\"temp_c\":27}"}
```

`parallel_tool_calls: false` fuerza una llamada cada vez. En clientes de
Anthropic esto son bloques `tool_use` y `tool_result`; ApiX traduce en los dos
sentidos.
