Skip to content
API Reference

Parameters

Sampling parameters shape the token generation process of the model. You may send any parameters from the following list to the SIRAYA Model Router API.

SIRAYA Model Router will default to standard values if certain parameters are absent (e.g., temperature defaults to 1.0). Backend-specific parameters should be passed via extra_body. A top-level field the router does not recognise is either dropped or forwarded unchanged to the backend, depending on the model, and a forwarded field the model does not accept can return an error.

Not every model honours every parameter below. See Parameter Support by Model and Per-Model Details for what takes effect on each model family, and the Available Models section for individual models.

Core Parameters

Temperature

  • Key: temperature
  • Type: Float (0.0 to 2.0)
  • Default: 1.0

Influences the variety in the model's responses. Lower values lead to more predictable responses, while higher values encourage diversity. At 0, the model becomes deterministic (same response for same input).

Top P

  • Key: top_p
  • Type: Float (0.0 to 1.0)
  • Default: 1.0

Limits the model's choices to a percentage of likely tokens (Nucleus sampling). Only the top tokens whose cumulative probability adds up to P are considered.

N

  • Key: n
  • Type: Integer (1 or above)
  • Default: 1

Number of chat completion choices to generate for each input message. Supported on GPT and Gemini models; Claude and most other families return a single choice.

Max Tokens

  • Key: max_tokens
  • Type: Integer (1 or above)

Sets the upper limit for the number of tokens the model can generate. Deprecated — use max_completion_tokens instead. GPT-5 and Codex models need a value of at least 16.

Max Completion Tokens

  • Key: max_completion_tokens
  • Type: Integer (1 or above)

Maximum generation token count (OpenAI recommended). Takes precedence over max_tokens if both are set.

Stream

  • Key: stream
  • Type: Boolean
  • Default: false

Enables streaming responses via Server-Sent Events. See the Streaming Guide for details.

Stream Options

  • Key: stream_options
  • Type: Object

Streaming configuration. Token usage is always included in the final streaming chunk (a chunk with an empty choices array): SIRAYA Model Router turns on include_usage for every streaming request, so setting it yourself is optional.

User

  • Key: user
  • Type: String

A unique identifier representing your end-user, which can help monitor and detect abuse.

Penalties and Bias

Frequency Penalty

  • Key: frequency_penalty
  • Type: Float (-2.0 to 2.0)
  • Default: 0.0

Penalizes tokens based on their frequency in the text so far. Encourages the model to use less frequent tokens.

Presence Penalty

  • Key: presence_penalty
  • Type: Float (-2.0 to 2.0)
  • Default: 0.0

Penalizes tokens based on whether they have already appeared in the text. Encourages the model to talk about new topics.

Logit Bias

  • Key: logit_bias
  • Type: Map (Token ID to Bias Value -100 to 100)

Modifies the likelihood of specific tokens appearing in the completion.

Output Structure

Response Format

  • Key: response_format
  • Type: Object (e.g., { "type": "json_object" })

Forces the model to produce a specific output format. Setting to json_object enables JSON mode; include the word "JSON" in your prompt when you use it. See Structured Outputs.

Stop

  • Key: stop
  • Type: Array of Strings (up to 4)

Immediately stop generation if any of the specified tokens are encountered.

Seed

  • Key: seed
  • Type: Integer

Used for deterministic sampling. Requests with the same seed and parameters should return similar results.

Logprobs

  • Key: logprobs
  • Type: Boolean
  • Default: false

Whether to return token log probabilities of output tokens. Returned by GPT (on GPT-5.x only with reasoning_effort set to none) and Gemini models; Claude models ignore it.

Top Logprobs

  • Key: top_logprobs
  • Type: Integer (0-20)

Number of top log probabilities to return. Requires logprobs=true.

Tools

Tools and Tool Choice

  • Key: tools, tool_choice
  • Type: Array (Tools), String or Object (Tool Choice)

Enables tool calling following the OpenAI specification. See the Tool Calling Guide for details.

Parallel Tool Calls

  • Key: parallel_tool_calls
  • Type: Boolean

Whether to allow parallel tool calls.

Reasoning

Reasoning Effort

  • Key: reasoning_effort
  • Type: String (none, minimal, low, medium, high, xhigh, max)

Controls reasoning effort level. Supported by the GPT-5 line, Claude, and Gemini models, and by other models with a switchable reasoning mode. Not every model accepts every level — an unsupported value is mapped to the nearest supported one or rejected by the backend. See Reasoning & Thinking.

Reasoning

  • Key: reasoning
  • Type: Object

Reasoning config object (OpenRouter compatible). If both reasoning and reasoning_effort are set, reasoning.effort takes precedence.

Field Type Description
effort string Effort level: max, xhigh, high, medium, low, minimal, none
max_tokens integer Direct token budget for reasoning
exclude boolean If true, model reasons internally but doesn't return reasoning
enabled boolean Explicitly enable/disable reasoning

Thinking (Extended Thinking)

  • Key: thinking
  • Type: Object

Configuration for extended thinking. Can be passed as a top-level field or via extra_body. Supported by Claude models and by Gemini 2.5 and later (Gemini 3.x takes a thinking_level tier instead of a token budget).

Field Type Description
type string enabled, adaptive, or disabled
budget_tokens integer Maximum token count for thinking (minimum 1024)

The router adapts type to the Claude model, so you can send the same value to any Claude model: enabled is accepted everywhere and is converted to adaptive (the budget is ignored) on Claude 4.7 and later; on Claude 4.6 and earlier models enabled with budget_tokens is honoured. A budget_tokens below 1024 is raised to 1024. disabled turns thinking off; on adaptive-only models (the Fable family) the field is dropped and the model uses its adaptive default. See Per-Model Details.

{
  "thinking": {
    "type": "enabled",
    "budget_tokens": 10000
  }
}

Web Search Options

  • Key: web_search_options
  • Type: Object

Enables web search for supported models (Claude, Gemini, and GPT models with web search support). Pass empty {} to enable with defaults.

Field Type Description
search_context_size string Search context amount: low, medium (default), high
user_location object User location for localized search results
user_location.approximate.city string City name (e.g., "Beijing")
user_location.approximate.country string ISO 3166-1 country code (e.g., "CN")
user_location.approximate.timezone string IANA timezone (e.g., "Asia/Shanghai")
{
  "web_search_options": {
    "search_context_size": "high",
    "user_location": {
      "type": "approximate",
      "approximate": {
        "city": "Beijing",
        "country": "CN",
        "timezone": "Asia/Shanghai"
      }
    }
  }
}

Backend-Specific Parameters

Extra Body

  • Key: extra_body
  • Type: Object (map[string]any)

Pass-through parameters for the backend. Pass backend-specific parameters (e.g., guardrail or safety-setting options) via extra_body.

{
  "extra_body": {
    "thinking": {
      "type": "enabled",
      "budget_tokens": 10000
    }
  }
}