Model family aliases
A family alias names a model family instead of one model. A request for claude-sonnet-latest goes to the newest Claude Sonnet model this gateway serves, so clients keep working when the admin adds a newer model and retires an older one. Nothing has to change in the client, in the key or in the config file.
What this is for
Hard coding a model version in every application means every provider release turns into a change request for every team. With a family alias, applications ask for the family and the gateway decides which concrete model that is today. The admin stays in control, because only models deployed on the gateway are ever picked, and an explicit alias in the router settings always wins over the automatic choice.
Family aliases apply to every LLM route that takes a model, such as /v1/chat/completions, /v1/responses and /v1/messages.
Scenario
A support application is built against claude-sonnet-latest. The admin has claude-sonnet-5 deployed. When claude-sonnet-5-5 ships, the admin adds a deployment for it on the Add Model tab and, after a test, deletes the old one. The application's next request lands on the new model, and the logs show which model answered next to the alias the client sent.
Steps
-
Deploy a member of the family. In the Admin UI open Models + Endpoints, pick the Add Model tab, choose Anthropic, pick
claude-sonnet-5-5and click Add Model, keeping the public name equal to the model name. From the command line:curl -X POST http://localhost:4000/model/new \-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \-d '{"model_name": "claude-sonnet-5-5","spanway_params": {"model": "anthropic/claude-sonnet-5-5", "api_key": "os.environ/ANTHROPIC_API_KEY"}}' -
Call the alias. Any of the three forms below names the same family.
curl -X POST http://localhost:4000/v1/chat/completions \-H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \-d '{"model": "claude-sonnet-latest", "messages": [{"role": "user", "content": "hi"}]}' -
See what it resolved to. Open Logs in the Admin UI and click the request. The logged model is the member that answered, and the request metadata carries
requested_model_alias: claude-sonnet-latest. From the command line,GET /v1/modelslistsclaude-sonnet-latestfor every family whose resolved model the key can see:curl http://localhost:4000/v1/models -H "Authorization: Bearer $SPANWAY_API_KEY" -
Pin the alias when you need to. To make
claude-sonnet-latestmean one specific model group regardless of what is deployed, open the Model Group Alias tab on Models + Endpoints, enterclaude-sonnet-latestas the Alias Name and the model group as the Target Model Group, and click Add Alias. That entry is kept and the automatic choice is skipped.
Expected result
Step 2 returns a normal chat completion whose model field names the resolved member, claude-sonnet-5-5, and the x-spanway-model-id header names its deployment. After the admin adds a newer Sonnet, the same request resolves to the newer model with no client change. Step 3 lists both the concrete model names and the -latest aliases the caller may use.
Alias forms
| Form | Example |
|---|---|
~vendor/family-latest | ~anthropic/claude-sonnet-latest |
vendor/family-latest | anthropic/claude-sonnet-latest |
family-latest | claude-sonnet-latest |
The first form matches the syntax some hosted routers use, so clients written for it work unchanged. The bundled families are claude-opus, claude-sonnet, claude-haiku, gemini-flash, gemini-flash-lite, gpt-mini and gpt-nano. Each one is an ordered list of model ids, newest first, kept in a data file bundled in the image, and every model a family names is also in the bundled model price map.
How the gateway picks a model
The gateway walks the family from newest to oldest and stops at the first member it serves. A member is served when a model group is named after it, with or without the provider prefix, or when a deployment's spanway_params.model is that model behind any provider prefix. A model group name wins over a deployment match for the same member.
A member whose deprecation_date in the price map has been reached is skipped, so the alias moves to the next member on that date even if the old deployment is still configured. Deployments owned by a team (model_info.team_id) are never picked, because their model group names are internal to that team.
Explicit names win
The alias is resolved after routing presets, model suffixes such as :nitro, and the key's or team's router_settings.model_group_alias. Nothing is resolved when the requested name already means something, which is the case for any of the following.
- A model group, deployment id or routing group on this gateway.
- An entry in the router's
model_group_alias. - An entry in the global
model_alias_map. - An alias on the key or the team.
- A team model whose
team_public_model_nameis that name, for callers on that team.
Access control
Key, team and user model checks run on the model the alias resolves to. A key that may only call claude-sonnet-4-6 gets a 403 for claude-sonnet-latest once a newer Sonnet is served, instead of reaching the newer model through the alias. Give the key the family's members, or the model access group that holds them.
Logs and the model list
The alias the client sent is kept in the spend log metadata as requested_model_alias, so it shows in the request's metadata on the Logs page, and the logged model is the model it resolved to. Family aliases write no operator log line of their own. A client cannot set requested_model_alias itself. GET /v1/models lists family-latest for every family whose resolved model the caller can see, and a model group that already uses that exact name keeps its own entry.
Limits
- Only the bundled families are available. There is no admin setting to add a family yet.
- Wildcard deployments such as
anthropic/*never answer a family alias, because the gateway cannot tell which concrete models the wildcard really serves. Add a deployment for the member, or amodel_group_alias. - Bedrock and Vertex style model ids such as
us.anthropic.claude-sonnet-...do not match a family member. Add amodel_group_aliasfor those.
Errors
| What you see | Why | Fix |
|---|---|---|
404 naming the family, such as 'claude-sonnet-latest' asks for the newest 'claude-sonnet' model, and no model in that family is served by this gateway. | No member of the family is deployed, or the only members are wildcards or team scoped. | Deploy a member on the Add Model tab, or add a Model Group Alias. |
403 with key_model_access_denied, see the error reference | The key may not call the member the alias resolved to. | Add the member, or its access group, to the key or team. |
| The alias resolves to an older model than expected | The newest member is deployed only behind a wildcard, is team scoped, or its public name differs from the model id. | Deploy it with a public name equal to the model id, or pin the alias on the Model Group Alias tab. |
| The alias keeps pointing at a retired model | A model_group_alias for the family name exists and wins. | Change or delete it on the Model Group Alias tab. |
400 Invalid model name passed in model=claude-sonnet-latest on an older gateway | The gateway predates family aliases. | Upgrade, or add a model_group_alias. |
Related
- Model management, adding and removing members.
- Models + Endpoints page, the Model Group Alias tab.
- Wildcard routing, why wildcards do not answer aliases.
- Routing presets, the
@preset/nameform that is resolved first. - Logs page, finding
requested_model_aliason a request.