AI Gateway
Fallbacks and advanced options
Fallback models, reasoning, plugins, web search, and other advanced options.
These are advanced options the pre.dev AI API supports on top of the standard chat completion fields. You choose the model; pre.dev chooses how to serve it.
Fallback models
Send models instead of a single model. The gateway tries each in order, and the response reports which one answered.
{
"models": ["anthropic/claude-sonnet-5", "openai/gpt-6-luna", "deepseek/deepseek-v4.1-flash-1017"],
"route": "fallback",
"messages": [{ "role": "user", "content": "Summarize the plot of Dune in two sentences." }]
}You pay for the model that actually answered, at its own price. Read model in the response, or the by_model rows in usage, to see where traffic landed.
Reasoning
reasoning (an object) and reasoning_effort (a string) control thinking on models that support it. Reasoning tokens are billed as output tokens.
{
"model": "anthropic/claude-sonnet-5",
"reasoning": { "effort": "medium" },
"messages": [{ "role": "user", "content": "Is 9973 prime? Show your reasoning briefly." }]
}Many models reason by default. For short answers, pass reasoning: { "enabled": false } or keep max_tokens large enough for the thinking and the answer.
Plugins and web search
plugins accepts web, file-parser, response-healing, and context-compression. web_search_options tunes the web plugin, and a model id ending in :online turns web search on. Plugin costs are part of the call’s charge.
{
"model": "openai/gpt-6-luna",
"plugins": [{ "id": "web" }],
"web_search_options": { "search_context_size": "low" },
"messages": [{ "role": "user", "content": "What changed in the latest Node.js LTS release?" }]
}Other supported fields
| Field | Purpose |
|---|---|
transforms | Prompt transforms, such as compressing a long conversation to fit the context |
prediction | Predicted outputs |
verbosity | Response length hint |
session_id | Group related requests under one session |
user | End-user identifier; pre.dev prefixes it with an identifier for your workspace |
If you send user, keep it stable per end user so abuse reports can be attributed.