> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pre.dev/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> Agents: start with https://docs.pre.dev/agents.md, which has complete recipes, plan access, polling rules, errors and limits.
> Authenticate with the workspace API key (pdk_…) from Integrations → Built-in, sent as Authorization: Bearer <key>.
> REST API: https://api.pre.dev (OpenAPI: https://docs.pre.dev/api-reference/openapi.json). AI Gateway: https://api.pre.dev/v1, OpenAI-compatible (OpenAPI: https://docs.pre.dev/api-reference/ai-gateway.openapi.json).
> pre.dev MCP server: https://api.pre.dev/mcp. Search these docs over MCP at https://docs.pre.dev/mcp.

# 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.

```json theme={null}
{
  "models": ["anthropic/claude-sonnet-5", "openai/gpt-6-luna", "deepseek/deepseek-v4.1-flash"],
  "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](/ai-gateway/api/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.

```json theme={null}
{
  "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.

```json theme={null}
{
  "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.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.