Skip to main content

Routing Presets page

The Routing Presets page manages routing presets, which are named and versioned bundles of models, provider preferences and default parameters. A request uses one by sending @preset/<name> as its model. Open the page at /ui/routing-presets. It sits in the left nav in the AI Gateway group, right after Models + Endpoints. The nav shows it to proxy admins, proxy admin viewers, internal users and internal viewers. When an admin limits the pages internal users can see (the enabled_ui_pages_internal_users UI setting), internal users only see it if it is on that list. Org admins do not see it in the nav. The page has no license gate.

What this page is for​

Teams repeat the same routing rules in every application, which models to try, which providers may serve them and which generation defaults to use. This page lets an admin save those rules once under a name, so applications send @preset/<name> and the admin changes the rules in one place with a version history and a rollback.

A real-world scenario​

A European customer must only be served from Azure and Bedrock regions in the EU. The admin saves a global preset eu-fast with the two allowed providers and a conservative temperature, and the customer's applications switch their model to @preset/eu-fast. When a cheaper EU region appears, the admin edits the preset and every application picks the change up within a minute. When the new region misbehaves, Roll back restores the previous version without touching any application.

Step by step​

  1. Open /ui/routing-presets as a proxy admin. Leave Scope (global or a team id) at global and click Show.
  2. Click New preset, type eu-fast as the Name, and edit Configuration (JSON) to {"models": ["gpt-5.6", "claude-sonnet-5-5"], "provider": {"only": ["azure", "bedrock"], "sort": "throughput"}, "params": {"temperature": 0.2}}.
  3. Click Save. The toast reads Saved @preset/eu-fast and the row shows Version 1.
  4. Send a request with "model": "@preset/eu-fast" and check its spend log row records routing_preset: eu-fast@1.
  5. Click Edit, change the JSON, click Save, and watch Version become 2. Click Versions and Roll back on version 1 to make it version 3.

The same preset over the API:

curl -X POST http://localhost:4000/routing/presets \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" \
-H "Content-Type: application/json" \
-d '{"slug": "eu-fast", "scope": "global", "config": {"models": ["gpt-5.6", "claude-sonnet-5-5"], "provider": {"only": ["azure", "bedrock"], "sort": "throughput"}, "params": {"temperature": 0.2, "max_tokens": 2000}}}'

Expected result​

The save answers with the new version, for example {"scope": "global", "slug": "eu-fast", "version": 1, "config": {...}, "created_by": "admin@example.com", "created_at": "2026-11-21T09:12:44.102Z"}, and the table lists @preset/eu-fast with its models and save date. Requests that send @preset/eu-fast are served by gpt-5.6 on Azure or Bedrock with claude-sonnet-5-5 as the fallback, and every write appears in the audit log.

Presets list​

The page header reads Routing presets with a short explanation. Below it is the scope picker.

ControlTypeWhat it does
Scope (global or a team id)Text field, starts as globalThe scope whose presets you want to see. Type global or a team id.
ShowButtonLoads the presets for the typed scope. An empty field loads global.
New presetButtonOpens the New routing preset dialog for the current scope. Shown only when you may write to that scope.

A help line under the picker depends on your role. Proxy admins and proxy admin viewers read "Pick global or a team id. Team presets are tried first for that team's keys, then global ones." Other users either read that they can see global presets and the presets of their teams, followed by their team ids, or, with no team, "You can read global presets. Join a team to see its presets." When you cannot write to the shown scope, a second line explains why, for example "Only proxy admins can create, change or delete global presets." or "Only proxy admins and admins of team ... can change its presets."

The table lists the newest version of each preset in the scope.

ColumnMeaning
PresetThe reference to use in requests, such as @preset/eu-fast.
VersionThe newest version number.
ModelsThe models the preset sets, or "Request chooses" when it sets none.
SavedThe date the newest version was saved.
ActionsVersions for everyone. Edit and Delete only when you may write to the scope.

New routing preset and Save a new version dialogs​

New preset opens "New routing preset". Edit on a row opens "Save a new version" with the current configuration filled in. The dialog names the scope it writes to.

FieldTypeRules and effect
NameText, placeholder eu-fastRequired. Lowercase letters, digits, ., _ and -, starting with a letter or digit, up to 64 characters. A leading @preset/ is stripped. Locked when you edit an existing preset. The gateway also refuses a team preset that reuses the name of a global preset.
Configuration (JSON)Text areaMust be a JSON object that sets at least one of models, provider and params. A new preset starts with an example that sets all three.

Save checks the fields and shows an error toast when a rule fails. On success it saves the configuration as the next version, shows "Saved @preset/..." and closes the dialog. Saving never overwrites an older version. Cancel closes the dialog without saving.

Versions dialog​

Versions opens "Versions of @preset/...". It lists every version, newest first, with its version number, "(current)" on the newest one, the save date, who saved it and the full configuration. When you may write to the scope, each older version has Roll back. A rollback saves the chosen version again as the newest version, so the history keeps growing and nothing is lost. A toast confirms "Rolled back to version N".

Delete dialog​

Delete opens "Delete @preset/...?" with the warning "Requests that reference it start failing with a 404, and its version history is hidden." Delete removes the preset and all its versions from use, and the gateway answers later requests for it with a 404. Cancel keeps it. The UI has no way to restore a deleted preset, but saving a new preset with the same name creates it again, with version numbers continuing after the deleted ones.

