Presets

Create a preset from a responses request body

Changed on

Creates a preset (or a new version of an existing one) from an inference request body. Only fields that overlap with the preset config are persisted; other fields (e.g. messages, stream, prompt) are silently ignored. Requires a read-write management key; inference API keys are rejected.

post/presets/{slug}/responses

Request

  • Base URL
    https://openrouter.ai/api/v1
  • Auth
    HTTP bearer

Path parameters

slug, string required

URL-safe slug identifying the preset. Created if it does not exist.

Example:my-preset

Query parameters

workspace_id, string uuid

Workspace to act in. Also accepted as a workspace_id field in a JSON request body. Defaults to the key's workspace for a key limited to one workspace, otherwise to the account's default workspace.

Example:750e8400-e29b-41d4-a716-446655440002

Request body

ResponsesRequest required

Request schema for Responses endpoint

access_programs, object

OpenAI access programs for this request. cyber selects the Cyber access program: standard, daybreak_blue, or daybreak_red. A program other than standard is supported only on BYOK requests that run on your own OpenAI key enrolled in that program; any other endpoint, including OpenRouter's own OpenAI credentials, rejects it with a 400 error. Requests on OpenRouter's OpenAI credentials always run standard. Omit the field unless your key is enrolled in a Daybreak program.

background, boolean nullable
cache_control, AnthropicCacheControlDirective

Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. When set on an individual content block, it marks an explicit cache breakpoint; block-level markers also work on OpenAI models that support explicit prompt caching — OpenRouter converts them to the provider's native format.

context_management, ResponsesContextManagement[] nullable

Server-side context management (compaction). Supported for OpenAI models served by OpenAI or Azure, which return compaction output items. Providers translated to another API format drop it. Replay returned compaction items in input on later turns.

debug, ChatDebugOptions

Debug options for inspecting request transformations (streaming only)

deferred_tools, DeferredToolsControl

Opt-in versioned router-level deferred-tool protocol. Replay assistant reasoning unchanged on continuation. The portable profile needs the catalog unchanged across a continuation; the universal profile accepts a changed catalog and, with announce_catalog_changes, tells the model about it.

frequency_penalty, number double nullable
image_config, ImageConfig

Provider-specific image configuration options. Keys and values vary by model/provider. See https://openrouter.ai/docs/guides/overview/multimodal/image-generation for more details.

include, ResponseIncludesEnum[] nullable
input, union

Input for a response request - can be a string or array of items

instructions, string nullable
max_output_tokens, integer nullable
max_tool_calls, integer nullable

Maximum number of server-tool (e.g. openrouter:web_search) agent steps the model may take during a request. Defaults to 30, which is also the maximum. Ignored when stop_server_tools_when is set.

metadata, RequestMetadata nullable

Metadata key-value pairs for the request. Keys must be ≤64 characters and cannot contain brackets. Values must be ≤512 characters. Maximum 16 pairs allowed.

modalities, OutputModalityEnum[]

Output modalities for the response. Supported values are "text" and "image".

model, string
models, string[]
parallel_tool_calls, boolean nullable
plugins, union[]

Plugins you want to enable for this request, including their settings.

presence_penalty, number double nullable
previous_response_id, unknown
prompt, StoredPromptTemplate nullable
prompt_cache_key, string nullable
prompt_cache_options, PromptCacheOptions nullable

Request-level prompt-cache controls. mode: "explicit" disables OpenAI-managed breakpoints so only blocks marked with prompt_cache_breakpoint are cached. ttl sets the minimum cache lifetime for every breakpoint the request writes: "30m" (default) or "12h" (billed at the higher 12h cache-write rate). Only supported by OpenAI GPT-5.6 and newer.

provider, ProviderPreferences nullable

When multiple model providers are available, optionally indicate your routing preference.

reasoning, ReasoningConfig nullable

Configuration for reasoning mode in the response

route, 'fallback' | 'sort' | 'null' nullable

DEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").

safety_identifier, string nullable

