Parameters & Schema

Every request field with types, defaults and constraints.

The request body follows the OpenAI Chat Completions schema. Unknown fields are passed through to the model when supported.

Core

modelstringrequired

Model ID such as anthropic/claude-3.5-sonnet.

messagesarrayrequired

The conversation so far.

roleenumrequired

system, user, assistant or tool.

contentstring | arrayrequired

Text, or an array of text and image_url parts for vision models.

tool_call_idstringoptional

Required when role is tool.

streambooleanoptionaldefault: false

Stream tokens as server-sent events. See Streaming.

temperaturenumberoptionaldefault: 1

0–2. Higher values give more random output.

max_tokensintegeroptionaldefault: model max

Maximum tokens to generate in the reply.

Sampling

top_pnumberoptionaldefault: 1

0–1. Nucleus sampling; change this or temperature, not both.

frequency_penaltynumberoptionaldefault: 0

-2–2. Penalises repeated tokens.

presence_penaltynumberoptionaldefault: 0

-2–2. Encourages new topics.

stopstring | string[]optionaldefault: null

Up to 4 sequences where generation stops.

seedintegeroptionaldefault: null

Best-effort deterministic sampling.

nintegeroptionaldefault: 1

Number of choices to generate. You're billed for all of them.

Tools

toolsarrayoptionaldefault: null

Functions the model may call.

typestringrequired

Always function.

function.namestringrequired

Function name.

function.descriptionstringoptional

What the function does.

function.parametersJSON Schemaoptional

Arguments the function accepts.

tool_choicestring | objectoptionaldefault: auto

none, auto, required, or a specific function.

Output format

response_formatobjectoptionaldefault: {"type":"text"}

{"type":"json_object"} for JSON mode, or json_schema with a schema for structured outputs.

Example: JSON mode
{
  "model": "openai/gpt-4o-mini",
  "response_format": { "type": "json_object" },
  "messages": [
    { "role": "system", "content": "Reply in JSON." },
    { "role": "user", "content": "List 3 primary colours." }
  ]
}
Not every model supports every field. Tools and JSON mode work on most OpenAI, Anthropic, Google and Mistral models.