Completions

Legacy text completions endpoint.

Prefer Chat Completions for new development. This endpoint exists for compatibility with older clients that send a single prompt string.

Endpoint

POST /api/v1/completions

Request

{
  "model": "provider/model",
  "prompt": "Write a tagline for an AI router.",
  "max_tokens": 64,
  "temperature": 0.7
}

Response

{
  "id": "cmpl_...",
  "object": "text_completion",
  "created": 1710000000,
  "model": "provider/model",
  "choices": [
    { "text": "One API. Any model. Always on.", "index": 0, "finish_reason": "stop" }
  ],
  "usage": { "prompt_tokens": 10, "completion_tokens": 9, "total_tokens": 19 }
}