Presets

A preset is a name that resolves to a model. Your code sends the name; the dashboard decides what it means. Move a whole application to a new model without a deploy, or run different environments on different models with one codebase.

Create one#

  1. Open Inference → Presets and create a preset, for example assistant-default.
  2. Choose its model. The first model in the preset is the one requests get.

Use it#

Send the name in X-Ahura-Preset. When the header is present, model in the body becomes optional; the preset’s model is used. If the body does name a model, the body wins.

curl
curl https://api.ahurasense.com/v1/chat/completions \
  -H "Authorization: Bearer $AHURA_API_KEY" \
  -H "X-Ahura-Preset: assistant-default" \
  -H "Content-Type: application/json" \
  -d '{"messages":[{"role":"user","content":"Hello"}]}'

The response carries X-Ahura-Preset with the name that was applied and X-Ahura-Model with the model it resolved to, so a log line shows both.

OpenAI SDK
completion = client.chat.completions.create(
    model="",  # the preset supplies it; the SDK requires the field to exist
    messages=[{"role": "user", "content": "Hello"}],
    extra_headers={"X-Ahura-Preset": "assistant-default"},
)

Propagation#

Preset definitions are cached at the edge for up to five minutes, so a change in the dashboard reaches every request within that window. An unknown name returns 400 preset_not_found. Presets belong to your organization; every key in it can use them, subject to the key’s own model allowlist.

Something missing or wrong on this page? Tell us, and quote the page title.