Budget tiers​

Below the presets list, the Budget tiers section manages budget tier policies. A policy maps the frontier, balanced and economy tiers to presets for one team or organization. Requests that send "model": "@tier" start on the starting tier and move to a cheaper preset as the budget used crosses each shift, so the team keeps working instead of hitting its limit early. Proxy admins and admin viewers see every policy. Other users see the policies of their own teams.

ColumnMeaning
Applies toteam or organization, then its id.
Tier nowThe tier the budget selects right now. When the recorded tier differs, for example because no @tier request has arrived since the budget moved, it adds "(last recorded ...)".
BudgetThe share of the team's or organization's budget used, or "No budget set".
PresetsThe preset of each tier.
ShiftsThe shift percentages and tiers, for example "75% to balanced, 90% to economy", or "Never shifts".
ActionsEdit and Remove, only for proxy admins and, on team policies, admins of that team.

New tier policy opens the policy form, shown to proxy admins and team admins. Every field has its help line next to it in the form.

FieldWhat it does
Applies toteam gives one team its own tiers. organization covers every team in it, and only proxy admins can save it. When a team has both, requests get the cheaper of the two tiers, so a team policy cannot lift a team above its organization's tier. Locked when you edit.
Team or organization idThe id whose budget decides the tier. With no budget set, requests stay on the starting tier. Locked when you edit.
frontier preset, balanced preset, economy presetThe preset name of each tier, without @preset/. Leave a tier empty if the policy never uses it. An organization policy can only use global presets.
Starting tierThe tier requests use while the budget is healthy. Default frontier. It needs a preset.
First shift at (% of budget used) and First shift moves toWhen this share of the budget is used, requests move to the cheaper tier. Default 75 and balanced. Clear the percentage to turn the shift off.
Second shift at (% of budget used) and Second shift moves toA higher share where requests move cheaper again. Default 90 and economy. Clear it to turn it off.

Save shows "Saved the budget tier policy of ..." and the table refreshes. A percentage outside 0 to 100 is refused in the form, and the gateway's own error, such as a missing preset or a shift that is not cheaper, appears in a toast. Remove asks "Remove the budget tier policy of ...?" first and warns that @tier requests then fall back to the organization policy, or fail with a 404 when there is none. Every save, removal and automatic shift writes an audit row, and a shift sends the Budget Tier Shift alert.

Empty, error and disabled states​

When a scope has no presets the page reads "No routing presets in scope ..." with the scope name. When the list cannot be loaded, for example because you may not read that team's presets, the gateway's error appears in place of the table, such as "You cannot read routing presets of scope ...". A failed save, rollback or delete shows the gateway's error in a toast, or "The routing preset could not be saved" when there is no message. New preset, Edit, Delete and Roll back are hidden, not disabled, when you cannot write to the scope.

Errors​

What you seeWhyFix
You cannot read routing presets of scope ... in place of the tableYour role may not read that team's presets.Type global or a team you belong to.
A toast with Only proxy admins can change global routing presetsA team admin or internal user wrote to the global scope.Pick a team scope you administer, or ask a proxy admin.
A toast with A global preset is named ..., so a team preset cannot shadow itThe name is taken by a global preset.Pick another name.
A toast with Team presets already use the name ...A team already uses the name, so a global preset cannot take it.Pick another name, or delete the team preset.
The routing preset could not be savedThe gateway refused the write without a message, usually because no database is connected.Check the gateway log and the database connection.
An error toast naming models, provider or paramsThe JSON sets none of the three, or a value is invalid.Fix the JSON. The dialog keeps your text.
A toast with Routing preset ... does not exist for team ... or globallyA tier policy names a preset its team cannot use.Create the preset first, or fix the name.
A toast with Only proxy admins can change organization budget tier policiesA team admin saved an organization policy.Pick team, or ask a proxy admin.
Requests get 404 after a deleteDeleted presets stop resolving once each replica's cache expires.Create the preset again, or change the applications.

Logs​

The page writes no operator log line. Every save, roll back and delete writes an audit row with the configuration before and after, see audit logs, and requests served by a preset carry preset=<name>@<version> in the x-spanway-routing-reason header.

Differences by role and license​

RoleReadWrite
Proxy adminAny scope.Global and every team scope.
Proxy admin viewerAny scope.None. The gateway refuses writes from read-only roles.
Internal userGlobal, their own key's team, and teams they belong to.Only teams where they are a team admin. Never global.
Internal viewerSame as internal user.None.

The UI decides which write buttons to show from the session role and team admin membership, and the gateway checks the same rules again on every write. Proxy admin viewers and internal viewers never see the write buttons, and they read the line that explains who may change the shown scope. If one of them calls the routes directly, the gateway answers 403 and nothing changes. An admin viewer reads user not allowed to access this route, role= proxy_admin_viewer. Trying to access: /routing/presets, and an internal viewer reads Only proxy admin can be used to generate, delete, update info for new keys/users/teams. .... Routing presets need no license.

  • Routing presets explains how a preset is applied to a request and the team and global rules.
  • Routing explains how the preset's models become a fallback chain.
  • Team based routing covers the other ways to give a team its own routing.
  • Budget tiers explains how a tier policy picks a preset from the budget used.
  • Audit logs record every preset write.