Recommended per-end-user identifier for abuse isolation. Use a stable ID, hash, or pseudonym. When a provider requires a user identity, OpenRouter folds it into the hashed identity sent upstream and never forwards it raw. If omitted, requests use an account-level identity, so provider policy blocks can affect the whole account.

service_tier, 'auto' | 'default' | 'fast' | 'flex' | 'priority' | 'scale' | 'ultrafast' | 'null' nullable

The service tier to use for processing this request. fast is accepted as an alias for priority. ultrafast prefers ultrafast endpoints and falls back to priority, then default endpoints.

session_id, string

A unique identifier for grouping related requests (e.g., a conversation or agent workflow). When provided, OpenRouter uses it as the sticky routing key, routing all requests in the session to the same provider to maximize prompt cache hits. Also used for observability grouping. If provided in both the request body and the x-session-id header, the body value takes precedence. Maximum of 256 characters.

stop, union

Stop sequences (up to 4)

stop_server_tools_when, StopServerToolsWhenCondition[]

Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides max_tool_calls. When a condition fires while the model is still emitting tool calls, the pending tool calls are executed and one final turn is made with tool calls disabled so the response ends with a natural-language answer instead of an unfinished tool call.

store, false
stream, boolean
temperature, number double nullable
text, TextExtendedConfig

Text output configuration including format and verbosity

tool_choice, union
tools, union[]
top_k, integer
top_logprobs, integer nullable
top_p, number double nullable
trace, TraceConfig

Metadata for observability and tracing. Known keys (trace_id, trace_name, span_name, generation_name, parent_span_id) have special handling. Additional keys are passed through as custom metadata to configured broadcast destinations.

truncation, 'auto' | 'disabled' | 'null' nullable
user, string

A unique identifier representing your end-user, which helps distinguish between different users of your app. This allows your app to identify specific users in case of abuse reports, preventing your entire app from being affected by the actions of individual users. Maximum of 256 characters.

Example request

{
  "input": [
    {
      "content": "Hello, how are you?",
      "role": "user",
      "type": "message"
    }
  ],
  "model": "anthropic/claude-4.5-sonnet-20250929",
  "temperature": 0.7,
  "tools": [
    {
      "description": "Get the current weather in a given location",
      "name": "get_current_weather",
      "parameters": {
        "properties": {
          "location": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "type": "function"
    }
  ],
  "top_p": 0.9
}

Response

Preset created or updated successfully.

CreatePresetFromInferenceResponse required

Response containing the created preset with its designated version.

data, PresetWithDesignatedVersion required

A preset with its currently designated version.

Example response

{
  "data": {
    "created_at": "2026-04-20T10:00:00Z",
    "creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
    "description": null,
    "designated_version": {
      "config": {
        "model": "openai/gpt-4o",
        "temperature": 0.7
      },
      "created_at": "2026-04-20T10:00:00Z",
      "creator_id": "user_2dHFtVWx2n56w6HkM0000000000",
      "id": "550e8400-e29b-41d4-a716-446655440000",
      "preset_id": "650e8400-e29b-41d4-a716-446655440001",
      "system_prompt": "You are a helpful assistant.",
      "updated_at": "2026-04-20T10:00:00Z",
      "version": 1
    },
    "designated_version_id": "550e8400-e29b-41d4-a716-446655440000",
    "id": "650e8400-e29b-41d4-a716-446655440001",
    "name": "my-preset",
    "slug": "my-preset",
    "status": "active",
    "status_updated_at": null,
    "updated_at": "2026-04-20T10:00:00Z",
    "workspace_id": "750e8400-e29b-41d4-a716-446655440002"
  }
}

Changes

    • info

      added the new optional request property provider/options/celeris

    • info

      added the new Celeris enum value to the request property provider/ignore/items/anyOf[#/components/schemas/ProviderName]

    • info

      added the new Celeris enum value to the request property provider/only/items/anyOf[#/components/schemas/ProviderName]

    1 more change in this revision