Chat (text)

Conversation completions, with or without streaming, with or without tools.

Request

http
POST /v1/chat/completions
json
{
  "messages": [
    { "role": "user", "content": "Explique le routage IA en une phrase." }
  ],
  "model": null,
  "routing_strategy": "auto",
  "max_tokens": null,
  "temperature": null,
  "stream": false,
  "tools": null,
  "tool_choice": null
}

Only messages is required. model and routing_strategy are documented in Routing & fallback.

Response

json
{
  "content": "Le routage IA choisit automatiquement le meilleur fournisseur disponible pour chaque appel.",
  "finish_reason": "stop",
  "model": "claude-opus-5",
  "provider": "anthropic",
  "input_tokens": 12,
  "output_tokens": 18,
  "tool_calls": null
}

Streaming

Pass "stream": true to receive the response in Server-Sent Events format instead of a single JSON blob.

typescript
for await (const chunk of client.chat.completions.stream({
  messages: [{ role: "user", content: "Compte jusqu'a 10." }],
})) {
  process.stdout.write(chunk.delta);
}

Tool calling (function calling)

Provide tools (definitions in standard JSON Schema format) and the model may respond with tool_calls instead of (or in addition to) text. Return the result in a message with role "tool" and the matching tool_call_id to continue the conversation.

json
{
  "messages": [
    { "role": "user", "content": "Quel temps fait-il a Paris ?" },
    {
      "role": "assistant",
      "content": "",
      "tool_calls": [
        { "id": "call_1", "name": "get_weather", "arguments": { "city": "Paris" } }
      ]
    },
    { "role": "tool", "tool_call_id": "call_1", "content": "18C, nuageux" }
  ],
  "tools": [
    {
      "name": "get_weather",
      "description": "Meteo actuelle d'une ville.",
      "parameters": {
        "type": "object",
        "properties": { "city": { "type": "string" } },
        "required": ["city"]
      }
    }
  ]
}
For automated multi-turn orchestration (the server re-invokes the model after each tool result, keeps long-term memory), see the AI Agents guide rather than managing the loop yourself.

Compatible models

Anthropic (Claude), OpenAI (GPT), Google (Gemini), DeepSeek, xAI (Grok), Mistral, Moonshot, MiniMax, Meta — the exact, up-to-date list is available via the catalog:

bash
GET /v1/models?category=text