Chat completion
Send a chat completion request to a selected model. The request must contain a "messages" array. All advanced options from the base request are also supported.
Headers
Authorization
Bearer authentication of the form Bearer <token>, where token is your auth token.
Request
This endpoint expects an object.
model
The model ID to use. If unspecified, the user's default is used.
messages
models
Alternate list of models for routing overrides.
provider
Preferences for provider routing.
reasoning
Configuration for model reasoning/thinking tokens
usage
Whether to include usage information in the response
transforms
List of prompt transforms (OpenRouter-only).
stream
Enable streaming of results.
max_tokens
Maximum number of tokens (range: [1, context_length)).
temperature
Sampling temperature (range: [0, 2]).
seed
Seed for deterministic outputs.
top_p
Top-p sampling value (range: (0, 1]).
top_k
Top-k sampling value (range: [1, Infinity)).
frequency_penalty
Frequency penalty (range: [-2, 2]).
presence_penalty
Presence penalty (range: [-2, 2]).
repetition_penalty
Repetition penalty (range: (0, 2]).
logit_bias
Mapping of token IDs to bias values.
top_logprobs
Number of top log probabilities to return.
min_p
Minimum probability threshold (range: [0, 1]).
top_a
Alternate top sampling parameter (range: [0, 1]).
user
A stable identifier for your end-users. Used to help detect and prevent abuse.
Response
Successful completion
id
choices