Developer

Chat completions

The core endpoint: send messages, get a completion.

POST/v1/chat/completions

Creates a model response for a conversation. Requires the chat:completions scope.

Do not send protected health information yet.A Business Associate Agreement (BAA) with Health Council must be signed before any protected health information reaches the API. Use synthetic or deidentified data until then.

Request body

Chat completion parameters
ParameterDescription
modelstringModel to use. It must be allowed for the key. Leave it out to use the default model.
messagesarrayRequiredThe conversation so far. Each message has a role (system, user, assistant, or tool), content as text or content parts, and an optional name.
temperaturenumberSampling temperature from 0 to 2.
max_tokensintegerMost tokens to generate, up to 4,096. The balance check before the request assumes this many output tokens.
streambooleanSend the answer as server sent events. See Streaming. Default false.
citationsobjectGround the answer in a knowledge base. See Citations.

Other OpenAI parameters, such as top_p and stop, are passed to the model unchanged.

Returns

A chat.completion object in the OpenAI shape, with usage when the model reports it. Grounded requests add a citations array when retrieval found sources, and a warnings array appears when optional retrieval could not run.

Errors

  • 400 invalid_request: the body failed validation, the model is not allowed, or max_tokens is above 4,096.
  • 402 payment_required: the balance is empty or cannot cover max_tokens.
  • 429 rate_limited: the key reached its per minute limit or monthly token cap.
  • 502 model_error and 504 model_timeout: the model did not answer; retry with backoff.