Chat completions

POST /chat/completions. Messages in, one reply out. Set stream to true for server-sent events.

curl -X POST https://api.clod.io/v1/chat/completions \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "MODEL_NAME",
  "messages": [
    {
      "role": "user",
      "content": "Say hello."
    }
  ]
}'

Reasoning models return their thinking in message.reasoning_content, next to the normal content. When you stream, it arrives in delta.reasoning_content before the answer. In a multi-turn chat, send each assistant turn back with its reasoning_content so the model keeps its train of thought.

{
  "choices": [
    {
      "message": {
        "role": "assistant",
        "reasoning_content": "The user greets me, so I greet back.",
        "content": "Hello!"
      }
    }
  ]
}

Tools (function calling) and JSON mode work on the models that list them as capabilities. Asking for a feature a model does not support returns a clear 400 error.