Skip to main content
POST /v1/chat/completions accepts OpenAI-style messages. Provide a model ID and a non-empty messages array. Keep conversation history in your application and send the messages needed for each turn.

Request settings

Unsupported provider parameters can return 400. Passing a parameter through the gateway does not guarantee model support. See compatibility.

Read the result

choices[0].message.content contains text when the model returns text. A tool call can instead appear in choices[0].message.tool_calls. Inspect finish_reason. A response stopped at the output limit may be incomplete. Some models consume output capacity on reasoning before returning visible text; an empty text field does not necessarily imply zero usage. When reported, usage.prompt_tokens and usage.completion_tokens contain the provider’s token counts. Use Activity for the durable request record.

Continue the conversation

Append the assistant message and your next user message to the history, then make another request. Each request is independently metered and charged using its recorded token usage. Prior messages count toward the next request’s input. For streaming, follow the streaming guide.