Team based routing
Different teams often need different backends for the same public model name. One team may have dedicated provisioned capacity, another may be restricted to a region, and a third may be testing a newer model. The gateway supports this in three ways. Team model aliases redirect a model name for one team, team tags route a whole team through tag routing, and team scoped models belong to one team only. All three are part of the free gateway and are managed on the Teams page or with the /team/* routes.
A real-world scenario
The search ranking team has bought provisioned throughput for claude-sonnet-5-5 on Bedrock, while everyone else shares the Anthropic API. Their code, like everyone else's, sends claude-sonnet-5-5. The admin registers the Bedrock deployment as claude-sonnet-5-5-provisioned, gives the team access to it, and adds a model alias on the team that maps claude-sonnet-5-5 to claude-sonnet-5-5-provisioned. Nothing changes in the team's code, their requests land on the provisioned capacity, and every other team keeps using the shared API.
Step by step
In the Admin UI
- Open
/ui/models-and-endpointsas a proxy admin and add the dedicated deployment under Add Model with its own public name,claude-sonnet-5-5-provisioned. - Open
/ui/teams, create or open the team, and addclaude-sonnet-5-5-provisionedto its Models. - In the team's Model Aliases section click Add New Alias, set the alias name to
claude-sonnet-5-5and the Target Model toclaude-sonnet-5-5-provisioned, and save. - For a tag based rule instead, add the tag under the team's Tags and make sure Enable Tag Filtering is on under
/ui/router-settings, Loadbalancing. - For a model only this team may see, select the team on the Add Model tab before saving. The deployment becomes a team scoped model and only the team's keys can list and call it.
With curl
model_list:
- model_name: claude-sonnet-5-5
spanway_params:
model: anthropic/claude-sonnet-5-5
api_key: os.environ/ANTHROPIC_API_KEY
- model_name: claude-sonnet-5-5-provisioned
spanway_params:
model: bedrock/us.anthropic.claude-sonnet-5-5
aws_region_name: us-east-1
curl -X POST http://localhost:4000/team/new \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{
"team_alias": "search-ranking",
"models": ["claude-sonnet-5-5-provisioned"],
"model_aliases": {"claude-sonnet-5-5": "claude-sonnet-5-5-provisioned"}
}'
Give a team a routing tag, or a model of its own.
curl -X POST http://localhost:4000/team/update \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"team_id": "<team_id>", "tags": ["eu-only"]}'
curl -X POST http://localhost:4000/model/new \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{
"model_name": "support-bot",
"spanway_params": {"model": "openai/ft:gpt-6.1-sol:acme::8x", "api_key": "os.environ/OPENAI_API_KEY"},
"model_info": {"team_id": "<team_id>"}
}'
To give a team access to model groups that already exist, add their names to the team's model list.
curl -X POST http://localhost:4000/team/model/add \
-H "Authorization: Bearer $SPANWAY_MASTER_KEY" -H "Content-Type: application/json" \
-d '{"team_id": "<team_id>", "models": ["claude-sonnet-5-5-provisioned"]}'
Expected result
Keys created for search-ranking that request claude-sonnet-5-5 are served by the provisioned Bedrock deployment, and the x-spanway-model-id response header names it. /team/info?team_id=<team_id> lists the alias under team_info.model_aliases. A team with the tag eu-only is routed to deployments carrying that tag on every model group. A team scoped support-bot shows up in /v1/models for the team's keys only, and two teams can each register their own support-bot without clashing.
The three mechanisms
| Mechanism | Set where | Use it when |
|---|---|---|
| Team model alias | model_aliases on the team | One model name should mean a different model group for one team. |
| Team tags | tags on the team, with enable_tag_filtering | One rule should apply to many model groups or to several teams. |
| Team scoped model | POST /model/new with model_info.team_id, or Add Model with a team selected | A team brings its own credentials or fine-tuned model that nobody else should see. |
Teams and keys can also carry their own router settings, such as fallbacks and retry counts, that override the global router_settings for their traffic. See key and team router settings.
| Method | Path | Summary |
|---|---|---|
| POST | /team/model/add | Add models to a team |
| POST | /team/model/delete | Remove models from a team |
Errors
| What you see | Why | Fix |
|---|---|---|
401 or 403 saying the key cannot access the model | The alias target is not in the team's Models. | Add the target model to the team. Aliases redirect, they do not grant access. |
| The alias has no effect | The key belongs to another team, or was created before the alias and caches the old team row. | Check the key's team on /ui/api-keys, and wait for the key cache to refresh or re-save the key. |
| Team tags do not route | Tag filtering is off, or no deployment carries the tag. | Turn on Enable Tag Filtering and tag a deployment, see tag routing. |
404 Team not found on /team/model/add | The team id is unknown. | Check the team id with /team/list. |
403 Only proxy admin or team admin can modify team models on /team/model/add | The key is neither a proxy admin nor an admin of that team. | Use a proxy admin key or a team admin's key. |
422 on /team/model/add | The body is missing team_id or models. | Send both, models as a list of existing model names. |
| A team scoped model is invisible to its own team | The key was issued before the model was added and still caches the team's model list. | Wait for the cache to refresh, or call /key/info to confirm the model list. |
Related
- Tag routing explains how team tags match deployments.
- Routing presets give a team a named bundle of models and preferences instead of an alias.
- Key and team router settings override retries and fallbacks per team.
- Teams page documents the Model Aliases section and the team form.