Skip to main content
POST

Request body

string
required
Model ID to use. See available models.
array
required
Array of message objects with role and content.
  • role: "system", "user", or "assistant"
  • content: The message text
number
default:"1"
Sampling temperature (0-2). Lower = more focused, higher = more creative.
number
Maximum tokens to generate in the response.
boolean
default:"false"
Stream response tokens as server-sent events.
number
default:"1"
Nucleus sampling parameter (0-1).

Response

Status codes

402 is always about money or catalog access, never a problem on our side. error.type says which of the two it is, and insufficient_credits carries need_usd and have_usd. GET /v1/models publishes free_tier on every model, so a never-funded key can tell in advance which models it may call. Full bodies: Error Handling. When all routes for a model are exhausted, you get 503 with Retry-After and:
Retry the same request, or send it to another model — the catalog is at GET /v1/models. When the model rejects the request itself as invalid, for example a temperature outside the range it accepts, you get that status (400, 413 or 422) with code: request_rejected and no Retry-After. Retrying the same body fails the same way: change the request.