Request Headers

authorizationstring*required

The authorization token (required).

Request Path

idstring*required

The unique identifier of the completion to retrieve

Response Body

requestobject*required

The original request body

Properties
messagesarray*required

A list of messages comprising the conversation so far. Depending on the model you use, different message types (modalities) are supported, like text, images, and audio.

Items
Developer Messageobject
Properties
role"developer"*required
contentenum*required
Variants
Text Contentstring
Array Contentarray
Items
Text Content Partobject
Properties
type"text"*required
textstring*required
namestringoptional
System Messageobject
Properties
role"system"*required
contentenum*required
Variants
Text Contentstring
Array Contentarray
Items
Text Content Partobject
Properties
type"text"*required
textstring*required
namestringoptional
User Messageobject
Properties
role"user"*required
contentenum*required
Variants
Text Contentstring
Array Contentarray
Items
Text Content Partobject
Properties
type"text"*required
textstring*required
Image Content Partobject
Properties
type"image_url"*required
image_urlobject*required
Properties
urlstring*required
detailenumoptional
Variants
Auto"auto"
Low"low"
High"high"
Audio Content Partobject
Properties
type"audio_url"*required
input_audioobject*required
Properties
datastring*required
formatenum*required
Variants
WAV"wav"
MP3"mp3"
File Content Partobject
Properties
type"file"*required
fileobject*required
Properties
file_datastringoptional
file_idstringoptional
filenamestringoptional
namestringoptional
Assistant Messageobject
Properties
role"assistant"*required
contentenum*required
Variants
Text Contentstring
Array Contentarray
Items
Text Content Partobject
Properties
type"text"*required
textstring*required
Refusal Content Partobject
Properties
type"refusal"*required
refusalstring*required
namestringoptional
refusalstringoptional
tool_callsarrayoptional
Items
Tool Callobject
Properties
idstring*required
functionobject*required
Properties
namestring*required
argumentsstring*required
type"function"*required
Tool Messageobject
Properties
role"tool"*required
contentenum*required
Variants
Text Contentstring
Array Contentarray
Items
Text Content Partobject
Properties
type"text"*required
textstring*required
tool_call_idstring*required
modelstring*required

Model ID used to generate the response.

frequency_penaltynumbermin: -2max: 2optional

This setting aims to control the repetition of tokens based on how often they appear in the input. It tries to use less frequently those tokens that appear more in the input, proportional to how frequently they occur. Token penalty scales with the number of occurrences. Negative values will encourage token reuse.

logit_biasmap<string, number>optional

Accepts a JSON object that maps tokens (specified by their token ID in the tokenizer) to an associated bias value from -100 to 100. Mathematically, the bias is added to the logits generated by the model prior to sampling. The exact effect will vary per model, but values between -1 and 1 should decrease or increase likelihood of selection; values like -100 or 100 should result in a ban or exclusive selection of the relevant token.

logprobsbooleanoptional

Whether to return log probabilities of the output tokens or not. If true, returns the log probabilities of each output token returned.

max_completion_tokensnumbermin: 1optional

An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens.

modalitiesarrayoptional

Output types that you would like the model to generate. Most models are capable of generating text, which is the default.

Items
Modalitystring

The type of item to generate.

nnumbermin: 1optional

How many chat completion choices to generate for each input message.

parallel_tool_callsbooleanoptional

Whether to enable parallel tool calling during tool use.

predictionstringoptional

The predicted output from the model.

presence_penaltynumbermin: -2max: 2optional

This setting aims to control the presence of tokens in the output. It tries to encourage the model to use tokens that are less present in the input, proportional to their presence in the input. Token presence scales with the number of occurrences. Negative values will encourage more diverse token usage.

reasoning_effortenumoptional

Constrains effort on reasoning for some reasoning models.

Variants
Low"low"
Medium"medium"
High"high"
response_formatenumoptional

An object specifying the format that the model must output.

Variants
Text Response Formatobject

Responses will have no specific format.

Properties
type"text"*required
JSON Object Response Formatobject

Responses will be JSON Objects.

Properties
type"json_object"*required
JSON Schema Response Formatobject

Responses will adhere to the provided JSON Schema.

Properties
type"json_schema"*required
json_schemaobject*required
Properties
namestring*required
descriptionstringoptional
strictbooleanoptional

Whether to strictly enforce the schema. If true, the model will only output properties defined in the schema. If false, the model may output additional properties.

schemajson_valueoptional

The JSON Schema object defining the expected structure.

seednumberoptional

If specified, the inferencing will sample deterministically, such that repeated requests with the same seed and parameters should return the same result. Determinism is not guaranteed for some models.

service_tierenumoptional

Specifies the processing type used for serving the request.

Variants
Auto"auto"
Default"default"
Flex"flex"
stopenumoptional

Stop generation immediately if the model encounters any token specified in the stop array.

