Create a preset from a chat-completions request body
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.
Authorizations
API key as bearer token in Authorization header
Path Parameters
URL-safe slug identifying the preset. Created if it does not exist.
1"my-preset"
Body
Chat completion request parameters
List of messages for the conversation
1Chat completion message with role-based discrimination
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
{
"content": "What is the capital of France?",
"name": "Assistant Config",
"role": "user"
}
[{ "content": "Hello!", "role": "user" }]
Enable automatic prompt caching. When set at the top level, the system automatically applies cache breakpoints to the last cacheable block in the request. Currently supported for Anthropic Claude models.
{ "type": "ephemeral" }
Debug options for inspecting request transformations (streaming only)
{ "echo_upstream_body": true }
Frequency penalty (-2.0 to 2.0)
0
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.
{ "aspect_ratio": "16:9", "quality": "high" }
Token logit bias adjustments
{ "50256": -100 }
Return log probabilities
false
Maximum tokens in completion
100
Maximum tokens (deprecated, use max_completion_tokens). Note: some providers enforce a minimum of 16.
100
Key-value pairs for additional object information (max 16 pairs, 64 char keys, 512 char values)
{
"session_id": "session-456",
"user_id": "user-123"
}
Minimum probability threshold relative to the most likely token. Tokens with probability below min_p * (probability of top token) are filtered out. Not all providers support this parameter.
0.1
Output modalities for the response. Supported values are "text", "image", and "audio".
text, image, audio ["text", "image"]
Model to use for completion
"openai/gpt-4"
Models to use for completion
Available OpenRouter chat completion models
["openai/gpt-4", "openai/gpt-4o"]
Whether to enable parallel function calling during tool use. When true, the model may generate multiple tool calls in a single response.
true
Plugins you want to enable for this request, including their settings.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
{
"allowed_models": ["anthropic/*", "openai/gpt-4o"],
"cost_quality_tradeoff": 7,
"enabled": true,
"id": "auto-router"
}
Presence penalty (-2.0 to 2.0)
0
When multiple model providers are available, optionally indicate your routing preference.
{ "allow_fallbacks": true }
Configuration options for reasoning models
{ "effort": "medium", "summary": "concise" }
Shorthand for setting reasoning effort. Equivalent to setting reasoning.effort. Cannot be used simultaneously with reasoning.effort if they differ.
max, xhigh, high, medium, low, minimal, none, null "medium"
Penalizes tokens based on how much they have already appeared in the text. A value of 1.0 means no penalty. Values above 1.0 penalize repeated tokens more strongly. Not all providers support this parameter.
1
Response format configuration
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
{ "type": "json_object" }
DEPRECATED Use providers.sort.partition instead. Backwards-compatible alias for providers.sort.partition. Accepts legacy values: "fallback" (maps to "model"), "sort" (maps to "none").
fallback, sort, null "fallback"
Random seed for deterministic outputs
42
The service tier to use for processing this request.
auto, default, flex, priority, scale, null "auto"
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.
256Stop sequences (up to 4)
["\n"]
Stop conditions for the server-tool agent loop. Any condition firing halts the loop (OR logic). When set, this overrides max_tool_calls.
1A single condition that, when met, halts the server-tool agent loop.
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
{ "step_count": 5, "type": "step_count_is" }
[
{ "step_count": 5, "type": "step_count_is" },
{
"max_cost_in_dollars": 0.5,
"type": "max_cost"
}
]
Enable streaming response
false
Streaming configuration options
{ "include_usage": true }
Sampling temperature (0-2)
0.7
Tool choice configuration
none "auto"
Available tools for function calling
Tool definition for function calling (regular function or OpenRouter built-in server tool)
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
{
"function": {
"description": "Get the current weather for a location",
"name": "get_weather",
"parameters": {
"properties": {
"location": {
"description": "City name",
"type": "string"
},
"unit": {
"enum": ["celsius", "fahrenheit"],
"type": "string"
}
},
"required": ["location"],
"type": "object"
}
},
"type": "function"
}
[
{
"function": {
"description": "Get weather",
"name": "get_weather"
},
"type": "function"
}
]
Consider only tokens with "sufficiently high" probabilities based on the probability of the most likely token. Not all providers support this parameter.
0
Limits the model to choose from the top K most likely tokens at each step. A value of 1 means the model will always pick the most likely next token. Not all providers support this parameter.
40
Number of top log probabilities to return (0-20)
5
Nucleus sampling parameter (0-1)
1
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.
{
"trace_id": "trace-abc123",
"trace_name": "my-app-trace"
}
Unique user identifier
"user-123"
Response
Preset created or updated successfully.
Response containing the created preset with its designated version.
A preset with its currently designated version.
{
"created_at": "2026-04-20T10:00:00Z",
"creator_user_id": "user_2dHFtVWx2n56w6HkM0000000000",
"description": null,
"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",
"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
}
}