Skip to main content

Model management

A deployment is one model behind one public name, with its credential and limits. Deployments can live in config.yaml or be managed at runtime through the Admin UI and the API. Runtime management stores them in the database, encrypts their secrets, and makes every gateway instance pick them up on its next config reload, so adding a model never needs a restart.

What this is for​

Teams add new models often, usually the day a provider ships one. With runtime management an admin adds the deployment from the Admin UI, callers can use it within the reload interval, and a bad deployment can be paused during a provider incident and resumed afterwards without touching the config file. Deployments from config.yaml still work and are shown read only, so the file stays the source of truth for the ones you keep there.

Before you start​

Runtime management needs a database and STORE_MODEL_IN_DB=True in the environment, or general_settings.store_model_in_db: true. Instances pick up changes within general_settings.proxy_config_reload_interval_seconds. Proxy admins can manage any deployment, team admins can add deployments scoped to their own team, and internal users are refused when the disable_model_add_for_internal_users UI setting is on. A deployment scoped to a team (model_info.team_id) needs an Enterprise license for everyone, proxy admins included, and without one the gateway answers 403 with the license message. Admin viewers can read deployments but cannot add, change or delete them.

Scenario​

A provider releases a new fast model. The platform admin wants it available as claude-haiku-5-5 to everyone in the general access group, with 500 requests per minute, by the end of the standup. Later that week the provider has an incident, and the admin pauses the deployment for an hour rather than deleting it.

Steps​

  1. Add the deployment. In the Admin UI open Models + Endpoints, pick the Add Model tab, choose Anthropic as the Provider, pick the model under Spanway Model Name(s), set the Public Model Name in Model Mappings, choose the credential, open Advanced Settings and put {"rpm": 500} in Spanway Params, then click Add Model. 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-haiku-5-5",
    "spanway_params": {
    "model": "anthropic/claude-haiku-5-5",
    "api_key": "os.environ/ANTHROPIC_API_KEY",
    "rpm": 500
    },
    "model_info": {"description": "Fast model for classification", "access_groups": ["general"]}
    }'

    To reuse a stored credential instead of naming a key, put "spanway_credential_name": "anthropic-prod" in spanway_params, see setting provider credentials.

  2. Change a limit. On the Deployed Models tab click the model ID to open the detail view, click Edit on the Model Settings card, change the field and save. From the command line, PATCH /model/{model_id}/update changes only the fields you send:

    curl -X PATCH http://localhost:4000/model/9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8/update \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"spanway_params": {"rpm": 1000}, "model_info": {"description": "Raised limit"}}'

    POST /model/update does the same with the id in model_info.id:

    curl -X POST http://localhost:4000/model/update \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"model_info": {"id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8"}, "spanway_params": {"rpm": 1000}}'
  3. Pause it during an incident. On the Deployed Models tab turn off the pause switch in the row's Actions column, which shows "Model paused". Turn it back on later for "Model resumed". From the command line:

    curl -X POST http://localhost:4000/model/block \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"model_id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8"}'

    curl -X POST http://localhost:4000/model/unblock \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"model_id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8"}'
  4. Remove it when it is no longer needed. In the detail view click the delete button and confirm. From the command line:

    curl -X POST http://localhost:4000/model/delete \
    -H "Authorization: Bearer $SPANWAY_API_KEY" -H "Content-Type: application/json" \
    -d '{"id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8"}'

Expected result​

Step 1 returns the stored deployment. Keep model_id, it is what every later call refers to, and it is also shown in the Model ID column of the Deployed Models tab.

{
"model_id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8",
"model_name": "claude-haiku-5-5",
"spanway_params": {"model": "anthropic/claude-haiku-5-5", "api_key": "os.environ/ANTHROPIC_API_KEY", "rpm": 500},
"model_info": {
"id": "9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8",
"db_model": true,
"description": "Fast model for classification",
"access_groups": ["general"]
},
"blocked": false,
"created_at": "2026-11-20T09:12:00+00:00",
"created_by": "admin@example.com",
"updated_at": "2026-11-20T09:12:00+00:00",
"updated_by": "admin@example.com"
}

Within the reload interval, GET /v1/models on a key in the general access group lists claude-haiku-5-5. While the deployment is paused the row shows "blocked": true, the router skips it, and a request for the name fails if no other deployment serves it. Step 4 returns {"message": "Model: 9f1c2b3a-4d5e-6f70-8192-a3b4c5d6e7f8 deleted successfully"}.

Reading what is deployed​

RouteWhat it returns
GET /v1/modelsThe public model names the calling key may use, in the OpenAI listing shape.
GET /model/infoEvery deployment the caller may see, with secrets removed and pricing, mode and capability flags filled in from the price map.
GET /v2/model/infoThe same, paged, with search, sort and team filters, which is what the Deployed Models tab uses.
GET /model_group/infoOne entry per public name, combining the limits and prices of every deployment behind it.
GET /model/deprecationsDeployed models with a deprecation date in the price map, bucketed by urgency.
curl "http://localhost:4000/model_group/info?model_group=claude-haiku-5-5" -H "Authorization: Bearer $SPANWAY_API_KEY"