Variants
Stop Stringstring
Stop Arrayarray
Items
Stop Stringstring
streambooleanoptional

If set to true, the model response data will be streamed to the client as it is generated using server-sent events.

stream_optionsobjectoptional

Options for streaming response.

Properties
include_usagebooleanoptional

If set, an additional chunk will be streamed before the data: [DONE] message. The usage field on this chunk shows the token usage statistics for the entire request, as well as the cost, if requested.

temperaturenumbermin: 0max: 2optional

This setting influences the variety in the model’s responses. Lower values lead to more predictable and typical responses, while higher values encourage more diverse and less common responses. At 0, the model always gives the same response for a given input.

tool_choiceenumoptional

Controls which (if any) tool is called by the model.

Variants
None"none"

The model will not call any tools.

Auto"auto"

The model may choose to call a tool if it deems it necessary.

Required"required"

The model must call a tool.

Functionobject

The model must call the specified function.

Properties
type"function"*required
functionobject*required
Properties
namestring*required
toolsarrayoptional

A list of tools the model may call.

Items
Toolobject
Properties
type"function"*required
functionobject*required
Properties
namestring*required
descriptionstringoptional
parametersjson_valueoptional

The JSON Schema object defining the expected structure.

strictbooleanoptional

Whether to strictly enforce the schema. If true, the model will only output properties defined in the schema. If false, the model may output additional properties.

top_logprobsnumbermin: 0max: 20optional

An integer between 0 and 20 specifying the number of most likely tokens to return at each token position, each with an associated log probability.

top_pnumbermin: 0max: 1optional

This setting limits the model’s choices to a percentage of likely tokens: only the top tokens whose probabilities add up to P. A lower value makes the model’s responses more predictable, while the default setting allows for a full range of token choices. Think of it like a dynamic Top-K.

web_search_optionsobjectoptional

This tool searches the web for relevant results to use in a response.

Properties
search_context_sizeenumoptional
Variants
Low"low"
Medium"medium"
High"high"
user_locationobjectoptional
Properties
type"approximate"*required
approximateobject*required
Properties
citystringoptional
countrystringoptional
regionstringoptional
timezonestringoptional
max_tokensnumbermin: 1optional

This sets the upper limit for the number of tokens the model can generate in response. It won’t produce more than this limit. The maximum value is the context length minus the prompt length.

min_pnumbermin: 0max: 1optional

Represents the minimum probability for a token to be considered, relative to the probability of the most likely token. (The value changes depending on the confidence level of the most probable token.) If your Min-P is set to 0.1, that means it will only allow for tokens that are at least 1/10th as probable as the best possible option.

pluginsarrayoptional

OpenRouter plugins.

Items
Pluginobject

May include additional fields as needed.

Properties
idstring*required
providerobjectoptional

OpenRouter provider preferences.

Properties
orderarrayoptional

List of provider slugs to try in order.

Items
Provider Slugstring
allow_fallbacksbooleanoptional

Whether to allow backup providers when the primary is unavailable.

require_parametersbooleanoptional

Only use providers that support all parameters in your request.

data_collectionenumoptional

Control whether to use providers that may store data.

Variants
Allow"allow"
Deny"deny"
onlyarrayoptional

List of provider slugs to allow for this request.

Items
Provider Slugstring
ignorearrayoptional

List of provider slugs to skip for this request.

Items
Provider Slugstring
quantizationsarrayoptional

List of quantization levels to filter by.

Items
Quantization Levelstring
sortstringoptional

Sort providers by price or throughput.

reasoningobjectoptional

OpenRouter reasoning configuration.

Properties
max_tokensnumbermin: 1optional

An upper bound for the number of tokens that can be generated for reasoning.

effortenumoptional

Constrains effort on reasoning for some reasoning models.

Variants
Low"low"
Medium"medium"
High"high"
enabledbooleanoptional

Whether reasoning is enabled for this request.

repetition_penaltynumbermin: 0max: 2optional

Helps to reduce the repetition of tokens from the input. A higher value makes the model less likely to repeat tokens, but too high a value can make the output less coherent (often with run-on sentences that lack small words). Token penalty scales based on original token’s probability.

top_anumbermin: 0max: 1optional

Consider only the top tokens with “sufficiently high” probabilities based on the probability of the most likely token. Think of it like a dynamic Top-P. A lower Top-A value focuses the choices based on the highest probability token but with a narrower scope. A higher Top-A value does not necessarily affect the creativity of the output, but rather refines the filtering process based on the maximum probability.

top_knumbermin: 1optional

This limits the model’s choice of tokens at each step, making it choose from a smaller set. A value of 1 means the model will always pick the most likely next token, leading to predictable results. By default this setting is disabled, making the model to consider all choices.

usageobjectoptional

OpenRouter accounting configuration.

Properties
includebooleanoptional

Whether to include Cost in the response usage.

verbosityenumoptional

