Create a chat completion
Request a chat completion. Supports tools and tool_choice for function calling, and reasoning_effort for reasoning models. Body follows ChatCompletionsRequest.
Body
Request body for chat completions endpoint describing conversation and generation parameters.
List of messages (role + content) forming the chat history. Required.
Sampling temperature; higher values increase randomness.
Nucleus sampling cumulative probability threshold.
Keep only the top_k tokens by probability at each generation step.
Maximum number of tokens the model may generate for the completion.
If true, the server may stream partial responses as they are generated.
Penalty applied based on frequency of tokens to reduce repetition.
Penalty applied to discourage new token presence (encourages topic shifting).
Mapping from token id (string or int) to a bias value added to the token logits.
If true, include logprob information in the response.
Return the top N token logprobs at each position if logprobs enabled.
Stop sequence or list of sequences where generation should halt.
Optional random seed for reproducibility.
Optional list of tool/function definitions that the model may call.
Controls which tool the model calls: auto, none, required, or a specific function.
auto, none, required Constrains reasoning depth for supported reasoning models. Higher values generally increase quality and latency.
none, minimal, low, medium, high, xhigh Response
Chat completion response
Response schema for the chat completions endpoint.
Unique identifier for this chat completion.
Type of the returned object; defaults to 'chat.completion'.
Unix timestamp (seconds) of creation.
Model identifier used to generate the chat response.
List of chat choices returned by the model.
Token usage details for the chat completion.

