Completion

Send a completion request to a selected model (text-only format)

Headers

AuthorizationstringRequired

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
modelstringRequired
The model ID to use. If unspecified, the user's default is used.
promptstringRequired
The text prompt to complete
modelslist of stringsOptional
Alternate list of models for routing overrides.
providerobjectOptional
Preferences for provider routing.
reasoningobjectOptional

Configuration for model reasoning/thinking tokens

usageobjectOptional
Whether to include usage information in the response
transformslist of stringsOptional

List of prompt transforms (OpenRouter-only).

streambooleanOptionalDefaults to false
Enable streaming of results.
max_tokensintegerOptional

Maximum number of tokens (range: [1, context_length)).

temperaturedoubleOptional

Sampling temperature (range: [0, 2]).

seedintegerOptional
Seed for deterministic outputs.
top_pdoubleOptional

Top-p sampling value (range: (0, 1]).

top_kintegerOptional

Top-k sampling value (range: [1, Infinity)).

frequency_penaltydoubleOptional

Frequency penalty (range: [-2, 2]).

presence_penaltydoubleOptional

Presence penalty (range: [-2, 2]).

repetition_penaltydoubleOptional

Repetition penalty (range: (0, 2]).

logit_biasmap from strings to doublesOptional
Mapping of token IDs to bias values.
top_logprobsintegerOptional
Number of top log probabilities to return.
min_pdoubleOptional

Minimum probability threshold (range: [0, 1]).

top_adoubleOptional

Alternate top sampling parameter (range: [0, 1]).

userstringOptional

A stable identifier for your end-users. Used to help detect and prevent abuse.

Response

Successful completion
idstringOptional
choiceslist of objectsOptional