Controls the verbosity and length of the model response. Lower values produce more concise responses, while higher values produce more detailed and comprehensive responses.

Variants
Low"low"
Medium"medium"
High"high"
modelsarrayoptional

Fallback models. Will be tried in order if the first one fails.

Items
Model IDstring
responseobject*required

The completion response

Properties
idstring*required

A unique identifier for the chat completion.

choicesarray*required

An array of choices returned by the model.

Items
Choiceobject

An object representing a single choice in the chat completion.

Properties
messageobject*required

The message generated by the model for this choice.

Properties
contentstringoptional

The content of the message generated by the model.

refusalstringoptional

The refusal information if the model refused to generate a message.

role"assistant"*required

The role of the message, which is always assistant for model-generated messages.

annotationsarrayoptional

The annotations added by the model in this message.

Items
Annotationobject
Properties
type"url_citation"*required
url_citationobject*required
Properties
end_indexnumber*required

The end index of the citation in the message content.

start_indexnumber*required

The start index of the citation in the message content.

titlestring*required

The title of the cited webpage.

urlstring*required

The URL of the cited webpage.

audioobjectoptional

The audio generated by the model in this message.

Properties
idstring*required
datastring*required
expires_atnumber*required
transcriptstring*required
tool_callsarrayoptional

The tool calls made by the model in this delta.

Items
idstring*required

The tool call ID.

type"function"*required
functionobject*required
Properties
namestring*required

The name of the function being called.

argumentsstring*required

The arguments passed to the function.

reasoningstringoptional

The reasoning text generated by the model in this message.

imagesarrayoptional

The images generated by the model in this message.

Items
Imageobject
Properties
type"image_url"*required
image_urlobject*required
Properties
urlstring*required
finish_reasonenum*required

The reason why the model finished generating the response.

Variants
Stop"stop"

The model finished generating because it reached a natural stopping point.

Length"length"

The model finished generating because it reached the maximum token limit.

ToolCalls"tool_calls"

The model finished generating because it made one or more tool calls.

ContentFilter"content_filter"

The model finished generating because it triggered a content filter.

Error"error"

The model finished generating because an error occurred.

indexnumber*required

The index of the choice in the list of choices.

logprobsobjectoptional

The log probabilities of the tokens in the delta.

Properties
contentarrayoptional

An array of log probabilities for each token in the content.

Items
Logprobobject
Properties
tokenstring*required

The token text.

bytesarrayoptional

The byte representation of the token.

Items
Bytenumber

A byte in the token's byte representation.

logprobnumber*required

The log probability of the token.

top_logprobsarray*required
Items
Top Logprobobject
Properties
tokenstring*required

The token text.

bytesarrayoptional

The byte representation of the token.

Items
Bytenumber

A byte in the token's byte representation.

logprobnumberoptional

The log probability of the token.

refusalarrayoptional

An array of log probabilities for each token in the refusal.

Items
Logprobobject
Properties
tokenstring*required

The token text.

bytesarrayoptional

The byte representation of the token.

Items
Bytenumber

A byte in the token's byte representation.

logprobnumber*required

The log probability of the token.

top_logprobsarray*required
Items
Top Logprobobject
Properties
tokenstring*required

The token text.

bytesarrayoptional

The byte representation of the token.

Items
Bytenumber

A byte in the token's byte representation.

logprobnumberoptional

The log probability of the token.

creatednumber*required

The Unix timestamp (in seconds) when the chat completion was created.

modelstring*required

The model used for the chat completion.

object"chat.completion"*required
service_tierenumoptional

The service tier used for the chat completion.

Variants
Auto"auto"
Default"default"
Flex"flex"
system_fingerprintstringoptional

A fingerprint representing the system configuration used for the chat completion.

usageobjectoptional

An object containing token usage statistics for the chat completion.

Properties
completion_tokensnumber*required

The number of tokens generated in the completion.

prompt_tokensnumber*required

The number of tokens in the input prompt.

total_tokensnumber*required

The total number of tokens used (prompt + completion).

completion_tokens_detailsobjectoptional
Properties
accepted_prediction_tokensnumberoptional
rejected_prediction_tokensnumberoptional
audio_tokensnumberoptional

The number of audio tokens generated.

reasoning_tokensnumberoptional

The number of reasoning tokens generated.

prompt_tokens_detailsobjectoptional
Properties
audio_tokensnumberoptional

The number of audio tokens in the input prompt.

cached_tokensnumberoptional

The number of cached tokens in the input prompt.

costnumberoptional

The cost incurred for this chat completion, in Credits.

cost_detailsobjectoptional
Properties
upstream_inference_costnumberoptional

The cost charged by the upstream LLM provider, in Credits.

upstream_upstream_inference_costnumberoptional

The cost charged by the upstream LLM provider's own upstream LLM provider, in Credits.

providerstringoptional

The upstream (or upstream upstream) LLM provider used for the chat completion.

Objective Artificial Intelligence, Inc.