chat

Create a chat completion

Changed on

Creates a model response for the given chat conversation. Supports both streaming and non-streaming responses. The model can be specified using provider prefixes (e.g., openai/gpt-4o) or with dynamic routing for multi-tenant configurations.

post/api/v1/chat/completions

Request

  • Base URL: / (relative, and the document was published on a file host, not at the API’s origin)
  • URL: /api/v1/chat/completions
  • Auth: HTTP bearer

Request body

frequency_penaltynumber double nullable

Penalize repeated tokens (-2.0 to 2.0)

logit_biasobject

Token bias map

logprobsboolean nullable

Return log probabilities

max_completion_tokensinteger nullable

Maximum completion tokens

max_tokensinteger nullable

Maximum tokens (deprecated, use max_completion_tokens)

metadataobject

Request metadata

modelstring nullable

Model to use for completion

modelsstring[] nullable

Hadrian Extension: List of models for multi-model routing (alternative to single model)

presence_penaltynumber double nullable

Penalize new topics (-2.0 to 2.0)

seedinteger nullable

Random seed for reproducibility

streamboolean

Enable streaming

temperaturenumber double nullable

Sampling temperature (0.0 to 2.0)

top_logprobsinteger nullable

Number of top log probabilities to return (0-20)

top_pnumber double nullable

Nucleus sampling probability (0.0 to 1.0)

userstring nullable

User identifier for abuse detection

Response

Chat completion response (streaming returns SSE events)

Changes

    • info

      added the new max enum value to the request property /////////

    • info

      added the new xhigh enum value to the request property /////////

    • info

      added the new optional request property