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

# Presets

> Save a model, its fallbacks, a routing strategy, instructions and sampling settings under a name, and call them as "@preset/<name>" from any chat endpoint.

A preset keeps a model and the settings you send with it under a short name. Send `"model": "@preset/<name>"` and NagaAI fills in the rest, so you change the model or the instructions without a code change. It also works in tools that let you set only a model name, such as Claude Code, Codex or Cursor.

The example saves a preset with the account API, then calls it through the Responses API. The account API takes a [provisioning key](https://docs.naga.ac/get-started/authentication.md), and the request takes an ordinary API key.

```python Python theme={"theme":{"light":"github-light-default","dark":"github-dark-dimmed"}}
import os
import requests
from openai import OpenAI

preset = "support-bot"
saved = requests.put(
    f"https://api.naga.ac/v1/account/presets/{preset}",
    headers={"Authorization": f"Bearer {os.environ['NAGA_PROVISIONING_KEY']}"},
    json={
        "model": "anthropic/claude-sonnet-5.5",
        "models": ["openai/gpt-6.1-sol"],
        "routing": {"strategy": "latency"},
        "instructions": "You answer questions about Acme's billing. Keep answers under 80 words.",
        "temperature": 0.2,
    },
)
saved.raise_for_status()
print("version", saved.json()["version"])

client = OpenAI(base_url="https://api.naga.ac/v1", api_key=os.environ["NAGA_API_KEY"])
response = client.responses.create(
    model=f"@preset/{preset}",
    input="Why was I charged twice this month?",
)
print(response.model, response.output_text)
```

```javascript Node.js theme={"theme":{"light":"github-light-default","dark":"github-dark-dimmed"}}
import OpenAI from "openai";

const preset = "support-bot";
const saved = await fetch(`https://api.naga.ac/v1/account/presets/${preset}`, {
  method: "PUT",
  headers: {
    Authorization: `Bearer ${process.env.NAGA_PROVISIONING_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "anthropic/claude-sonnet-5.5",
    models: ["openai/gpt-6.1-sol"],
    routing: { strategy: "latency" },
    instructions: "You answer questions about Acme's billing. Keep answers under 80 words.",
    temperature: 0.2,
  }),
});
if (!saved.ok) throw new Error(`HTTP ${saved.status}`);
console.log("version", (await saved.json()).version);

const client = new OpenAI({ baseURL: "https://api.naga.ac/v1", apiKey: process.env.NAGA_API_KEY });
const response = await client.responses.create({
  model: `@preset/${preset}`,
  input: "Why was I charged twice this month?",
});
console.log(response.model, response.output_text);
```

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-dimmed"}}
PRESET=support-bot
curl -X PUT https://api.naga.ac/v1/account/presets/$PRESET \
  -H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "anthropic/claude-sonnet-5.5", "models": ["openai/gpt-6.1-sol"], "routing": {"strategy": "latency"}, "instructions": "You answer questions about Acme'"'"'s billing. Keep answers under 80 words.", "temperature": 0.2}'

curl https://api.naga.ac/v1/responses \
  -H "Authorization: Bearer $NAGA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "@preset/'"$PRESET"'", "input": "Why was I charged twice this month?"}'
```

The save answers with the preset and the version requests now use. The response to the call carries the model that answered in `model`, here `anthropic/claude-sonnet-5.5`, or `openai/gpt-6.1-sol` when the first model couldn't answer:

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-dimmed"}}
{
  "name": "support-bot",
  "version": 1,
  "preset": {
    "model": "anthropic/claude-sonnet-5.5",
    "models": ["openai/gpt-6.1-sol"],
    "routing": {"strategy": "latency"},
    "instructions": "You answer questions about Acme's billing. Keep answers under 80 words.",
    "temperature": 0.2
  },
  "created_at": "2026-11-19T08:00:00",
  "updated_at": "2026-11-19T08:00:00"
}
```

## What a preset holds

Only `model` is required. Every other field is used when the request leaves it out, so one preset serves both a client that sends nothing but the model name and one that sets its own temperature.

| Field | What it sets |
| - | - |
| `model` | The chat model the request goes to, by id or alias from `GET /v1/models` |
| `models` | Up to three [fallback models](https://docs.naga.ac/build/routing.md#fallback-models), tried in order when `model` can't answer |
| `routing` | The [routing strategy](https://docs.naga.ac/build/routing.md#strategies) and [price limit](https://docs.naga.ac/build/routing.md#limit-the-price) |
| `instructions` | Instructions placed before the request's own |
| `temperature`, `top_p` | Sampling, as in the request body |
| `max_output_tokens` | The longest answer, from 1 up |

A preset doesn't name a provider. NagaAI keeps choosing the provider for each request, as [Routing](https://docs.naga.ac/build/routing.md) describes.

## How a preset meets the request

The same preset works on all three chat endpoints: `POST /v1/responses`, `POST /v1/chat/completions` and `POST /v1/messages`. Each field goes where that endpoint expects it.

The model always comes from the preset. For any other field, a value in the request wins and the preset fills only what the request leaves out or sets to `null`. `routing` is filled key by key, so a request that sets only `max_price` still gets `strategy` from the preset. The fallback list goes into `models` on Responses and Chat Completions and into `fallbacks` on Messages. The answer limit goes into `max_output_tokens`, `max_tokens` or `max_completion_tokens`, whichever the endpoint reads, unless the request already sets one.

Instructions are the one field both sides keep. Text from the preset comes first, and the request's own follows after a blank line. On Responses that is `instructions`, on Messages `system`, and on Chat Completions a system message placed before the request's messages.

A preset costs nothing. A request through it is billed at the price of the model that answered, as any other request is.

## Change and roll back a preset

Each `PUT` to the same name saves a new version, and requests use the newest one from then on. Sending the settings already in use writes no new version. A typo in a model name is refused at save time with `400`, so it never reaches your users. To list what you saved, call `GET /v1/account/presets/support-bot/versions`, newest first. To go back to an earlier version, send its number:

```bash cURL theme={"theme":{"light":"github-light-default","dark":"github-dark-dimmed"}}
PRESET=support-bot
curl -X PATCH https://api.naga.ac/v1/account/presets/$PRESET \
  -H "Authorization: Bearer $NAGA_PROVISIONING_KEY" \
  -H "Content-Type: application/json" \
  -d '{"version": 1}'
```

A rollback writes no new version, so you can move forward again the same way. `GET /v1/account/presets` lists every preset of the account with the version in use. `DELETE /v1/account/presets/support-bot` deletes one, and requests that call it fail from then on. Saving the same name again brings it back, with its earlier versions kept.

A name is 1 to 64 lower-case letters, digits, `-` and `_`, starting with a letter or digit. Presets belong to the account, so every API key of the account can call them.

## Troubleshooting

### `400 model_not_found` with `@preset/<name>`

The account has no preset by that name. It was never saved, it was deleted, or it belongs to another account. Check the name with `GET /v1/account/presets`, and check that the API key belongs to the same account as the provisioning key that saved it.

### `400` naming a `body` field on save

A model in the preset isn't a chat model NagaAI serves, or it has been retired. Pick a live id from `GET /v1/models`. A preset can't call another preset either. A `temperature` outside 0 to 2, a `top_p` outside 0 to 1 or a `max_output_tokens` below 1 is refused the same way, naming its field, because every request through the preset would fail on it.

### `400` naming `body.version` on rollback

The preset never saved that version number. List the saved ones with `GET /v1/account/presets/<name>/versions`.

### `404` from the account API

`GET`, `PATCH` or `DELETE` named a preset the account doesn't have, or a name that can't be one. Save it with `PUT` first.


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