Config file and database together​

Deployments from config.yaml and from the database are merged at load time. Config file deployments are read only in the Admin UI and refuse /model/update, /model/block and /model/delete, so the file stays the source of truth for them. general_settings.supported_db_objects controls which kinds of objects are loaded from the database. See configuration for every model_list field.

Errors​

What you seeWhyFix
500 No DB Connected. or Set 'STORE_MODEL_IN_DB='True' in your env to enable this feature.Runtime management is off.Set DATABASE_URL and STORE_MODEL_IN_DB=True, then restart.
403 Model creation is disabled for internal users by disable_model_add_for_internal_users.An internal user tried to add a model while the UI setting forbids it.Ask a proxy admin, or turn the setting off.
400 Can't edit model. Model in config. or Cannot edit config-based model.The deployment comes from config.yaml.Edit the file and reload, or recreate the deployment with /model/new.
400 spanway_params is required. Send the deployment's spanway_params, or use PATCH /model/{model_id}/update. from /model/update/model/update replaces a stored deployment's parameters, so the body must carry spanway_params.Send the full spanway_params, or use PATCH /model/{model_id}/update to change a few fields.
400 Model with id=... not found in db from /model/deleteThe id is wrong or the deployment was already deleted.Copy the Model ID from the Deployed Models tab.
404 Model <id> not found on proxy. from /model/update, PATCH /model/{model_id}/update, /model/block or /model/unblockThe id does not match a loaded deployment.Check the id and wait for the reload interval after adding.
400 model_info.id is required. Send the id of the deployment to update./model/update was sent without model_info.id.Send the deployment id.
400 Model updates only supported for DB-stored modelsPATCH /model/{model_id}/update on a gateway without STORE_MODEL_IN_DB.Set STORE_MODEL_IN_DB=True.
400 Credential '<name>' not found. Create it via /credentials before attaching it to a model.spanway_credential_name names a credential that does not exist.Create it on Models + Endpoints, LLM Credentials, first.
400 spanway_credential_name cannot be an empty string. ...The credential name was sent as "".Send null to detach it, or leave the field out.
400 Team id=<id> does not exist in dbmodel_info.team_id names a team that does not exist.Check the team id on the Teams page.
403 with the Enterprise license messageThe deployment is scoped to a team and the gateway has no license.Add a license, or leave team_id out.
403 Team ID=<id> does not match the API key's team ID=<id>, OR you are not the admin for this team. ...A team admin tried to manage another team's deployment.Use a key of that team's admin, or a proxy admin key.
403 User does not have permission to make this model call. ...An internal user tried to manage a deployment without naming their own team.Set model_info.team_id to a team you administer, or ask a proxy admin.
403 Only a proxy admin can attach a stored credential (spanway_credential_name) on a model. or Only a proxy admin can set aws_session_tags on a model.Those fields decide which secrets a deployment uses.Ask a proxy admin.
403 View-only users cannot manage models. or user not allowed to access this route, role= proxy_admin_viewer. ...An admin viewer tried to change a deployment.Use a proxy admin key.
403 Only a proxy admin can delete a model whose team has been deleted.The deployment's team is gone.Ask a proxy admin.
409 This auto router changed. Reload it before updating. or This auto-router name is already used by a model.Someone else saved the auto router meanwhile, or its name is taken.Reload the page and try again, or pick another name.
403 Only proxy admins can change a model's blocked flag.A team admin or internal user tried to pause a deployment.Ask a proxy admin.
The new model is missing from GET /v1/modelsThe key is not in the deployment's access group, or the reload interval has not passed yet.Check model_info.access_groups against the key, and wait for proxy_config_reload_interval_seconds.
Test Connect fails before you saveThe credential or model name is wrong for the provider.Read the error in Connection Test Results, fix the field and test again.

Audit​

Every add, change and delete writes an audit row on Spanway_ProxyModelTable with the deployment id, who made it and the values before and after, with secrets masked. Pausing from the Admin UI goes through PATCH /model/{model_id}/update, so it is recorded as updated with blocked: true, while /model/block and /model/unblock record blocked and unblocked. Deleting a team deletes its deployments and writes one deleted row for each. See audit logs.

Logs​

LevelMessageMeaningAction
ERRORspanway.proxy.proxy_server.update_model(): Exception occured - <reason>A /model/update call failed. The caller got the reason.Read the reason and fix the request.
ERRORError in patch_model: <reason>A PATCH /model/{model_id}/update call failed.The same.
ERRORError in model <id>: <reason>Blocking or unblocking failed.Check the id and the database.
ERRORError updating public model groupsSaving the AI hub list failed.Check the database and retry.

Run the gateway with --detailed_debug to see each reload of the model list.