general_settings reference
general_settings in config.yaml configures the gateway process itself rather than models or the SDK. This page lists every key the gateway validates, in the order the configuration model declares them. Keys without a default are unset, which means the feature is off or the gateway's built in behaviour applies. Several keys can also be changed at runtime from the Admin UI when store_model_in_db is on, in which case the value stored in the database is merged over the file at startup. The environment variables the gateway reads before it loads this file, such as the database connection and the config bucket, are on environment variables.
A real-world scenario
An operator is asked why requests over 20 MB are refused and whether the limit can be raised for one team. She searches this page for max_request_size_mb, sees that it is a general_settings key with its default, and that it applies to every request. She changes it in the config, validates the file, rolls the gateway and confirms the new value on the Router Settings page, where the General tab shows the new value with the In Config badge.
Request handling and capacity
| Key | Type | Default | Meaning |
|---|
completion_model | string | unset | Sends every chat completions, text completions, Responses, Anthropic Messages, Gemini generateContent and search call to this model, whatever model the caller named. Use it to pin a whole gateway to one model, for example during an incident. It does not touch OCR, image, video, audio, embedding or file calls. Unset, each call uses the model it names. |
moderation_model | string | unset | Sends every /v1/moderations call to this model, whatever model the caller named. Unset, the caller's model is used. |
image_generation_model | string | unset | Model for /v1/images/generations and /v1/images/edits calls when neither the CLI --model nor the deployment path names one. It replaces the caller's model, so set it only to pin every image call to one model. |
dangerously_allow_mock_testing_request_params | bool | false | Lets callers send mock_testing_fallbacks, mock_testing_context_fallbacks, mock_testing_content_policy_fallbacks, mock_testing_rate_limit_error, mock_timeout and mock_delay to force a fake failure or delay, which helps a developer test fallbacks on a staging gateway. Off, a request with any of them is refused with 400 Mock testing request params are disabled on this proxy: ..., so nobody can make a production gateway fail on purpose. It can only be set in config.yaml, never from the Admin UI or the API. Leave it off in production. |
max_in_flight_requests_per_worker | int | unset | Turns on admission control, which protects a busy gateway by making extra requests wait briefly or get a quick 503 instead of piling up and slowing everyone down. The number is how many requests one worker runs at once. Unset, admission control is off and every request is accepted. A change applies on the next request, no restart needed. See admission control. |
max_queued_requests_per_worker | int | same as in flight | How many requests may wait for a free slot. Once that many wait, new ones get 503 overloaded_error with Retry-After. Only used while admission control is on. |
admission_queue_timeout_seconds | float | 1.0 | How long a waiting request waits for a slot before it gets 503. Only used while admission control is on. |
max_parallel_requests | int | unset | Parallel requests allowed per key. |
global_max_parallel_requests | int | unset | Parallel requests allowed per gateway instance. |
fail_closed_rate_limit_enforcement | bool | true | Return 503 while the Redis rate limit and session limit counters are unreachable. Set false to enforce limits per instance from memory during a Redis outage instead. Redis is required for exact limits across replicas. |
fail_closed_budget_enforcement | bool | true | Return 503 when a key, team, user, org or model budget cannot be verified because Redis or the database is unavailable. Only an explicit false turns this off and admits those requests on the per instance spend instead. |
disable_fallbacks_on_per_model_rate_limits | bool | unset | A request rejected by a per model key, team, organization or project rate limit returns 429 instead of trying fallbacks. |
expose_fallback_errors_to_caller | bool | unset (off) | Lets a caller see why each fallback hop failed. When on, a request that sends include_fallback_errors: true gets the upstream error text of each failed hop in the x-spanway-fallback-errors header, which helps a developer debug a failing model group. That text can reveal provider names, regions and account details, so leave it off for gateways that serve outside teams. When off, the field is ignored and the header is never sent. See routing decision headers. |
max_request_size_mb | int | 100 | Reject request bodies above this size with a 413 before auth reads them, file uploads included. Raise it for larger uploads, or set 0 to turn the limit off. |
max_response_size_mb | int | unset | Reject responses above this size. |
cancel_on_disconnect | bool | unset | Cancel the upstream call when the client disconnects, logging a 499. |
pass_through_request_timeout | float | 600 | Upstream timeout for native and custom pass-through endpoints. |
responses_websocket_session_limit_seconds | float | 3600 | Lifetime of a Responses API WebSocket session, between 60 and 7200. |
enable_openai_websocket_passthrough | bool | unset | Serve the OpenAI pass-through WebSocket route. |
pass_through_endpoints | list | unset | Custom pass-through endpoints, see pass-through. |
pass_through_env_var_allowlist | list of strings | unset | Environment variables that pass-through endpoints created through the API or Admin UI may read with os.environ/NAME in their headers. Unlisted references are refused with a 400 on create and update and dropped at load time. Endpoints in config.yaml can read any variable, see pass-through. |
transcribe_media_buckets | list of strings | unset | S3 buckets non admin keys may use through the Amazon Transcribe pass-through. |
missing_session_id | generate, reject or omit | unset | What to do with requests that carry no session id. |
include_call_id_in_error_body | bool | unset | Copy the x-spanway-call-id header value into JSON error bodies. |
infer_model_from_keys | bool | unset | Have /models infer available models from provider keys in the environment. |
model_list_healthy_only | bool | unset | Hide models whose deployments are all unhealthy from /models and /model/info. Needs background_health_checks. |
forward_client_headers_to_llm_api | bool | unset | Forward client headers such as Authorization to the provider, needed for Claude Code with a subscription. |
reject_clientside_metadata_tags | bool | unset | Refuse requests that set their own tags in metadata.tags, the top-level tags field or the x-spanway-tags header, with a 400. On: tags only come from the key and the team, so a caller cannot reach another tier's deployments or spend another tag's budget. Off: callers may add tags, which suits internal tools that label their own traffic. See tag routing. |
code_traffic_user_agent_prefixes | list of strings | unset | Extra User-Agent prefixes, matched without regard to case, that mark a request as code traffic for data policies with restrict_code_traffic, see code traffic. |
The environment variable INSPECT_RPM_LIMIT (default 60) sets how many request inspector dry runs each key may send per minute to POST /v1/inspect. A key with its own rpm_limit below that number gets its own limit instead. Raising it lets a developer or a CI job check more request bodies a minute, and lowering it keeps dry runs, which still run guardrails and may call a billed guardrail service, from adding load. Over the limit, the route answers 429 with a retry-after header. When a proxy admin dry runs on behalf of another key with inspect_as_key, the call counts against the admin's own allowance, not the inspected key's. Set it in the gateway's environment and restart.
Native execution
This is an environment variable on the gateway container, not a config key. A change needs a restart.
| Variable | Default | Meaning |
|---|
SPANWAY_RUST | unset (off) | Turns on the compiled fast path for the routes the rollout table marks "Opt in", today Anthropic Messages calls to Anthropic, DeepSeek and Claude on Vertex AI, plus log redaction. On, those provider calls are built, sent and decoded by the compiled extension, and the answer carries the x-spanway-rust: true header. A request the extension cannot handle quietly falls back to Python with the same answer. Off, every opt in route stays on Python. Routes marked "Required" (OCR and Bedrock transcription) use the extension either way and "Python only" routes never do. 1, true, yes and on turn it on, 0, false, no and off turn it off, anything else counts as unset. Auth, routing, limits, guardrails, logging and spend do not change, so there is no cost and little risk, but measure before expecting lower latency. The platform operator sets it. See Rust execution paths. |
Files and batches
| Key | Type | Default | Meaning |
|---|
max_file_size_mb | int | unset | Largest upload, in MB, accepted on /v1/files for any purpose and on container file uploads. A larger upload is refused with 413 before anything reaches the provider, which keeps one oversized file from filling provider storage. Unset means no gateway limit, only the provider's. |
max_batch_file_size_mb | int | unset | Largest batch input file. |
max_batch_file_records | int | unset | Records per batch input file, per key. Key metadata may override it and team metadata adds a team cap. |
max_batch_file_uploads_per_day | int | unset | Batch uploads per key per UTC day, with the same key and team overrides. |
max_file_downloads_per_minute | int | unset | GET /v1/files/{id}/content calls per key per file per minute. |
allowed_file_extensions | list of strings | unset | The only extensions accepted on upload. An empty list rejects every upload. |
blocked_file_extensions | list of strings | unset | Extensions rejected on upload. Deprecated in favour of the allow list but still enforced after it. |
track_unmanaged_batch_cost | bool | false | On also records the cost of batches created with a raw provider id, not only those created through managed files or a model_list model. Off leaves those batches out of spend. See batch cost tracking. |
proxy_batch_polling_interval | int, seconds | 3600 | How often the batch cost job runs. Lower values show batch spend sooner and add database load. The environment variable PROXY_BATCH_POLLING_INTERVAL sets the same default. |
Batch behaviour that is set in the environment and read at startup:
| Environment variable | Default | Meaning |
|---|
PROXY_BATCH_POLLING_ENABLED | true | false turns the batch and response cost jobs off. Batch spend is then never recorded, which only suits a gateway that runs no batches. |
MAX_OBJECTS_PER_POLL_CYCLE | 50 | How many open batches one run of the cost job checks. |
MANAGED_OBJECT_STALENESS_CUTOFF_DAYS | 7 | Batches still open after this many days are marked stale and no longer polled. |
SPANWAY_EXECUTED_BATCH_CONCURRENCY | 4 | How many lines of one batch that runs inside the gateway are sent at the same time. Higher finishes sooner and loads the model server more. |
Two spanway_settings keys change batch routing: enable_loadbalancing_on_batch_endpoints (off) spreads batches for a model across its deployments, and require_managed_files (false) refuses raw provider file and batch ids, see routing a batch.
Top-level blocks of config.yaml that hold provider credentials for these routes:
| Block | Default | Meaning |
|---|
files_settings | unset | A list of provider entries, each with custom_llm_provider and its credentials (api_key, api_base, and the provider's own fields), used for /v1/files and /v1/batches when no managed file or model names the provider. os.environ/ values are resolved. See batches. |
finetune_settings | unset | The same shape for fine-tuning jobs, see fine-tuning. |
assistant_settings | unset | custom_llm_provider and spanway_params for the Assistants API, see assistants. |
search_tools | unset | The search tools keys can call, each with search_tool_name, spanway_params (search_provider, api_key, api_base, timeout, max_retries) and an optional search_tool_info.description, see search. |
The environment variable SPANWAY_BUILTIN_PASS_THROUGH_ROUTES_FIRST (default false) decides who wins when a custom pass-through endpoint uses the same path as a built-in provider route. Off, the custom route wins, which lets you override a provider route on purpose. On, the built-in route wins, which keeps a stray custom endpoint from taking over a provider route. Set it in the gateway environment and restart.
Authentication and keys
| Key | Type | Default | Meaning |
|---|
master_key | string | unset | The admin key every management call needs. |
dangerously_permit_weak_or_unset_master_key | bool | unset | Local development only. Start without a master key or with a known default. With no master key, every request is accepted without authentication. Without this setting, a missing master key refuses every request. |
custom_auth | string | unset | Path to your own authentication function, see custom auth. |
custom_auth_run_common_checks | bool | false | Off means your custom auth function alone decides what a caller may do. On applies the budgets, model lists, rate limits and IP lists stored in the gateway as well. Turn it on unless your function does every check itself. |
custom_auth_settings.mode | on, off or auto | on | on runs your function on every request, off skips it so only virtual keys work, auto falls back to virtual key checks when your function raises, see custom auth. |
custom_key_generate, custom_key_update, custom_key_policy, custom_team_metadata_validate | string | unset | module.function paths to your own checks on key creation, key updates, key policy and team metadata. Unset means the gateway's own rules only. |
enable_jwt_auth, spanway_jwtauth | bool, object | unset | Accept identity provider JWTs, see JWT authentication. These keys are accepted under general_settings and the model does not list them. |
enable_oauth2_auth | bool | false | On checks opaque OAuth2 tokens against OAUTH_TOKEN_INFO_ENDPOINT on inference, info and Lens routes. Off treats every bearer token that is not a JWT as a virtual key. Enterprise, see OAuth2 auth. |
enable_oauth2_proxy_auth, oauth2_config_mappings | bool, map | false, unset | On reads the caller's identity from headers a trusted reverse proxy sets, mapped by oauth2_config_mappings. Only peers inside trusted_proxy_ranges are trusted. Enterprise. |
enforce_user_param | bool | false | On refuses OpenAI style requests that do not send the user field, with 'user' param not passed in, so every call is tied to a customer. Off lets requests without a customer through. |
allowed_routes | list | unset | Gateway wide list of routes, as exact paths, * wildcards such as /anthropic/*, or route group names such as llm_api_routes. Every other route is refused with 403 for every caller, proxy admins and the master key included, so list the admin routes you need too, see allow-lists. |
allowed_ips, use_x_forwarded_for | list, bool | unset | Client addresses allowed to call the gateway, see allow-lists. X-Forwarded-For is only read from peers inside trusted_proxy_ranges, use_x_forwarded_for alone leaves the peer address in charge. Enterprise. Accepted under general_settings without being listed in the model. |
user_api_key_cache_max_size | int | 200 | Entries each worker keeps in its in memory auth cache. |
user_header_name | string | unset | Deprecated. Header whose value is the end user id. |
user_header_mappings | list | unset | Headers that identify the caller, each with header_name and the role it applies to, see customers. |
key_management_system | string | unset | Secret manager that loads and decrypts keys, see secret managers. |
key_management_settings.hosted_keys | list of strings | unset | The os.environ/ names looked up in the secret manager. Unset sends every name there. |
key_management_settings.access_mode | read_only, write_only or read_and_write | read_only | Whether the gateway reads secrets, writes virtual keys, or both. Writing, rotating and deleting stored virtual keys needs a write mode. |
key_management_settings.store_virtual_keys | bool | false | On writes each new virtual key to the secret manager under prefix_for_stored_virtual_keys plus the key alias. Needs a write access mode. |
key_management_settings.prefix_for_stored_virtual_keys | string | spanway/ | Where stored virtual keys go in the secret manager. |
key_management_settings.primary_secret_name | string | unset | Read every secret from one secret that holds a JSON object. |
key_management_settings.description, tags, kms_key_id | string, map, string | unset | Description, tags and customer managed encryption key for secrets the gateway writes. |
key_management_settings.custom_secret_manager | string | unset | The class used when key_management_system is custom. |
key_management_settings.aws_region_name, aws_role_name, aws_session_name, aws_external_id, aws_profile_name, aws_web_identity_token, aws_sts_endpoint | string | unset | How the gateway signs in to AWS Secrets Manager, for example by assuming a role, see secret managers. |
key_management_settings.replica_regions | list of strings | unset | Extra AWS regions each new secret is copied to. |
use_google_kms | bool | unset | Decrypt keys with Google KMS. |
use_azure_key_vault | bool | unset | Load keys from Azure Key Vault. |
disable_budget_reservation | bool | unset | Turn off the optimistic per request budget reservation. Weakens hard budget enforcement under concurrency. |
apply_user_budget_to_team_keys | bool | unset (off) | Off: a user's personal max_budget only counts spend on keys that belong to no team, so team keys are capped by the team's and the key's budgets instead. On: the personal budget also stops requests made with that user's team keys, which helps when one person must never spend past a fixed amount whatever team they work in. |
disable_custom_api_keys | bool | false | On: nobody may choose their own key value, every key is generated by the gateway, and a request that sends key is refused with 403. Off: callers may bring their own sk- value of at least 16 characters (the MINIMUM_CUSTOM_KEY_LENGTH environment variable changes the minimum). Also on Settings, UI Settings. |
disable_key_generate_for_org_admin | bool | false | On: organization admins cannot create keys with /key/generate and get 403 key generation is disabled for org admins. Contact your proxy admin., for example when keys must come from one central process. Off: organization admins may create keys for teams in their organization. |
disable_team_admin_delete_team_user | bool | false | On: team admins cannot remove members from the teams they manage, in the Admin UI or through /team/member_delete and the bulk member delete route, which answer 403. Useful when SCIM owns team membership. Off: team admins may remove members. Proxy admins are never limited. Also on Settings, UI Settings. |
team_admin_editable_team_fields | list | empty | What team admins may change on teams they administer. Empty means team admins edit no team setting. Accepted values are tpm_limit, rpm_limit, max_budget, raise_max_budget (let them raise the team budget, never above the organization's), projects (create and update projects in their teams) and member_key_budgets (budgets on other members' keys). Unknown names in the config file are ignored with a warning. Saving it with POST /config/field/update stores it with the UI settings, the same as the Admin UI, so it takes effect at once, and a name the gateway does not support (such as models) or raise_max_budget without max_budget is refused with 400. Also on Settings, UI Settings, see access control. |
team_metadata_schema | list | unset | Team metadata fields the Create Team form asks for, each as {key: <name>, label: <shown name>}, for example [{key: cost_center, label: Cost center}]. Unset means the form shows only the free-form metadata box. A duplicate key stops the config from loading. It only shapes the form, to enforce values use custom_team_metadata_validate. |
enforce_project_model_quota | bool | false | On: every model on a project needs a positive model_rpm_limit and model_tpm_limit, and entries that expand at request time (wildcards, access groups, all-team-models) are refused, so no project can call a model without a cap. Off: per-model limits are optional. |
enable_projects_ui | bool | false | Stored with the Admin UI settings rather than in the file, and switched with [BETA] Enable Projects on Settings, UI Settings. On: the Admin UI shows the Projects page and the Project field on keys. Off: those screens are hidden, while existing projects keep their budgets and limits. Enterprise. |
enforce_fallback_model_access | bool | unset | Only attempt fallbacks the calling key may use. |
vector_store_deny_by_default | bool | false | A vector store must be granted explicitly in object_permission.vector_stores. |
search_tool_deny_by_default | bool | false | A search tool must be granted explicitly in object_permission.search_tools. |
egress_allowlist | list | unset | Hosts, *. wildcard suffixes and CIDRs the gateway may connect to. Every other outbound connection is refused, see egress allowlist. |
server_tools | object | unset | Gateway-run spanway: tools for chat completions, their per-request limits and the web fetch domain lists, see server tools. Every tool is off until it is listed in enabled_tools and granted in object_permission.server_tools. |
disable_responses_id_security | bool | unset | Stop enforcing ownership of Responses API ids. Removes tenant isolation on /v1/responses. |
allow_unmanaged_response_ids | bool | unset | Let keys address response ids the gateway did not issue. |
trusted_proxy_ranges | list of CIDRs | unset | The address ranges of the load balancers in front of the gateway, so it can see each caller's real address. Set to those ranges, the gateway believes the X-Forwarded-For header only from them, and per caller limits, IP allow lists, the sign-in throttle and the spend logs use the real caller's address. Set to [], it believes no forwarding header and uses the address that connected, which is right only when callers connect directly. Left unset, the per address sign-in limit stays off, allowed_ips checks the connecting address and the website assistant refuses every request with 503 until it is set. It also names the proxies allowed to supply identity headers. Change it as a proxy admin in Settings > Admin Settings > Security Settings, Trusted reverse proxies. See security settings and allow-lists. |
require_mfa_for_password_login | bool | false | Require an authenticator app code for every Admin UI username and password sign-in, see two-factor sign-in. |
key_hygiene | object | unset | Policy for the key hygiene report: unused_days (90), rotation_max_age_days, exempt_team_ids, auto_expire ({mode: off} or {mode: unused, grace_days: 7}), max_lifetime_days and expiry_notice_days ([30, 1]), see leaked keys and key expiry. Enterprise. |
provider_url_destination_allowed_hosts | list of strings | unset | Hosts a request may redirect a provider call's destination URL to. |
deployment_url_allowed_hosts | list of strings | unset | Internal hosts that team admins may point a deployment's api_base or other endpoint URL at, over http or https. Entries are hostname, hostname:port or an origin. Proxy admins are not restricted. |
user_url_validation | bool | true | Master switch for the SSRF guard on user supplied URLs such as image_url, file_url and MCP or OpenAPI spec URLs. |
user_url_allowed_hosts | list of strings | unset | hostname or hostname:port entries that skip the blocked network check but still resolve DNS. |
Customers
These keys live under spanway_settings.
| Key | Type | Default | Meaning |
|---|
max_end_user_budget_id | string | unset | A budget from the Budgets page that applies to every customer without a budget of their own, so one runaway end user cannot spend without limit. Unset means such customers have no gateway budget, see customers. |
max_end_user_budget | float | unset | Not applied. Use max_end_user_budget_id instead. |
blocked_user_list | list or file path | unset | Customer ids refused at request time when the blocked_user_check callback is on. Unset means no id is blocked by the config file. Database blocks from /customer/block work without it. |
budget_exceeded_status_code | int | 422 | Also applies to customer budgets. Described once under users, keys and budgets. |
enable_post_custom_auth_checks | bool | false | On runs the gateway's key expiry and customer budget and block checks on the identity your custom auth function returns. |
Identity provider environment variables
These are environment variables, not config keys. A change needs a restart unless the SSO settings are saved from the Admin UI, which applies them at once.
| Variable | Default | Meaning |
|---|
JWT_PUBLIC_KEY_URL, JWT_AUDIENCE, JWT_ISSUER | unset | Where the JWT signing keys are and which audience and issuer tokens must carry, see JWT auth. Set at least the audience, or any token from the provider is accepted. |
OAUTH_TOKEN_INFO_ENDPOINT, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET | unset | The introspection or token info endpoint and the client that may call it, see OAuth2 auth. |
OAUTH_USER_ID_FIELD_NAME, OAUTH_USER_ROLE_FIELD_NAME, OAUTH_USER_TEAM_ID_FIELD_NAME | sub, role, team_id | Fields of the introspection answer that name the user, role and team. |
GOOGLE_CLIENT_ID, MICROSOFT_CLIENT_ID, MICROSOFT_TENANT, GENERIC_CLIENT_ID and their _CLIENT_SECRET | unset | The Admin UI sign-in provider, see Admin UI SSO. Setting one turns SSO on. |
GENERIC_AUTHORIZATION_ENDPOINT, GENERIC_TOKEN_ENDPOINT, GENERIC_USERINFO_ENDPOINT, GENERIC_SCOPE | unset | Endpoints and scopes of a generic OIDC provider. |
GENERIC_USER_PROVIDER_ATTRIBUTE | provider | Field of the user info answer that names the provider. |
GENERIC_USER_EXTRA_ATTRIBUTES | unset | Comma separated user info fields copied onto the user. |
GENERIC_INCLUDE_TOKEN_CLAIMS | false | On also reads identity from the ID token's claims, not only the user info answer. |
SAML_IDP_METADATA_URL, SAML_IDP_METADATA_XML, SAML_SP_ENTITY_ID | unset | SAML sign-in for the Admin UI. One of the metadata settings turns it on. |
SAML_ALLOW_UNSOLICITED | false | On accepts sign-ins started from the identity provider's app tile. It also opens the door to login forgery, so leave it off unless people need the tile. |
SAML_STRICT, SAML_IDP_METADATA_VALIDATE_CERT | true | Keep SAML responses strictly checked and the metadata certificate validated. Turn off only to debug a test identity provider. |
SAML_AUTHN_REQUESTS_SIGNED | false | On signs the sign-in requests the gateway sends, for identity providers that require it. |
SAML_SP_NAME_ID_FORMAT | urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress | The name id format the gateway asks for. |
PROXY_ADMIN_ID | unset | The user id that is made a proxy admin when they sign in. This is the only setting that promotes someone through SSO. |
PROXY_BASE_URL | unset | The public address of the gateway, used to build the sign-in callback. |
ALLOWED_EMAIL_DOMAINS | unset | Comma separated email domains allowed to sign in through SSO. Unset allows every domain the provider signs in. |
SPANWAY_UI_SESSION_DURATION | 24h | How long an Admin UI session lasts before signing in again. |
SPANWAY_CLI_JWT_EXPIRATION_HOURS | 24 | How long a spanwayctl login session lasts before the developer signs in again, see CLI sign-in. A shorter time limits how long a stolen laptop's session works, a longer one means fewer sign-ins. CLI_JWT_EXPIRATION_HOURS is an older name for the same setting and wins when both are set. Set by the operator on the gateway. |
CLI_SSO_CLAIM_MAP | unset | Identity provider claims copied into the user's metadata at CLI sign-in. |
PKCE_STRICT_CACHE_MISS | false | On refuses a sign-in whose PKCE verifier is missing from the cache instead of continuing without it. Turn it on when every replica shares Redis. |
ENABLE_SSO_DEBUG | false | On serves /sso/debug/login and /sso/debug/callback, which show what the provider sends and need no sign-in. Turn it on only while debugging and never on a public gateway. |
Admin UI sign-in
| Key | Type | Default | Meaning |
|---|
ui_access_mode | admin_only, all or an object | all | Who may sign in to the Admin UI. The object form restricts sign-in to an SSO group, see team SSO. |
max_failed_login_attempts_per_source | int | 10 | Failed sign-ins allowed from one source address within the window. Half of it applies per username from that address. The per address limit only runs when trusted_proxy_ranges is set. |
max_failed_login_attempts_per_source_overrides | map of address or CIDR to int | unset | Per address overrides. 0 exempts the address. |
failed_login_window_seconds | int | 60 | Fixed window over which failures are counted. |
failed_login_block_seconds | int | 300 | How long a blocked address, or address and username, stays blocked. |
password_policy_min_length | int | 12 | Minimum password length for local users, never below 8. |
password_policy_require_uppercase | bool | true | Require an uppercase letter. |
password_policy_require_lowercase | bool | true | Require a lowercase letter. |
password_policy_require_numbers | bool | true | Require a digit. |
password_policy_require_special_characters | bool | true | Require a non alphanumeric character. |
password_policy_check_breached_passwords | bool | true | On refuses a new password that appears in a public breach list, so users cannot pick a password criminals already hold. Only the first five characters of the password's hash leave the gateway. Off makes no outside lookup, which some privacy rules require, but accepts leaked passwords. Air-gapped mode always skips it. Also Refuse passwords found in data breaches on the Sign-in protection card. |
disable_password_login_when_sso_enabled | bool | unset | With SSO configured, turn off username and password sign-in. |
disable_env_credential_login | bool | unset | Turn off sign-in with UI_USERNAME and UI_PASSWORD or the master key. Create a password admin first. |
allow_cli_sso_verification_uri_complete | bool | unset | Pre-fill the user code in the browser for the CLI device flow. |
hide_default_credentials_hint | bool | false | Hides the Default Credentials notice on the sign-in page, which tells a first-time admin to sign in with admin and the master key. Turn it on once real admins exist, so the page does not hint at the default account. The notice is also hidden when UI_PASSWORD is set or SPANWAY_HIDE_DEFAULT_CREDENTIALS_HINT=true. |
control_plane_url | string | unset | The control plane that manages this instance, see control plane. |
plugins | list | unset | External services embedded in the Admin UI, see UI plugins. |
Environment variables for the Admin UI and its sign-in, set on the gateway container:
| Variable | Default | What it does |
|---|
UI_USERNAME | admin | Username of the built-in admin account. |
UI_PASSWORD | the master key | Password of the built-in admin account. Setting it also hides the default credentials notice. |
DISABLE_ADMIN_UI | false | true stops serving the Admin UI, the sign-in page shows Admin UI Disabled. The API keeps working. |
AUTO_REDIRECT_UI_LOGIN_TO_SSO | false | true sends the sign-in page straight to SSO, so users never see the password form. It is skipped while any organization has its own SSO, so users can pick it. |
SPANWAY_HIDE_DEFAULT_CREDENTIALS_HINT | false | true hides the Default Credentials notice, like hide_default_credentials_hint. |
SPANWAY_UI_API_DOC_BASE_URL | unset | The base URL the API Reference page puts in its code samples, useful when developers reach the gateway at another address than the Admin UI. Unset, the samples use PROXY_BASE_URL, or the placeholder <your_proxy_base_url> when that is unset too. |
PROXY_LOGOUT_URL | unset | Where Logout sends the browser after the session is revoked, for example your SSO provider's sign-out page. Unset, it returns to the sign-in page. |
PROXY_BASE_URL | unset | The public address of the gateway, used in SSO redirects and links in emails. |
SERVER_ROOT_PATH | unset | A path prefix when the gateway is served under one, such as /spanway. |
SERVER_ROOT_PATHS | unset | Several path prefixes, comma separated, such as /gateway,/ai, for a gateway reached under more than one prefix. Each request uses the longest prefix its path starts with, so links and redirects keep the prefix the user came in on. Entries must start with /, and a bare / is ignored with a warning. Unset means only SERVER_ROOT_PATH applies. |
SPANWAY_DISABLE_LOGIN_RATE_LIMIT | false | true turns the failed sign-in lockout off, so password guessing is no longer slowed down. Use it only in tests. |
SPANWAY_ENABLE_HSTS | false | true adds Strict-Transport-Security: max-age=31536000; includeSubDomains to every response, so browsers use only HTTPS for the gateway's domain and its subdomains for a year. Turn it on only when all of them are served over HTTPS, see response security headers. |
DOCS_URL | / | Moves the interactive API docs page to another path. NO_DOCS=true removes it, unless DOCS_URL is set. |
SPANWAY_PUBLIC_API_DOCS | false | true shows the interactive docs, /openapi.json and /routes to anonymous callers. Off, only signed-in users see them and everyone else gets 404. Leave it off on any gateway with a public address, see API docs and build details. |
License
| Setting | Type | Default | Meaning |
|---|
SPANWAY_LICENSE | environment | unset | The Enterprise license key. Unset runs the free Starter tier. Set, the gateway verifies it offline and turns on the features it lists. An invalid or expired key is treated as no license. Keep it in your secret store, it is never logged. |
spanway_license | general setting | unset | The same key from the config file or the database. Once a config load reads it, it replaces SPANWAY_LICENSE. Prefer the environment variable, because config files often end up in version control. |
DOCS_TITLE, DOCS_DESCRIPTION | environment | Spanway API and the default text | With a license, the title and description of the API explorer at /. |
DOCS_FILTERED | environment | False | With a license, True shows only the OpenAI-compatible inference routes in the API explorer and hides management routes from your developers. |
Air-gapped mode and releases
| Variable | Default | What it does |
|---|
SPANWAY_AIRGAPPED | unset | true, 1 or yes turns off every optional outbound fetch, such as the price map refresh, the Admin UI blog feed and the breached-password lookup, and serves the copies bundled in the image. Use it on a network with no internet route. Off, the gateway fetches those updates, see air-gapped deployment. |
USE_V2_MIGRATION_RESOLVER | true | On uses the migration resolver that keeps two gateway versions from fighting over the schema during a rolling upgrade. false switches back to the older resolver, which only makes sense when support asks for it, see release cycle. |
SPANWAY_RELEASE_CHECK_URL | unset | The address of a release feed, a JSON object with tag_name, html_url and body as the upgrade notice page describes. Set, the Admin UI shows an upgrade notice when a newer release is out. Unset, the gateway checks for no new release and shows no notice, see upgrade notice. |
FIPS mode
| Key | Type | Default | Meaning |
|---|
SPANWAY_FIPS_MODE | environment variable, bool | true in the spanway-ai-fips image, unset elsewhere | On makes the gateway use only FIPS approved algorithms (PBKDF2 passwords, AES-256-GCM secrets) and refuse to start unless OpenSSL enforces FIPS and TLS certificate checks are on. Off keeps the standard behaviour. Leave it as the image sets it, see the FIPS 140-3 image. |
Database
The database can also be given through environment variables, which is how the charts and the Terraform stacks do it: DATABASE_URL or the DATABASE_HOST, DATABASE_PORT, DATABASE_USER, DATABASE_NAME parts, the _READ_REPLICA variants, IAM_TOKEN_DB_AUTH for AWS IAM sign-in, and SPANWAY_PGBOUNCER_ENABLED, SPANWAY_PGBOUNCER_MAX_DB_CONNECTIONS and SPANWAY_PGBOUNCER_MAX_CLIENT_CONN for the bundled PgBouncer. Environment variables gives each one's default and what it does.
| Key | Type | Default | Meaning |
|---|
database_url | string | unset | Postgres connection string, needed for keys, spend and everything stored. |
database_connection_pool_limit | int | 10 | Connection pool size. |
database_connection_timeout | float | 60 | Timeout to obtain a connection. |
database_connect_timeout | float | unset | Prisma connect_timeout in seconds. |
database_socket_timeout | float | unset | Abort an operation that has produced no data within this many seconds. |
database_max_idle_connection_lifetime | float | 60 | Close pooled connections idle longer than this, before load balancers drop them. |
database_extra_connection_params | map | unset | Extra query parameters appended to the database URL, such as sslmode. |
database_disable_prepared_statements | bool | unset | Set Prisma's pgbouncer=true for transaction pooling deployments. |
database_type, database_args | string, object | unset | Declared for a DynamoDB backend, but no code path reads them. Postgres is the only supported database. |
store_model_in_db | bool | unset | Store models, settings and other objects in the database and let the Admin UI edit them. |
supported_db_objects | list | unset | Which object types to load from the database: models, mcp, guardrails, vector_stores, pass_through_endpoints, prompts, model_cost_map, tools, config_overrides. All when unset. |
proxy_config_reload_interval_seconds | int | 30 | How often each instance reloads database stored objects. |
encryption_algorithm | string | unset | aes-256-gcm makes the gateway encrypt newly stored secrets (provider keys, credentials, MCP and SSO secrets) with AES-256-GCM. Unset keeps the older format. Turning it on changes only new writes, existing values move over when you run the encryption migration, which needs this setting first. |
coordination_redis | object | unset | A standalone Redis for cross instance coordination, see Redis requirements and the endpoints below. |
scheduled_job_stagger | object | enabled | Spread scheduled background jobs across a window. enabled, window_seconds and per job pins. |
Spend logs and retention
| Key | Type | Default | Meaning |
|---|
disable_spend_logs | bool | false | On stops writing a spend log row per request, which saves database space, but the Logs page, the Guardrails Monitor and the reports built from request rows stay empty. Spend counters, budgets and batch billing keep working. Off keeps a row per request. |
store_prompts_in_spend_logs | bool | unset | Keep prompts, responses and tool inputs and outputs in spend logs, the Lens copy of request logs, Lens trace spans, custom agent runs and workflow runs. Unset keeps only metadata. Turn it on to debug answers or build datasets from real traffic. The risk is that customer text sits in the database and Lens and the tables grow faster, so a privacy or platform admin should decide. It applies to new requests only. A saved true or false, from the config file or the Logging Settings switch, always wins. Only when it is unset does the STORE_PROMPTS_IN_SPEND_LOGS environment variable decide. Zero data retention and turn_off_message_logging keep content out even when it is on, see What Spanway stores. |
spend_logs_metadata_fields | object | unset | include or exclude lists of metadata keys written to the spend log table. |
maximum_spend_logs_retention_period | duration | unset (30d on Spanway Cloud) | Delete spend logs older than this, for example 30d. It also caps every table that copies prompts and answers, see retention. In config.yaml a bare number such as 30 counts as days. |
maximum_spend_logs_retention_interval | duration | 1d | How often the retention cleanup job runs, for example 6h. A value that cannot be read leaves the job unscheduled, so nothing is deleted. Editable under Router Settings, General without a restart. |
maximum_spend_logs_cleanup_cron | crontab | unset | When set, the cleanup job runs on this schedule instead of the interval, for example 0 3 * * * for 03:00 UTC. |
maximum_autorouter_session_retention_period | duration | unset | Delete auto router session rollups older than this. |
maximum_health_check_retention_period | duration | unset | Delete health check rows older than this. |
maximum_daily_tag_spend_retention_period | duration | unset | Delete per day tag spend rows older than this. |
maximum_audit_log_retention_period | duration | unset | Delete audit log rows older than this. |
audit_webhook | object | unset | Post every audit log row to an HTTPS endpoint as signed JSON batches. See Audit logs. |
audit_log_content_reads | bool | unset (on) | Write a viewed audit row each time someone opens the prompt and response of a request or pulls rows that carry them from /spend/logs. Set false to stop recording those reads. See read audit events. |
audit_log_list_reads | bool | unset (off) | Also write a viewed row for every page of the request list and every Usage report. Off by default because these pages refresh often. See read audit events. |
maximum_memory_retention_period | duration | unset | Delete memory rows not updated within this period. |
maximum_online_eval_score_retention_period | duration | unset | Delete online eval scores older than this period, or older than maximum_spend_logs_retention_period when that is shorter. |
maximum_eval_feedback_retention_period | duration | unset | Delete end-user eval feedback created before this period, or before maximum_spend_logs_retention_period when that is shorter. |
maximum_eval_dataset_retention_period | duration | unset | Remove eval dataset items copied from spend logs or sessions once they were logged before this period, or before maximum_spend_logs_retention_period when that is shorter. |
maximum_eval_review_retention_period | duration | unset | Delete human review items and their labels older than this period, or older than maximum_spend_logs_retention_period when that is shorter. |
maximum_workflow_run_retention_period | duration | unset | Delete workflow runs not updated within this period, or within maximum_spend_logs_retention_period when that is shorter, unless the workflow runner is still driving them, which lasts until the run's deadline or while a step holds a live lease. |
maximum_custom_agent_run_retention_period | duration | unset | Delete custom agent runs older than this period, or older than maximum_spend_logs_retention_period when that is shorter. |
maximum_workflow_trigger_fire_retention_period | duration | unset | Delete workflow trigger fires received longer ago than this period, or than maximum_spend_logs_retention_period when that is shorter. |
maximum_approval_request_retention_period | duration | unset | Delete settled human approval requests created longer ago than this period, once they are past their expiry. |
maximum_environment_record_retention_period | duration | unset | Delete environment plans created longer ago than this period once they are past their expiry and not being applied, and export records older than it. |
maximum_code_index_run_retention_period | duration | unset | Delete finished code graph index runs older than this period. |
maximum_cloud_closed_tenant_retention_period | duration | unset (90d on Spanway Cloud) | How long a closed Cloud workspace is kept before it is erased for good. After this period the tenant's email, company, address and saved card are blanked, signups never verified within it are deleted, and a job at 01:30 UTC erases the whole closed workspace: users who belong only to it, its end users, keys, request logs with their prompts, files, teams and the organization. Members of other workspaces only lose the membership. A shorter period means less personal data kept, a longer one gives a customer more time to come back. Tenants under a sanctions hold are skipped. |
maximum_deleted_record_retention_period | duration | unset | Delete archived deleted keys and deleted teams older than this period, counted from deletion. |
maximum_access_request_retention_period | duration | unset | Delete settled access requests not updated within this period. Pending requests and approved temporary raises that have not run out yet are kept, so the expiry job can restore the old limits. |
maximum_eval_run_retention_period | duration | unset | Delete finished eval runs, with their results and transcripts, older than this period, or than maximum_spend_logs_retention_period when that is shorter. |
maximum_red_team_run_retention_period | duration | unset | Delete finished red team runs and their results older than this period, or than maximum_spend_logs_retention_period when that is shorter. |
maximum_error_log_retention_period | duration | unset | Delete legacy error logs older than this period, or than maximum_spend_logs_retention_period when that is shorter. |
maximum_code_repo_retention_period | duration | unset | Delete disconnected code graph repositories, with their index runs, this long after their index rows were removed. |
maximum_managed_file_retention_period | duration | unset | Delete managed files uploaded longer ago than this period, with the bytes the spanway_db storage backend kept for them. Provider copies are not deleted. |
maximum_adaptive_router_session_retention_period | duration | unset | Delete adaptive router session state with no activity within this period. |
maximum_invitation_retention_period | duration | unset | Delete invitation links, accepted or not, whose expiry passed longer ago than this period. |
maximum_sanctions_record_retention_period | duration | unset | How long sanctions screening cases, decisions, report tasks and the sanctions event log are kept. It cannot be set below 3653d (ten years), and the cleanup job never deletes these records, see Cloud sanctions screening. |
maximum_compliance_snapshot_retention_period | duration | unset | Delete compliance report snapshots taken longer ago than this period. |
maximum_compliance_evidence_retention_period | duration | unset | Delete compliance evidence bundles generated longer ago than this period. |
compliance_evidence_interval | duration | unset | How often the gateway stores a new compliance evidence bundle on its own, for example 30d, so an auditor always has fresh evidence. Each bundle covers the last 90 days, and a job checks hourly whether one is due. Unset means bundles are made only when someone generates one. Needs the compliance_evidence license feature. |
maximum_data_subject_request_retention_period | duration | unset | Delete entries of the data subject request log older than this period. Erased subjects appear there only under a pseudonym. |
use_spend_logs_partitioning | bool | unset | Drop expired partitions instead of deleting rows once the spend log table is range partitioned by start time. The partitioning script is a one-off database operation that is not part of the image, so ask support@spanway.ai for the version that matches your gateway, test it on a copy of the database first and take a backup. Partition interval and how many future partitions are pre-created come from the SPEND_LOG_PARTITION_INTERVAL (day) and SPEND_LOG_PARTITION_PRECREATE_AHEAD (7) environment variables. |
maximum_spend_logs_cleanup_batch_size | int | 1000 | Rows deleted per statement by the cleanup job. |
maximum_spend_logs_cleanup_max_batches | int | 500 | Delete statements per table per run. |
maximum_spend_logs_cleanup_run_budget | duration | 5m | Wall clock budget for one cleanup run. |
maximum_spend_logs_cleanup_batch_timeout | duration | 30s | Statement and lock timeout per delete batch. |
spend_capture_rate_check | object | unset | Daily check of captured spend against the provider bill, see spend capture rate. |
disable_auto_add_proxy_admin_to_teams | bool | unset | Do not add the admin who creates a team as its member. |
required_model_region | eu, uk, ch, us, ca or apac | unset | Data residency policy reported by /compliance/residency. |
enforce_required_model_region | bool | false | Hold every request to required_model_region, see data residency. |
billing_auto_generate_invoices | bool | unset (off) | Drafts last month's invoices at 00:30 UTC on the first of each month for every active billing account with usage, so nobody has to remember to run Generate for all accounts. Drafts are never issued on their own. Off, invoices are made only by hand. Needs the billing license feature. Editable under Router Settings, General. See billing. |
zero_completion_insurance | bool | false | Bill nothing for a request whose model produced no completion tokens without a finish reason, or ended with finish_reason: error. On by default in Spanway Cloud, see zero-completion insurance. |
Health checks and alerting
| Key | Type | Default | Meaning |
|---|
background_health_checks | bool | unset (off) | On: every deployment gets a tiny test request on a timer, so /health, the Health Status tab and health-based routing always have a recent answer. Off: checks only run when someone asks. Each check is a real provider call that costs a few tokens per deployment per cycle. |
health_check_interval | int | 300 | Seconds between background checks (DEFAULT_HEALTH_CHECK_INTERVAL changes the default). Shorter spots a broken provider sooner and spends more tokens. |
health_check_concurrency | int | unset (no limit) | Deployments checked at the same time in one cycle. Set it when many deployments share one provider account. |
health_check_skip_disabled_background_models | bool | false | On: deployments with model_info.disable_background_health_check: true are also skipped by an on-demand /health. Off: only the background loop skips them. |
background_health_check_model_groups | list of strings | unset (all) | Only these model groups are probed and filtered by health-based routing. Use it to save tokens on groups nobody needs to watch. |
health_check_details | bool | true | Off: health results only say healthy or unhealthy, without deployment parameters and the full provider error. Applied at startup. |
use_shared_health_check | bool | false | On: replicas take turns through Redis so one runs each cycle and the others reuse its result, which divides the token cost by the replica count. Needs Redis. Applied at startup. |
health_check_staleness_threshold | int | twice the interval | Seconds after which a stored result is too old to route on. Also accepted under router_settings. |
health_check_ignore_transient_errors | bool | false | On: a deployment whose check fails only with a timeout or a rate limit stays routable, so a busy provider is not taken out of service. Also accepted under router_settings. |
enable_drain_endpoint | bool | false | On: GET /health/drain takes the worker out of rotation for a Kubernetes preStop hook. Off: the route answers 404. See draining a worker. |
drain_endpoint_token | string | unset | The token /health/drain requires on the X-Drain-Token header. DRAIN_ENDPOINT_TOKEN sets it from the environment. Without a token every drain call is refused with 401. |
router_settings.enable_health_check_routing | bool | false | On, deployments the background checks mark unhealthy get no traffic until a later check passes. Off, health results are only shown, never used for routing. Needs background_health_checks. |
HEALTH_CHECK_TIMEOUT_SECONDS | env, int | 60 | Seconds one health check may take before it counts as failed. model_info.health_check_timeout overrides it per deployment. |
DEFAULT_HEALTH_CHECK_PROMPT | env, string | test from spanway | The text a chat health check sends. |
BACKGROUND_HEALTH_CHECK_MAX_TOKENS | env, int | unset | max_tokens for every health check, which keeps each check cheap. Unset sends 16 tokens, and nothing for wildcard deployments such as anthropic/*. model_info.health_check_max_tokens wins per deployment. |
BACKGROUND_HEALTH_CHECK_MAX_TOKENS_REASONING | env, int | unset | max_tokens for health checks of reasoning models only, which need more room to answer at all. |
allow_public_health_readiness_details | bool | false | Shapes what /health/readiness shows callers without a key. Described once under Admin UI settings. |
alerting | list | unset | Alerting integrations, slack, webhook, email, see alerting. |
alert_types | list | the types marked on by default in alert types | Which alert types to send. Key, team and user lifecycle events, user_spend_anomalies, workflow_trigger_disabled and workflow_run_failed are sent only when listed. |
alert_to_webhook_url | map | unset | Webhook per alert type. |
alerting_args | map | unset | Report intervals, alert quiet periods and outage counts, see alerting. The PagerDuty thresholds live here too, see PagerDuty. |
alert_type_config | map | unset | Per alert type digest (default false) and digest_interval (default 86400 seconds), which collect repeats into one summary message, see digest mode. |
alerting_threshold | int | 300 | Seconds a request may run before it counts as slow or hanging. DEFAULT_SLACK_ALERTING_THRESHOLD changes the default. |
SLACK_WEBHOOK_URL, ALERTING_WEBHOOK_URL | environment | unset | The Slack compatible webhook for alerts. ALERTING_WEBHOOK_URL is used when SLACK_WEBHOOK_URL is unset. |
SLACK_DAILY_REPORT_FREQUENCY | environment | 43200 | Default seconds between the slow and failing deployment reports. |
EMAIL_INCLUDE_API_KEY | environment | false | On puts the key value in key created and rotated emails. Leave it off unless your policy allows keys by email. |
EMAIL_BUDGET_ALERT_MAX_SPEND_ALERT_PERCENTAGE, EMAIL_BUDGET_ALERT_TTL | environment | 0.8, 86400 | When the max budget email goes out and how long the same one stays quiet, see email. |
default_key_max_budget_alert_emails | spanway_settings | unset | Budget email thresholds with extra recipients for every key, see email. |
EMAIL_SUBJECT_INVITATION, EMAIL_SUBJECT_KEY_CREATED, EMAIL_SUBJECT_KEY_EXPIRING, EMAIL_SUBJECT_KEY_COMPROMISED | environment | unset | Replace one email subject each. Needs a license, see email branding. |
otel | bool | unset | Has no effect, nothing reads it. Turn OpenTelemetry on with callbacks: ["otel"] under spanway_settings, see OpenTelemetry and OpenTelemetry settings. |
spend_report_frequency | string | 7d | How often the gateway posts a spend summary to the alerting channels, as a whole number of days such as 1d or 7d. It runs only when alerting is set and a database is connected, and one instance sends each summary. Any other format stops the gateway at startup with spend_report_frequency must be a positive number of days. |
Public pages
| Key | Type | Default | Meaning |
|---|
public_mcp_hub_strict_whitelist | bool | true | A spanway_settings key. On, the public MCP hub lists only the servers an admin published. Off brings back the older behaviour that also lists every server with public IP access enabled, which can show servers nobody meant to publish. |
enable_public_model_hub | bool | false | Let anyone who can reach the gateway open the AI hub and its /public hub endpoints without signing in. Off by default, so only signed in users and callers with a valid key see the hub. Also set from the Admin UI under UI Settings. |
require_auth_for_public_ai_hub | bool | false | Older switch kept for existing setups. On, the AI hub needs a sign in or a key even while enable_public_model_hub is on. Off, enable_public_model_hub alone decides. Turning the hub open in the Admin UI clears it. Prefer turning enable_public_model_hub off. |
public_catalogue | bool | false | Publishes GET /public/catalogue, a list of the models you made public with their prices, limits, speed and error rate, so customers can compare them before they sign up. Off, the route answers 404. On, anyone on the internet can read it without a key, so the names of your public models and their traffic figures become public. Also switched in the Admin UI under Status Page, Public surfaces, without a restart. See public catalogue. |
public_catalogue_window_hours | int | 24 | Window the catalogue aggregates over. |
public_catalogue_cache_seconds | int | 60 | Catalogue cache lifetime. |
public_status | bool | false | Serve GET /public/status without authentication, see status page. |
public_status_cache_seconds | int | 60 | How long the status payload is cached and advertised in Cache-Control: max-age. |
status_incident_uptime_threshold | float | 99 | 24 hour uptime percent under which GET /status/suggestions proposes an incident. |
analytics_query | object | unset | Query and Explore, the read only SQL query, Ask AI, saved queries and Explore routes: enabled (true, false turns every route off with 403), max_rows (1000, at most 10000), timeout_seconds (10, at most 60), spend_log_days (30, at most 365), daily_days (365, at most 1830) and max_concurrent (4 queries per instance, at most 32). An invalid block turns analytics off until it is fixed. |
usage_anomalies | object | unset | Usage baselines and anomaly flags for the alerts inbox: scan_minutes (60, 0 turns the scan off), baseline_days (14), multiplier (3), min_requests (100), min_tokens (100000), min_spend (5), min_error_rate (0.2) and min_error_requests (20). |
compromised_key_reports | bool | true | Lets anyone who finds one of your virtual keys, for example a secret scanner, report it at POST /public/compromised_key so the gateway blocks it at once and alerts you, see leaked keys. When on, a matching active key stops working on the next request. When off, the route answers 404 and a leaked key keeps working until someone blocks it by hand. |
compromised_key_reports_per_minute | int | 10 | Leaked key reports one client address may send per minute. Over the limit, the route answers 429 with Retry-After: 60. Lower it if the route draws abuse, raise it if one scanner reports many keys at once. |
public_route_rate_limit_per_minute | int | 120 | How many requests one client address may send each minute to the public feeds, everything under /public/ plus the skill index, the MCP registry, the plugin marketplace, the Cloud plans and the SSO lookup. Over the limit they answer 429 with Retry-After. It stops people from copying your catalogue, prices and status history in bulk. Lower it if a scraper keeps coming back, raise it if many people share one office address. 0 turns the limit off. Also set in the Admin UI under Status Page, Public surfaces, without a restart. See copy protection. |
public_assistant | bool | false | Serve the website assistant at POST /public/assistant/chat and GET /public/assistant/search. |
public_assistant_origins | list | https://www.spanway.ai, https://spanway.ai | Websites allowed to call the assistant chat route. |
public_assistant_index_bucket | string | unset | S3 bucket, or file:// directory, holding the assistant knowledge index. |
public_assistant_daily_turn_ceiling | int | 5000 | Most assistant turns the gateway answers per UTC day across all visitors. |
These spanway_settings keys hold what is published on the AI hub. The Admin UI and the publish routes write them, and each change is audited.
| Key | Type | Default | Meaning |
|---|
public_model_groups | list | unset | The model groups listed on the AI hub, the public catalogue and the public status page. A name that no longer exists on the gateway still shows on the hub as a row with no provider, so remove a deleted model group from this list too. |
public_model_groups_links | object | unset | The Useful Links shown on the AI hub, each a name with an http or https URL and a display index. |
public_agent_groups | list | unset | The agents listed on the AI hub. |
public_mcp_servers | list | unset | The MCP servers listed on the AI hub. Listing a server does not change who may call it, and a server with available_on_public_internet: false stays reachable from internal addresses only. |
Admin UI settings
These switches change what the Admin UI shows and what some management routes allow for people who are not proxy admins. Set them on the UI Settings tab of Admin Settings, or put them under general_settings in the config file, where they win over the Admin UI value. Every one is off by default.
| Key | Type | Default | Meaning |
|---|
disable_model_add_for_internal_users | bool | false | On, only proxy admins can add models or auto routers, so nobody else can connect a new provider account and run up its bill. Off, internal users with access may add models. |
disable_team_admin_delete_team_user | bool | false | On, team admins cannot remove members from their teams, which suits teams whose members come from SCIM. Off, they may. |
enabled_ui_pages_internal_users | list | unset | The sidebar pages internal users see. Unset shows every page their role allows. It hides pages only, the API still checks each role. |
forward_client_headers_to_llm_api | bool | false | On, the caller's Authorization, anthropic-beta and x- headers go on to the provider, which coding tools on a personal subscription and tracing headers need. Off, they stay at the gateway. |
forward_llm_provider_auth_headers | bool | false | On, a provider key the caller sends (x-api-key, x-goog-api-key, api-key or ocp-apim-subscription-key) is used instead of the stored key, so people can bring their own provider account. Off, the stored key is always used. |
disable_agents_for_internal_users | bool | false | On, internal users lose the Agents page and the agent management routes. |
allow_agents_for_team_admins | bool | false | On, team admins keep agent access while the switch above is on. |
disable_vector_stores_for_internal_users | bool | false | On, internal users lose the Vector Stores page and its management routes. |
allow_vector_stores_for_team_admins | bool | false | On, team admins keep vector store access while the switch above is on. |
disable_custom_api_keys | bool | false | On, every key value is generated by the gateway and a request that sends its own key is refused with 403. Off, callers may choose an sk- value of at least 16 characters. |
disable_key_generate_for_org_admin | bool | false | On, organization admins cannot create keys, so keys come only from proxy admins and team members. Off, they may create keys for teams in their organization. |
scope_user_search_to_org | bool | false | On, user search only finds people in the caller's own organizations, so one customer cannot list another's users. Off, any signed in user can search every user. |
enable_chat_ui | bool | false | On, the sidebar shows the Chat page. Off, it is hidden. |
allow_public_health_readiness_details | bool | false | On, /health/readiness gives callers without a key its full details, such as the callbacks, cache and version, which helps a monitor without a key but tells anyone who can reach the gateway how it is built. Off, they get only status, db, airgapped and coordination_redis, which is enough for a load balancer or orchestrator probe. Leave it off unless such a monitor needs it. See health checks. |
team_admin_editable_team_fields | list | [] | The team settings a team admin may change: tpm_limit, rpm_limit, max_budget, raise_max_budget, projects and member_key_budgets. Empty means team admins cannot edit team settings. |
enable_public_model_hub and require_auth_for_public_ai_hub are listed under Public pages.
Spanway Cloud
The general_settings.cloud block turns a gateway into Spanway Cloud, the hosted service. Leave it out on a self-hosted gateway.
| Key | Type | Default | Meaning |
|---|
cloud.enabled | bool | false | On, the /cloud routes and the Cloud jobs run. Off, every /cloud route answers 404, which is right for every self-hosted gateway. |
cloud.app_url, cloud.api_url | string | required | The Admin UI address used in emails and checkout links, and the API address shown to tenants. |
cloud.verification_ttl_hours | int | 24 | How long a signup verification link works. |
cloud.trial_days | int | 14 | Accepted for older configs. No trial is started today. |
cloud.credit_check_ttl_seconds | int | 60 | From 1 to 3600. How long the credit check trusts a cached balance. Lower stops an empty balance sooner at the cost of more database reads. |
cloud.low_balance_alert_usd | float | 5.0 | The balance under which a tenant gets a low balance alert. |
cloud.zero_completion_insurance | bool | true | On, a request whose model produced nothing is not charged. Off, every request is charged. |
cloud.signup_allowlist | list | unset | Unset, anyone can sign up. A list lets only those addresses sign up, each a full address or @domain for a whole domain, and an empty list closes signup. Use it for an invite-only preview. |
cloud.usage_price_per_usd | float | 1.15 | From 1.0 to 3.0, written as a multiplier (1.15 means the provider price plus 15 percent, never 115). A value outside that range is refused when the config loads, and while the cloud block is invalid tenant requests answer 503 cloud_billing_unavailable, see Billing safety. What one USD of provider cost on Spanway's provider accounts is charged at, on every plan, from credits or as overage. 1.15 is the provider's list price plus 15 percent and 1.0 passes usage through at cost. Spend logs and budgets keep the provider's own price, and usage on a tenant's own provider keys is never charged. See Usage price. |
cloud.overage_price_id | string | unset | The Stripe price on the overage meter, such as price_1QOverage. Overage is sent to Stripe only after the gateway checks that this price charges one US cent per unit, flat, in USD. Unset or wrong, overage is held back and sent once it is right, and credits are still debited. See Billing safety. |
cloud.region | string | us-east-1 | The data region this gateway serves, us-east-1 or eu-central-1. New workspaces are stored here and their tenant row records it. Set it when the region's gateway is first deployed and never change it once tenants exist. See Data regions. |
cloud.region_signup_urls | object | empty | The https:// signup page of every other region's gateway, by region. Each listed region appears on the signup page and a signup for it is sent there. Empty keeps the region choice hidden. It cannot name cloud.region. |
cloud.plans | object | the built-in tiers | Prices and limits per tier. An overridden tier replaces the whole built-in tier, so a limit you leave out means unlimited. |
Evals
| Key | Type | Default | Meaning |
|---|
eval_remote_scorer_hosts | list of strings | unset | Hosts (or host:port) remote eval scorers may be registered on and called at. Unset allows any host that passes the SSRF checks. |
eval_self_hosted_scorer_hosts | list of strings | unset | Hosts (or host:port) that run on your own infrastructure. Only a remote scorer on one of them may be marked self_hosted and receive online scoring requests under a restricting data policy. Eval runs never send restricted items to a remote scorer. Read from the config file only, the admin API cannot set it. |
maximum_eval_review_retention_period | duration | unset | Deletes human review items older than this, see Human review. Unset keeps them. |
EVAL_CI_MAX_ACTIVE_RUNS | environment | 5 | How many runs one CI key may have pending or running at once. More are refused with 429, which stops a broken CI loop from spending the team's budget. Raise it for a busy monorepo. |
EVAL_CI_STALE_RUN_SECONDS | environment | 7200 | After this many seconds an unfinished CI run stops counting toward the cap above, so a run orphaned by a restart cannot block the key. |
ONLINE_EVAL_MAX_CONCURRENT_TASKS | environment | 32 | How many online scoring tasks one replica runs at once. A sampled request that arrives while all are busy is shed and counted, never queued. Higher scores more requests but uses more CPU and judge spend at once. |
ONLINE_EVAL_MAX_BUFFERED_ROWS | environment | 10000 | How many online score rows one replica holds between database flushes. Rows past it are dropped and counted, which protects memory when the database is slow. |
MCP
| Key | Type | Default | Meaning |
|---|
mcp_internal_ip_ranges | list of CIDRs | RFC 1918 and loopback | Networks that count as internal for servers not available on the public internet. |
mcp_advertised_versions | list | legacy revisions | Protocol revisions offered to clients. |
mcp_allowed_clients | list of {alias, value} | unset | Client applications admitted, see MCP access control. |
mcp_client_id_header | string | unset | Header naming the client application for non JWT callers. When set, MCP tool calls that carry it are also tagged MCP-Client: <label> for MCP usage analytics. Unset, no client label is recorded. |
mcp_trusted_proxy_ranges | list of CIDRs | unset | Older name for the MCP endpoints' trusted proxies. When trusted_proxy_ranges is also set, MCP trusts only proxies inside both lists. |
mcp_xff_num_trusted_hops | int | unset | Which X-Forwarded-For entry from the right is the client for the MCP endpoints, instead of the first one that is not a trusted proxy. |
mcp_prefer_client_id_metadata_document | bool | unset | Prefer the gateway's client metadata document over dynamic registration, see MCP OAuth. |
mcp_required_fields | list of strings | unset | Fields a submitted server must fill in. |
user_mcp_management_mode | restricted or view_all | unset | What non admins see on the MCP Servers page. |
enable_mcp_registry | bool | unset (off) | Serve the public MCP registry document at GET /v1/mcp/registry.json, so MCP clients can discover the servers you published. While it is off the route answers 404 "MCP registry is not enabled". |
mcp_session_token_signing | object | unset | Sign the session tokens the gateway's own MCP authorization server issues with an RSA key instead of the default HS256 key derived from master_key, so other services can check them through /.well-known/jwks.json. Takes algorithm: RS256, a kid, a private_key (PEM or os.environ/NAME) and previous_public_keys (kid and public_key) for rotation. A block that cannot be loaded makes /mcp answer 500 instead of falling back, see MCP OAuth. |
The hosted admin MCP server and the Admin Assistant are set with environment variables on the gateway.
| Variable | Default | What it does |
|---|
SPANWAY_ENABLE_ADMIN_MCP | false | true serves the admin MCP server at /admin/mcp, so an assistant can manage the gateway for the person who signed it in. Needs the admin_mcp license feature. Off, nothing is served at /admin. |
SPANWAY_ADMIN_MCP_MIN_ROLE | proxy_admin | The lowest role that may connect: proxy_admin, org_admin, team_admin or internal_user. Lower it to let team leads use their own assistant. |
SPANWAY_ADMIN_READ_ONLY | false | true or 1 offers only the tools that read, so an assistant can never change anything. |
SPANWAY_ADMIN_TOOLS | all | A comma separated allow list of tool names. An unknown name stops the gateway from starting. |
SPANWAY_MCP_PUBLIC_URL | PROXY_BASE_URL | The public HTTPS origin clients use. Requests naming another host are refused, which stops DNS rebinding. |
SPANWAY_ADMIN_RESPONSE_VIEW | full | compact returns results over 16 KB as an index the assistant pages through, which keeps its context small. |
SPANWAY_ADMIN_SCHEMA_MODE | full | discovery advertises short tool schemas and lets the assistant ask for the rest, which makes the tool list smaller. |
SPANWAY_ADMIN_AGENT_URL | unset | The private address of the Admin Assistant worker, such as http://admin-assistant:10000. Set, Slack users can connect through the gateway's own sign-in. Unset, the connect link answers 404. |
ADMIN_AGENT_SERVICE_TOKEN | unset | The shared token, at least 32 characters, the gateway presents when it hands the worker a session. The worker needs the same value. |
Under spanway_settings, mcp_semantic_tool_filter turns on the semantic tool filter with enabled, embedding_model, top_k and similarity_threshold. It is off by default.
These environment variables tune the MCP gateway. Set them on the gateway container and restart.
| Variable | Default | What it changes |
|---|
SPANWAY_ENABLE_MCP_STDIO | off | Allows MCP servers that run as a local command (stdio). Off keeps the gateway from starting programs on its own host. |
SPANWAY_MCP_STDIO_EXTRA_COMMANDS | empty | Comma-separated commands a stdio server may run besides npx, uvx, python, python3, node, docker and deno. Any other command is refused with 403. |
SPANWAY_MCP_CLIENT_TIMEOUT | 60 seconds | How long one call to an upstream MCP server may take. |
SPANWAY_MCP_TOOL_LISTING_TIMEOUT | 30 seconds | How long listing a server's tools may take before it counts as a timeout. |
SPANWAY_MCP_METADATA_TIMEOUT | 10 seconds | How long fetching a server's OAuth metadata may take. |
SPANWAY_MCP_HEALTH_CHECK_TIMEOUT | 10 seconds | How long one MCP server health check may take. |
MCP_NPM_CACHE_DIR | /tmp/.npm_mcp_cache | Where npx based stdio servers keep their package cache. Mount a writable volume there on a read-only root filesystem. |
DEFAULT_MCP_SEMANTIC_FILTER_EMBEDDING_MODEL | text-embedding-3-small | The embedding model the semantic tool filter uses when its settings name none. |
DEFAULT_MCP_SEMANTIC_FILTER_TOP_K | 10 | How many tools the semantic filter keeps when its settings name no top_k. |
DEFAULT_MCP_SEMANTIC_FILTER_SIMILARITY_THRESHOLD | 0.3 | The lowest similarity a tool needs to be kept when the settings name no threshold. |
MAX_MCP_SEMANTIC_FILTER_TOOLS_HEADER_LENGTH | 150 | The longest x-spanway-semantic-filter-tools response header, in characters. Longer lists are cut. |
MCP_OAUTH2_TOKEN_CACHE_MIN_TTL | 10 seconds | The shortest time an upstream OAuth token is cached. |
MCP_PER_USER_TOKEN_DEFAULT_TTL | 43200 seconds (12 hours) | How long a person's stored upstream token is treated as valid when the upstream gave no expires_in. |
MCP_PER_USER_TOKEN_EXPIRY_BUFFER_SECONDS | 60 | How long before expiry the gateway refreshes a person's stored token, so a call never goes out with a token about to expire. |
MCP_TOKEN_EXCHANGE_CACHE_MAX_SIZE | 500 | How many exchanged on-behalf-of tokens the gateway keeps in memory. |
MCP_SSO_ASSERTION_CACHE_TTL_SECONDS | 60 | How long a signed-in person's identity assertion for an upstream server is reused. |
Each server under mcp_servers also takes catalog_entry, the catalogue connector it belongs to, and enabled_write_tools, the connector's write tools agents may use, default an empty list. The full server field list is on MCP gateway.
Claude Code gateway
| Key | Type | Default | Meaning |
|---|
enable_claude_code_gateway | bool | unset | Serve the Claude Code gateway protocol under /claude_code_gateway, see Claude Code gateway. |
claude_code_gateway_managed_settings | object | unset | Managed settings served verbatim to Claude Code. |
skill_scan_guardrails | list | unset | Guardrails that read every uploaded skill and marketplace plugin before it is stored, on top of the ones on by default. A name that is not set up fails the scan, and a value that is not a list refuses every upload until it is fixed. See skill scanning. |
skill_scan_mode | fail_closed or fail_open | fail_closed | What happens when a scan cannot check every file. fail_closed refuses the upload, fail_open stores it and marks the scan failed_open. A blocked file is refused either way, and any other value refuses every upload until it is fixed. |
Workflow runner
| Key | Type | Default | Meaning |
|---|
workflow_runner.enabled | bool | true | Run workflow runner steps on this gateway and accept new runs, so agents can be chained into multi-step workflows. Needs a database. Off: new runs answer 409 The workflow runner is disabled on this gateway, queued steps wait for a gateway that has it on, and stored runs stay readable. Turn it off on a gateway that should only serve model traffic. |
workflow_runner.poll_seconds | float | 2 | How often each replica claims ready steps and renews its leases. |
workflow_runner.lease_seconds | int | 30 | How long a claimed step stays with a replica that stops renewing it. |
workflow_runner.max_concurrent_steps_per_pod | int | 16 | Steps one replica runs at the same time. |
workflow_runner.capture_io | bool | true | Let runs keep full content when store_prompts_in_spend_logs is on, turn_off_message_logging is off and no zero data retention policy applies. Set false to keep only metadata for every run. |
workflow_runner.replay_hold_seconds | int | 0 | How long a failed or cancelled metadata_only run keeps its inputs so it can be resumed, 0 to 604,800. Completed runs are scrubbed at once. |
workflow_runner.max_reclaims | int | 3 | Times a step whose A2A task was recorded is resumed on another replica before a reclaim counts as a new attempt. |
workflow_runner.default_tenant_max_running_steps | int | 16 | Steps one organization, team or key may have running at once across every replica. |
workflow_runner.default_tenant_max_active_runs | int | 200 | Pending, running or paused runs one organization, team or key may have. More starts or resumes answer 429. |
workflow_runner.backlog_alert_seconds | int | 300 | Raise a workflow_runner_backlog alert when the oldest ready step has waited this long and no live process runs steps. 0 turns it off. |
workflow_runner.max_call_depth | int | 4 | How deeply sub-workflows may call each other, 0 to 4. 0 turns sub-workflows off. A run nested deeper is refused with 422 before it starts, so a workflow that calls itself cannot loop. |
workflow_runner.max_expanded_steps | int | 500 | Steps a run and all its sub-workflows may have together, 1 to 500. A larger plan is refused with 422 before it starts. Lower it on a shared gateway where teams write their own workflows. |
The environment variable WORKFLOW_RUNNER_FAILURE_ALERTS_PER_ACTOR_HOUR (default 10) caps the failure alerts one virtual key's runs send per hour, so a workflow that fails in a loop cannot flood your alert channel. Later failures in that hour are recorded on the run as run.failure_alert_suppressed instead. Raise it when one key runs many independent workflows, and set it in the gateway environment and restart.
The environment variable SPANWAY_WORKFLOW_RUNNER_ROLE sets whether a process runs steps. embedded, the default, accepts runs and runs steps, producer only accepts runs and worker only runs steps. See queue mode and workers.
Workflow triggers
| Key | Type | Default | Meaning |
|---|
workflow_triggers.enabled | bool | true | Run the workflow trigger jobs and accept trigger writes. Needs a database. |
workflow_triggers.inbound_webhooks | bool | false | Serve the public signed webhook route, so outside systems can start workflows. Off by default because the route needs no gateway key, only the trigger's signature. Off: POST /v1/triggers/webhook/{trigger_id} answers 404 and webhook triggers never fire. |
workflow_triggers.inbound_max_rps_per_pod | int | 50 | Inbound webhook requests per second per replica. |
workflow_triggers.inbound_max_per_ip_per_minute | int | 600 | Inbound webhook requests per client IP per minute. |
workflow_triggers.cron_poll_seconds | float | 15 | How often each replica looks for due cron triggers. |
workflow_triggers.dispatch_poll_seconds | float | 2 | How often each replica claims pending fires. |
workflow_triggers.index_ttl_seconds | int | 30 | How long a replica caches the event types triggers subscribe to. |
workflow_triggers.fire_retention_days | int | 30 | Days fire rows and processed events are kept. |
workflow_triggers.min_cron_interval_seconds | int | 60 | Shortest allowed gap between two cron fires. |
Environments
| Key | Type | Default | Meaning |
|---|
environments.name | string | unset | This gateway's environment name, up to 128 characters. A plan must name it, and plans are refused with 409 until it is set. |
environments.require_approval | bool | true | Make every plan wait for a second person's approval before it can be applied, so nobody changes this environment alone. When off, the planner can apply their own plan. |
environments.plan_ttl_minutes | int | 60 | How long a plan stays appliable, from 1 to 1,440 minutes. |
Workload identity
| Key | Type | Default | Meaning |
|---|
workload_identity.trust | list | unset | Trust policies for OIDC issuers whose tokens can be exchanged for short-lived virtual keys, see workload identity federation. Nothing is trusted until a policy names its issuer. |
workload_identity.token_ttl_seconds | int | 900 | Lifetime of a minted key, 60 to 3,600. A policy can only shorten it. Shorter means a leaked key stops working sooner, longer means the workload exchanges tokens less often. Config file only, set by the platform admin. |
workload_identity.expired_key_retention_hours | int | 24 | Hours after expiry before a minted key is deleted, 0 to 8,760. 0 deletes expired keys at the next hourly run, a higher value keeps them visible on Virtual Keys for investigation longer. Spend logs and audit rows stay either way. Config file only. |
Sanctions geofence
| Key | Type | Default | Meaning |
|---|
sanctions_geofence.enabled | bool | false | Refuse requests from restricted places with HTTP 451, see sanctions geofence. Spanway Cloud always enforces it. |
sanctions_geofence.on_unknown | allow or block | allow | What to do with requests whose location cannot be resolved. |
sanctions_geofence.geo | object | unset | provider (cloudflare, cloudfront, vercel or mmdb) and mmdb_path. mmdb needs a package the gateway images do not include, so use a CDN provider on the images. |
sanctions_geofence.allow_countries, allow_subdivisions, allow_networks | list | unset | Places and CIDR ranges always allowed. |
sanctions_geofence.extra_block_countries, extra_block_subdivisions | list | unset | Places blocked on top of the policy. |
sanctions_geofence.policy_path | string | unset | Your own reviewed copy of the jurisdiction policy. |
Sanctions screening
These keys sit under general_settings.sanctions_screening and apply on Spanway Cloud only, see Cloud sanctions screening. If the block does not validate, every key below uses its default, the gateway logs why at ERROR and the Sanctions tab shows Screening settings ignored.
| Key | Type | Default | Meaning |
|---|
on_possible_match_existing | alert or hold | alert | alert opens a case and keeps an existing customer's service while a possible list match is reviewed. hold holds the account until a reviewer decides, safer when a missed match would be worse than a short outage. |
on_list_unavailable | hold or allow | hold | hold makes new signups wait while no usable list is loaded, which is fail-closed. allow lets them in unscreened until a list loads. |
refresh_interval_hours | int, 24 to 744 | 168 | How often the lists are downloaded. Shorter catches new listings sooner. |
max_data_age_days | int, 1 to 60 | 10 | How old the active list may get before the status turns stale and an alert is sent. |
source | ofac, mirror or local | ofac | Where the lists come from. local suits an air-gapped deployment. |
mirror_url | string | unset | Your mirror of the OFAC files, used with source: mirror. |
local_dir | string | unset | The folder holding SDN.XML and CONSOLIDATED.XML, used with source: local. |
sdn_sha256, consolidated_sha256 | string | unset | The SHA-256 of the local files, so a tampered copy is refused. |
max_removed_share | number, above 0 to 1 | 0.05 | The largest share of entries one refresh may remove. A refresh that removes more is rejected and alerted, because a sudden drop usually means a broken download. |
Access groups
This one is an environment variable, not a config key.
| Variable | Type | Default | Meaning |
|---|
DEFAULT_ACCESS_GROUP_CACHE_TTL | seconds | 600 | How long a gateway instance keeps its cached copy of an access group. The instance that saves a change updates its copy at once, and with Redis every instance shares it. Without Redis, other instances serve the old group until their copy expires, so lower it when several instances run without Redis and changes must apply quickly. A lower value means more database reads. |
SCIM provisioning
These two keys live under spanway_settings, not general_settings. The gateway reads them on every SCIM request, so a change to the config file applies to the next push from the identity provider. See SCIM provisioning.
| Key | Type | Default | Meaning |
|---|
scim_upsert_user | bool | true | What happens when a group the identity provider pushes names a member who has no gateway account yet. On, the gateway creates that user so the group arrives complete, which suits a provider that sends groups before users. Off (strict mode), the whole group push is refused with 400 until the provider has created the user through /scim/v2/Users, which keeps accounts the directory never provisioned out of the gateway. Change it only if your security team wants every account to come from a user push. |
scim_admin_group | string | unset | The display name or id of one directory group whose members become proxy admins. Unset, SCIM never makes anyone a proxy admin. Set, members of that group get the proxy admin role on the next push and lose it when they leave the group, so the directory decides who administers the gateway. A proxy admin can change every setting and read every key, so pick a small, tightly controlled group. Ignored for organization-scoped SCIM tokens. Only the gateway owner should set it. |
Users, keys and budgets under spanway_settings
These keys live under spanway_settings in config.yaml, not under general_settings.
spanway_settings:
max_internal_user_budget: 25
internal_user_budget_duration: 30d
default_internal_user_params:
user_role: internal_user
models: ["claude-haiku-5-5"]
available_teams: ["team-support"]
| Key | Type | Default | Meaning |
|---|
default_internal_user_params | object | unset | What every new internal user gets when the request does not say, for SSO sign-ins, /user/new and bulk invites: user_role, max_budget, budget_duration, models and teams. available_teams lists teams people may join themselves from Teams. Proxy admins are not given these defaults. The Admin UI Invite User dialog sends its own model choice, so the default models does not apply there. Also on Internal Users, Default User Settings. |
max_internal_user_budget | float | unset | The budget, in US dollars, given to a new internal_user created without one. It is a default, not a ceiling, so an admin can still set a higher budget. An update that sends user_role: internal_user without max_budget also resets that user's budget to this value, even when the role did not change. |
internal_user_budget_duration | string | unset | How often that default budget resets, for example 30d. Applied the same way as max_internal_user_budget. |
budget_exceeded_status_code | int | 422 | The HTTP status the gateway answers with when a key, team, user, customer, project, organization or tag has spent its budget, on every route. The body always carries the type budget_exceeded. With 422 most clients stop at once and show the error, which suits budgets that should end the work. Set 429 when your clients already retry on 429 with a back off, so a budget that resets soon makes them wait instead of fail. A client that retries 429 without a limit keeps calling until the reset, so check your client before switching. Applied at startup. A platform admin who owns the config file changes it. |
budget_exceeded_throttle_percentage | float | unset | A fraction between 0 and 1. A key with Throttle on budget exceeded that goes over its budget keeps working at this share of its TPM and RPM limits, for example 0.2 for 20%. Unset means over-budget keys are refused. |
default_key_generate_params | object | unset | Values every new key gets when the request leaves them out, for example max_budget or models. |
upperbound_key_generate_params | object | unset | The highest max_budget, budget_duration, duration, tpm_limit and rpm_limit a key may be created with. A higher value is refused with 400 <field> is over max limit set in config. |
key_generation_settings | object | unset | Who may create keys. personal_key_generation.allowed_user_roles limits who creates keys that belong to no team, team_key_generation.allowed_team_member_roles limits which team roles create team keys, and required_params lists fields every new key must carry. A refused caller gets 403, for example Personal key creation has been restricted by admin.... Unset means every role that can call /key/generate may create keys. |
enable_key_alias_format_validation | bool | false | On: a key_alias must be 2 to 255 characters, start and end with a letter or digit, and use only letters, digits and _-/.@, otherwise 400 Invalid key_alias format.... Off: any alias without control characters or .. is accepted. |
key_alias_pattern | string | unset | Your own regular expression every key_alias must match, which replaces the built-in pattern above. An invalid regex stops the config from loading. |
The environment variable MINIMUM_CUSTOM_KEY_LENGTH (default 16) sets how long a key value a caller brings must be.
Inference under spanway_settings
These keys live under spanway_settings, not general_settings.
spanway_settings:
enable_json_schema_validation: true
require_managed_files: true
responses:
background_mode:
polling_via_cache: true
native_background_mode: ["gpt-5.5"]
ttl: 3600
| Key | Type | Default | Meaning |
|---|
enable_json_schema_validation | bool | false | On, a chat answer that should follow a response_format JSON schema is checked against it, and an answer that does not match is refused instead of handed to your code, see structured output repair. Off, the answer is passed on unchecked. Costs a little CPU per call. |
drop_params | bool | false | On, parameters a provider does not support are dropped instead of failing the call, see drop params. The SPANWAY_DROP_PARAMS environment variable sets the same switch. |
budget_exceeded_status_code | int | 422 | Also applies to inference routes. Described once under users, keys and budgets. |
request_timeout | float | 6000 | Seconds the gateway waits for a provider to answer one call before it gives up with a 408 timeout. When router_settings.timeout is also set, this value limits each attempt and the router timeout limits the whole call. Lower it so a hung provider fails fast and a fallback can take over, raise it for very long generations. The REQUEST_TIMEOUT environment variable sets the same value. |
require_managed_files | bool | false | On, every file, batch and fine-tuning call must use a gateway managed id and every upload must name target_model_names, so a raw provider id cannot reach another team's file or job. Off, raw provider ids are accepted. Turn it on for any gateway that serves more than one team, see managed files. |
responses.background_mode.polling_via_cache | bool, "all" or list of models | false | On, a Responses call with background: true is run by the gateway and its progress is kept in Redis, so clients can poll it on any replica. Needs Redis. Off, background calls go straight to the provider. |
responses.background_mode.native_background_mode | list of models | [] | Models that keep using the provider's own background mode even when polling through the cache is on. |
responses.background_mode.ttl | int | 3600 | Seconds a polled background response stays in Redis. |
vector_store_search_failure_mode | annotate or error | annotate | What a chat request with vector_store_ids does when one store's search fails. annotate answers without that store's documents, so users still get an answer that may miss context, and a WARNING line names the store. error refuses the request with 400 vector_store_search_failed, so nobody gets an answer that was not grounded in every store. See knowledge bases. |
Guardrails and policies
Guardrails, policies and policy attachments are top level blocks of config.yaml, beside model_list, not keys under general_settings. Guardrails and policies created through the API or the Admin UI live in the database instead, see guardrails and guardrail policies.
guardrails:
- guardrail_name: pii-mask
spanway_params:
guardrail: presidio
mode: pre_call
policies:
frontier-safety:
guardrails:
add: [pii-mask]
policy_attachments:
- policy: frontier-safety
scope: "*"
| Key or variable | Where | Default | Meaning |
|---|
guardrails | top level | none | The guardrails the gateway loads at start. A guardrail that fails to start is skipped with an ERROR log line and the gateway runs without it. |
policies | top level | none | Named groups of guardrails with optional inheritance and conditions. |
policy_attachments | top level | none | Where each policy applies, by scope, team, key, model or tag. Needs no license. |
skip_system_message_in_guardrail | spanway_settings | false | On leaves system prompts out of what guardrails check, which saves cost when the system prompt is your own trusted text. Off checks them too. A guardrail's own Skip system messages choice wins over it. |
skip_tool_message_in_guardrail | spanway_settings | false | On leaves tool results out of what guardrails check. Off checks them too, which catches harmful text a tool returned. A guardrail's own choice wins over it. |
PRESIDIO_ANALYZER_API_BASE | environment | none | The Presidio analyzer address used by a Presidio guardrail that sets none of its own. |
PRESIDIO_ANONYMIZER_API_BASE | environment | none | The Presidio anonymizer address, used the same way. |
GENERIC_GUARDRAIL_API_BASE | environment | none | The service address used by a generic guardrail API guardrail that sets no api_base. |
MAX_POLICY_ESTIMATE_IMPACT_ROWS | environment | 1000 | How many teams and keys the policy attachment impact estimate reads. Raise it when you have more, at the cost of a slower estimate. |
GUARDRAIL_SCANNED_MESSAGES_CACHE_TTL_SECONDS | environment | 86400 (one day) | How long a guardrail remembers which messages of a conversation session it already checked, so each new turn only checks the new messages. That saves guardrail cost and time on long chats. A shorter value re-checks earlier messages once a session has been quiet that long. The memory holds hashes of the messages, never their text. |
Web search and code interpreter interception
These let any model use web search and a code interpreter, with the gateway running the searches and the code. Each block is read only when its callback is listed under spanway_settings.callbacks. Web search interception can also be turned on from the Admin UI, which stores the settings in the database.
spanway_settings:
callbacks: ["websearch_interception", "code_interpreter_interception"]
websearch_interception_params:
enabled_providers: ["bedrock"]
search_tool_name: tavily-search
max_agentic_loops: 3
code_interpreter_interception_params:
enabled_providers: ["openai"]
sandbox_tool_name: my-e2b
allow_internet_access: false
sandbox_tools:
- sandbox_tool_name: my-e2b
spanway_params:
sandbox_provider: e2b
api_key: os.environ/E2B_API_KEY
| Key | Type | Default | Meaning |
|---|
websearch_interception_params.enabled_providers | list | unset, meaning Bedrock only | Providers whose web search tool calls the gateway runs. An explicit empty list in YAML intercepts no provider. See web search interception. |
websearch_interception_params.search_tool_name | string | first configured search tool | The entry of search_tools that runs the searches. |
websearch_interception_params.max_agentic_loops | int | 3 | Follow-up model calls one request may chain. Each loop is one more billed model call plus the search cost. |
code_interpreter_interception_params.enabled | bool | true | On, the gateway runs the code_interpreter tool in a sandbox. Off, the tool goes to the provider unchanged. See code interpreter interception. |
code_interpreter_interception_params.enabled_providers | list | unset, meaning every provider | Providers whose requests are intercepted. |
code_interpreter_interception_params.sandbox_tool_name | string | unset | The entry of sandbox_tools that runs the code. Required, a request fails when no sandbox can be found. |
code_interpreter_interception_params.allow_internet_access | bool | false | On, code written by the model can reach the internet from the sandbox. Only the YAML boolean true turns it on. Leave it off unless a workload needs to download packages. |
sandbox_tools | list | unset | Top-level block. Each entry has sandbox_tool_name and spanway_params with sandbox_provider (e2b or opensandbox), api_key and, for OpenSandbox, api_base. |
Auto routers and router settings
router_settings keys, such as routing_strategy (including lar1 for confidence routing) and routing_strategy_args, are listed on the routing page, and the full router_settings table, including use_curated_data_terms for trusting the curated provider data terms in provider preferences, is in the config.yaml reference. The auto router preset catalog is fetched once per process from SPANWAY_AUTOROUTER_PRESETS_URL (unset uses the default presets URL). The copy bundled with the gateway is served instead when the fetch fails, when SPANWAY_LOCAL_AUTOROUTER_PRESETS=True, or on an air gapped gateway, see air gapped installs. A restart picks up a new catalog. maximum_adaptive_router_session_retention_period (below, unset keeps rows) controls how long adaptive router session rows stay in the database.
Rate limits
These settings change how the gateway counts requests and tokens against the rpm_limit, tpm_limit and max_parallel_requests you set on keys, users, teams, organizations and customers. The rate limits page explains each limit.
| Setting | Where | Default | Meaning |
|---|
token_rate_limit_type | general_settings | total | Which tokens count toward every tpm_limit. total counts input plus output, input counts only the prompt, output counts only the answer. Pick output when output tokens are what your provider limits you on. Any other value is treated as total. |
priority_reservation | spanway_settings | unset | Shares of each model's capacity kept for each priority class, for example {"prod": 0.7, "dev": 0.3}. Keys pick a class with metadata.priority. Needs a valid Enterprise license, see rate limits. |
priority_reservation_settings.default_priority | spanway_settings | 0.25 | The share of a model's capacity that keys with no priority class share between them. |
priority_reservation_settings.saturation_threshold | spanway_settings | 0.50 | How busy a model must be, from 0 to 1, before priority shares are enforced. Below it, any class may borrow idle capacity. |
priority_reservation_settings.saturation_check_cache_ttl | spanway_settings | 60 | Seconds each gateway instance reuses its reading of how busy a model is. Lower is more exact and costs more Redis reads. |
priority_reservation_settings.team_borrow_cap | spanway_settings | unset | The largest share of a model one team may use, even while borrowing idle capacity. Unset means no cap. |
priority_reservation_settings.active_team_split | spanway_settings | false | On, a busy priority class is split evenly between the teams that sent traffic in the current minute. Off, it is first come, first served. |
default_api_key_rpm_limit, default_api_key_tpm_limit | a deployment's spanway_params | unset | A per model RPM or TPM limit for every key that has no limit of its own for that model. With several deployments of one model the lowest value applies. |
SPANWAY_RATE_LIMIT_WINDOW_SIZE | environment | 60 | Length in seconds of the window rpm_limit and tpm_limit count over. Leave it at 60 unless you know why, because the limits are named per minute. |
SPANWAY_TPM_TOKEN_RESERVATION_ENABLED | environment | true | On, the gateway sets aside the expected tokens of a request before calling the model, so many requests at once cannot overshoot a tpm_limit. Off, tokens are counted only after the answer, which saves a Redis call per request but lets bursts go over the limit. |
LEGACY_MULTI_INSTANCE_RATE_LIMITING | environment | false | On, the older limiter answers with Crossed TPM / RPM / Max Parallel Request Limit and no scope headers. Leave it off. |
Cost and pricing
These keys live under spanway_settings, and a proxy admin can also change the first three on the Cost Tracking page. Each change through the page or the API writes an audit row.
| Setting | Where | Default | Meaning |
|---|
cost_discount_config | spanway_settings | unset | A discount per provider as a fraction, {"openai": 0.05} takes 5 percent off. Use it when you negotiated a lower price, so spend and budgets match your bill. Unset records list prices. |
cost_margin_config | spanway_settings | unset | A fee per provider or global, as a fraction, a fixed_amount in dollars per request, or both. Use it to charge teams or customers your own price. Budgets then run out sooner. Unset records cost only. |
block_requests_for_models_without_pricing | spanway_settings | false | On, every request for a model with no price is refused with a 403 model_cost_map_missing, so no spend goes unrecorded. Off, the request is recorded at 0 dollars and marked unpriced. |
block_unpriced_models_when_budgeted | spanway_settings | false | Like the switch above, but only for requests that have a key, team, user, customer, organization, per-model or global budget. |
SPANWAY_MODEL_COST_MAP_URL | environment | the public price map | Where the price map is fetched from, an https:// or file:// URL. |
SPANWAY_MODEL_COST_MAP_SHA256 | environment | unset | The SHA-256 the fetched price map must have. A file with another digest is rejected and the bundled copy is kept. |
SPANWAY_LOCAL_MODEL_COST_MAP | environment | False | True uses only the price map bundled with the build and never fetches one. |
See custom pricing for the full behaviour.
Budgets and resets
| Setting | Where | Default | Meaning |
|---|
timezone | spanway_settings | UTC | The time zone budget resets follow, for example America/Chicago, so a daily budget resets at your midnight instead of UTC midnight. |
budget_reset_time | spanway_settings | 00:00 | The time of day, as a quoted 24-hour "HH:MM", at which daily and longer budgets reset. A value that cannot be read stops the gateway at startup with Invalid budget_reset_time .... |
PROXY_BUDGET_RESCHEDULER_MIN_TIME, PROXY_BUDGET_RESCHEDULER_MAX_TIME | environment | 597, 605 | The reset job runs every 597 to 605 seconds, so a budget resets within about 10 minutes after its budget_reset_at. |
RESET_BUDGET_JOB_BATCH_SIZE | environment | 500 | Budgets the reset job updates per database write. |
RESET_BUDGET_JOB_MAX_CHUNKS_PER_RUN | environment | 100 | Batches one run of the reset job handles. Anything left waits for the next run. |
proxy_batch_write_at | general_settings | 10 | Seconds between the batched writes of spend and usage to the database. New requests appear in spend views and the Model Leaderboard within this interval. Also PROXY_BATCH_WRITE_AT. |
SPEND_ROLLUP_LOCK_TIMEOUT_MS | environment | 5000 | How long, in milliseconds, a spend rollup write waits for a locked row before it gives up and retries on the next flush. Raise it only when the log shows rollup lock timeouts on every flush. |
Response cache
The response cache is set under spanway_settings with cache: true and cache_params, or saved from the Cache Settings tab of the Response Cache page, which applies without a restart. See caching on the gateway for what each key does and cache backends for the backend specific ones.
| Key | Type | Default | Meaning |
|---|
spanway_settings.cache | bool | false | On turns the response cache on with cache_params. Off answers every request from the provider. |
cache_params.type | string | local | The backend, such as redis, redis-semantic, s3 or qdrant-semantic. local is per worker and not shared between replicas. |
cache_params.mode | default_on or default_off | default_on | default_off caches only requests that send "cache": {"use-cache": true}. |
cache_params.ttl | float, seconds | unset | How long an entry lives. Unset keeps Redis entries until they are deleted or evicted. |
cache_params.namespace | string | unset | Prefix for every cache key, so environments sharing one Redis stay apart. |
cache_params.supported_call_types | list | completion, embedding, transcription, text completion, rerank, Responses and Anthropic Messages calls | Which calls are cached. |
cache_params.max_messages | int | 4 | Requests with more messages or Responses API input items are never looked up or stored. null turns the limit off. |
cache_params.default_in_memory_ttl, cache_params.default_in_redis_ttl | float, seconds | unset | Replace ttl for the local backend or for the Redis backends. |
cache_params.similarity_threshold | float | unset, 0.8 in the Admin UI | Required similarity for semantic backends, from 0 to 1. |
cache_params.semantic_cache_scope | key or end_user | key | Who may share a semantic hit, see cache backends. |
cache_params.host, port, password, username, url, ssl | string, bool | unset | Redis connection. REDIS_HOST, REDIS_PORT, REDIS_PASSWORD, REDIS_USERNAME, REDIS_URL and REDIS_SSL fill them in when unset, see Redis requirements for the full list. |
Prompt caching and compression
The first three settings are the switches on the Prompt Caching tab of the Cost Optimization page, also shown on the Prompt Caching tab of Router Settings. A key can turn caching on for its own requests with enable_prompt_caching, see turning caching on for one key. They are spanway_settings keys that a proxy admin can also change at runtime from that tab, and the environment variable sets the value at startup.
| Setting | Environment variable | Default | Meaning |
|---|
enable_anthropic_prompt_caching | SPANWAY_ENABLE_ANTHROPIC_PROMPT_CACHING | false | On, the gateway marks the system prompt and the latest turn as cacheable for Claude on Anthropic, Bedrock, Vertex AI and Azure AI, so a long prompt that repeats is billed at the cheaper cached rate. Off, prompts go out as the client wrote them. Callers that share the same provider credentials share the cache. |
anthropic_prompt_caching_ttl | SPANWAY_ANTHROPIC_PROMPT_CACHING_TTL | unset (5 minutes) | 5m or 1h. 1h keeps the cache through long pauses in an agent session, and each cache write then costs twice as much. |
openai_system_messages_first | none | false | On, system and developer messages move to the front of each OpenAI and Azure OpenAI chat request, keeping their order, so OpenAI's automatic cache matches more often. Off, messages keep the order the client sent. |
MINIMUM_PROMPT_CACHE_TOKEN_COUNT | the variable itself | 1024 | The smallest prompt, in tokens, the prompt_caching pre-call check and Vertex AI context caching treat as cacheable when the price map has no prompt_cache_min_tokens for the model. |
compression_interception_params | none | unset | Settings of the built-in compression pass under spanway_settings, see built-in compression: enabled (default true), compression_trigger (default 200000 tokens), compression_target (default 70 percent of the trigger), embedding_model and embedding_model_params. |
Prompts
The top level prompts: list in config.yaml declares managed prompts. Each entry has a prompt_id and these spanway_params keys. Prompts saved through the API or the Prompts page are stored in the database instead, and supported_db_objects decides whether they load.
| Key | Type | Default | Meaning |
|---|
prompt_integration | string | required | Where the template lives: dotprompt, langfuse, gitlab, bitbucket, arize_phoenix, generic_prompt_management or custom. |
prompt_file | path | unset | One .prompt file to load. |
dotprompt_content | string | unset | The whole dotprompt template inline. |
prompt_id | string | the entry's prompt_id | The id the integration looks the template up by. |
ignore_prompt_manager_model | bool | false | On, the request's own model wins over the prompt's model. Off, the prompt picks the model. |
ignore_prompt_manager_optional_params | bool | false | On, the request's own parameters such as temperature win. Off, the prompt's parameters are used. |
api_base, api_key | string | unset | Address and key of a remote prompt service. Use os.environ/NAME for the key. |
provider_specific_query_params | map | unset | Extra query parameters for a remote prompt service, such as a label. |
prompt_info.environment | string | development | The environment this prompt version belongs to. |
Guardrail provider settings
Settings shared by every guardrail, such as unreachable_fallback, only_scan_new_messages, scan_raw_request, run_in_parallel, stream_scope and violation_message_template, and the environment variables each provider reads, are listed with their defaults on guardrail providers.
Agent tracing and Lens
Agent tracing lets you follow an agent run step by step. The gateway reads traces from Lens, and it needs both environment variables below to reach it. These are environment variables, not config keys, and a change needs a restart.
| Setting | Default | Meaning |
|---|
SPANWAY_LENS_URL | unset | The address of the Lens service, for example http://lens:8080. Set, with the token below, tracing is on and the trace routes and the Lens page work. Unset, tracing is off and the trace read routes answer 501 Agent tracing is not enabled. |
SPANWAY_LENS_PUBLIC_URL | unset | The address browsers and agents use to reach Lens, which the Admin UI opens. |
LENS_GATEWAY_SECRET | unset | The secret that signs the short identity token the gateway sends Lens with every /lens request, 32 to 512 bytes and the same value on both. Without a valid one the /lens routes answer 503 naming it. |
CLICKHOUSE_URL | unset | Optional. The Lens ClickHouse address with a user that may delete rows, so data subject erasure deletes Lens copies directly instead of asking Lens. |
CLICKHOUSE_DATABASE | spanway | The Lens database on that server. The Lens worker defaults to lens and the Helm chart sets spanway, so set the same value on both whenever CLICKHOUSE_URL is set. |
AGENT_TRACING_RETENTION_DAYS | 14 | How many days agent traces are kept. Set it on Lens to choose how long runs stay, and set the same value on the gateway so trace comments, which can quote a run, are deleted when their run is. A longer value keeps more history and more stored conversation text. It must be a whole number above zero. |
SPANWAY_LENS_SERVICE_TOKEN | unset | The shared secret the gateway and Lens use to trust each other, at least 32 characters and the same value on both. Without it tracing stays off even when SPANWAY_LENS_URL is set, and the gateway logs Agent tracing unavailable at startup. Keep it in your secret store. |
general_settings.tracing.store.type | unset | Set to lens to turn tracing on from config.yaml. The two variables above are still required. |
TRACE_READ_RETRY_AFTER_SECONDS | 2 | The Retry-After the trace read and trace query routes send with a 503 while Lens is not answering, so clients wait before retrying. |
OTLP_RETRY_AFTER_SECONDS | 2 | The Retry-After sent with a busy or failed trace upload. |
AGENT_TRACING_LIST_PAGE_SIZE | 50 | How many traces one page of GET /v1/traces returns. A larger page means fewer calls but slower answers. |
AGENT_TRACING_AGENT_LIST_LIMIT | 500 | The most agents GET /v1/traces/agents lists. Its window defaults to the 14 day trace retention when no start_ms is sent. |
Lens worker settings
These environment variables are set on the Lens worker, not on the gateway. With the Helm chart pass them through lensWorker.extraEnv.
| Setting | Default | Meaning |
|---|
LENS_ADMIN_TOKEN | required | The worker's private login credential. The worker stops with a configuration error without it. |
AGENT_TRACING_RETENTION_DAYS | 14 | How many days traces and request log copies are kept. Longer keeps more history and more prompt text. |
LENS_KEEP_SPAN_CONTENT | false | Keep span inputs and outputs on a Lens that runs without a gateway. Refused while SPANWAY_LENS_SERVICE_TOKEN is set, because the gateway's content policy decides then. |
LENS_ANALYSIS_MODELS | unset | A JSON array of the deployments Lens may use for findings analysis, the list the Model dropdown of Findings settings offers. |
LENS_EVALUATION_MODELS | unset | A JSON array of the deployments Lens may use for signals and other evaluation calls. |
LENS_EVAL_JUDGE_MODEL | unset | The model that judges Lens evals scored by an LLM judge. |
LENS_GITHUB_APP_SLUG, LENS_GITHUB_CLIENT_ID, LENS_GITHUB_CLIENT_SECRET, LENS_GITHUB_PRIVATE_KEY | unset | The GitHub App Lens uses for Connect GitHub and pull request evals. Set all of them or none, the worker refuses a partial set. |
LENS_DATASET_MAX_CASES, LENS_DATASET_MAX_CASE_CHARS | no limit | The most cases one dataset may hold and the longest a case may be, which bounds how much conversation text a dataset copies. |
LENS_SLACK_WEBHOOK_URL | unset | Posts each new open finding to one Slack channel. |
SPANWAY_LENS_LISTEN | 0.0.0.0:4318 | The address the worker listens on. |
LENS_MODE | unset | Only standalone or unset is accepted. Any other value stops the worker. |
Agents and agent analytics
These keys decide who can reach agents and skills and what agent usage the gateway records. The first four live under spanway_settings in config.yaml. The last two are UI Settings saved from Settings, Admin Settings, UI Settings, or with PATCH /update/ui_settings.
| Key | Type | Default | Meaning |
|---|
agent_access_default_deny | bool | true | Whether a key, team or organization with no agent grant can call agents. On (the default), a key reaches only the agents it, its team or its organization was granted, so a new agent is not open to everyone the moment it is added. Off, a key with no agent list may call every agent, which is how older gateways behaved. It can also be changed from the database through /config/update. Turn it off only on a gateway where every key may use every agent. See default deny. |
disable_add_user_agent_to_request_tags | bool | false | Off (the default), the gateway tags every request with the caller's User-Agent, which feeds user agent analytics and lets you see which coding tools your teams use. On, no user agent tag is written, so those charts stay empty. |
skill_search_embedding_model | string | unset | The embedding model the gateway uses to rank skills by meaning for GET /v1/skills?query= and the skill_search tool. Unset, skill search is off and those calls answer 400 skill_search_not_configured. Each search makes one embedding call that is billed like any other. |
public_skills_index | bool | false | On, GET /.well-known/agent-skills/index.json, /.well-known/skills/index.json and GET /v1/skills/{skill_id}/archive serve every stored skill to anyone who can reach the gateway, with no key, so coding agents can pick up your organisation's skills on their own. Off, those routes answer 404. Turn it on only when every stored skill may be read by everyone on that network. |
public_skills_index | bool | false | On, anyone who can reach the gateway can read /.well-known/agent-skills/index.json and download the published skills without a key, so agent tools outside your gateway can discover them. Off (the default), both routes answer 404. Turn it on only when every published skill may be public. See skills. |
disable_agents_for_internal_users | bool | false | On, internal users and internal viewers lose the Agents page and the agent management routes, which keeps agent setup with admins. Off (the default), they keep the access their role gives. |
allow_agents_for_team_admins | bool | false | Only matters when the setting above is on. On, team admins keep agent access while other internal users lose it. |
Agent sessions and A2A timeouts
These are environment variables. They control how long the per-session limits of agent governance remember a session, and how long the gateway waits for an A2A agent.
| Variable | Default | Meaning |
|---|
SPANWAY_MAX_ITERATIONS_TTL | 3600 | Seconds a session's call count is kept after its last call. Each call restarts the clock, so a busy session is counted until it has been quiet this long, and then a new session starts at zero. |
SPANWAY_MAX_BUDGET_PER_SESSION_TTL | 3600 | The same for a session's spend under max_budget_per_session. |
SPANWAY_SENSITIVE_ROUTING_TTL | 3600 | Seconds a session stays on the safe model after a guardrail routed one of its requests there because it held sensitive data, see sensitive data routing. |
DEFAULT_A2A_AGENT_TIMEOUT | 6000 | Seconds the gateway waits for an A2A agent to answer one request, 100 minutes by default so long agent tasks are not cut off. Lower it to free connections faster when your agents always answer quickly. |
SPANWAY_AGENT_HEALTH_CHECK_TIMEOUT | 5.0 | Seconds the Health Check switch on the Agents page waits for one agent. |
SPANWAY_AGENT_HEALTH_CHECK_GATHER_TIMEOUT | 30.0 | Seconds the health check waits for all agents together. When it runs out, every agent in that check is reported unhealthy with Health check timed out and the gateway logs a warning. |
Code graph
These are environment variables, read at startup. Set them on every replica and restart. See code graph.
| Variable | Default | Meaning |
|---|
SPANWAY_CODE_GRAPH_DATABASE_URL | unset | Turns the code graph on. The connection string of the application role, which reads and writes the codegraph schema. Unset, the code graph routes answer 503 and agents do not see spanway_code. |
SPANWAY_CODE_GRAPH_MIGRATION_DATABASE_URL | unset | A connection that may create roles and schemas. Set, the gateway applies pending code graph schema versions at startup. Unset, you create the schema yourself. |
SPANWAY_CODE_GRAPH_POOL_SIZE | 5 | Connections in the application role's pool. A value that is not a whole number stops the code graph from starting. |
SPANWAY_CODE_GRAPH_PARTITIONS | 1 | Hash partitions per table, read only when the tables are first created. A value that is not a whole number stops the code graph from starting. |
SPANWAY_CODE_GRAPH_WORKER | embedded | embedded indexes and polls inside the gateway process. off serves queries only, for replicas that should not index. Any other value is treated as embedded. |
SPANWAY_CODE_GRAPH_POLL | on | on checks branch heads of repositories that get no webhooks every 5 minutes. off stops that, so such repositories only update on a manual reindex. Any other value is treated as on. |
SPANWAY_CODE_GRAPH_GITHUB_APP_CREDENTIAL | unset | The stored credential that holds your GitHub App. Unset, Install GitHub App answers 503. |
SPANWAY_CODE_GRAPH_PARSER_PYTHON | the gateway's interpreter | The interpreter that runs the sandboxed parser. When it cannot parse a sample, indexing stays off and the gateway logs why. |
SPANWAY_CODE_GRAPH_PARSER_ISOLATION | linux_netns on Linux, darwin_sandbox on macOS | How the parser is cut off from the network: linux_netns, pod_network_policy or darwin_sandbox. An unknown value is treated as linux_netns. |
SPANWAY_CODE_GRAPH_GITHUB_HOSTS | unset | Comma-separated GitHub Enterprise Server hosts the gateway may fetch from. The public API host is always allowed. A credential for any other host is refused with credential_host_not_allowed. |
SPANWAY_CODE_GRAPH_GITLAB_HOSTS | unset | Comma-separated self-managed GitLab hosts the gateway may fetch from. gitlab.com is always allowed. |
Prometheus metrics
All under spanway_settings, read at startup. See Prometheus metrics.
| Key | Type | Default | Meaning |
|---|
callbacks: ["prometheus"] | list | unset | Turns metrics on. Off, /metrics answers 404. |
require_auth_for_metrics_endpoint | bool | true | On, /metrics needs a virtual key or the master key, so outsiders cannot read your traffic numbers. Off, anyone who can reach the gateway can read them, so only turn it off on a private network. |
prometheus_initialize_budget_metrics | bool | false | On, budget gauges cover every key and team from startup and refresh every 5 minutes, at the cost of one database read of all keys and teams per interval. Off, a budget appears after the first request of that key or team. |
prometheus_metrics_config | list | unset | Record only the listed metrics, each with only the listed labels. Unknown names stop startup. |
prometheus_exclude_metrics, prometheus_exclude_labels | list | unset | Drop metrics or labels everywhere. Unknown names stop startup. |
prometheus_metrics_max_series_per_metric | int | unset | Series cap per metric. Past it, counters and histograms add to one series whose labels are other. |
prometheus_metrics_ttl_seconds | float | unset | Forget series not updated for this long. Ignored with several workers. |
prometheus_metrics_cleanup_interval_seconds | float | 60 | How often expired series are removed. |
prometheus_end_user_metrics_max_series_per_metric | int | 10000 | Series cap for metrics with end_user. |
prometheus_end_user_metrics_ttl_seconds, prometheus_end_user_metrics_cleanup_interval_seconds | float | 3600, 60 | How long an end_user series lives without updates and how often they are checked. |
prometheus_latency_buckets | list of floats | unset | Latency histogram bucket bounds in seconds, replacing the built-in ones. |
prometheus_emit_stream_label | bool | false | Add stream to the request counter. |
prometheus_emit_input_sequence_length_label | bool | false | Add a prompt length bucket label. |
prometheus_emit_rate_limit_labels | bool | false | Add rate_limit_category and rate_limit_type to failed requests, so a 429 says who limited it. |
prometheus_deployment_and_latency_caller_identity | string | api_key_alias | The caller label on deployment and latency metrics: api_key_alias, user_email or both. The last two store email addresses in your metrics. |
prometheus_user_budget_label_include_email_alias | bool | false | Add user_email and user_alias to user budget gauges. Personal data. |
custom_prometheus_metadata_labels | list | [] | Request metadata fields to add as labels, such as metadata.project. |
custom_prometheus_tags | list | [] | Request tags to add as tag_<name> labels. |
enable_end_user_cost_tracking_prometheus_only, disable_end_user_cost_tracking_prometheus_only | bool | unset | Fill, or keep empty, the end_user label. |
Environment variables: PROMETHEUS_MULTIPROC_DIR (shared directory with several workers), PROMETHEUS_METRICS_PORT or --prometheus_metrics_port (a separate metrics port without a key check), PROMETHEUS_BUDGET_METRICS_REFRESH_INTERVAL_MINUTES (default 5), and PROMETHEUS_URL with PROMETHEUS_FALLBACK_STATS_SEND_TIME_HOURS (default 9) for the daily fallback summary.
OpenTelemetry
Turn tracing on with callbacks: ["otel"] under spanway_settings and these environment variables. See OpenTelemetry for what each one does.
| Variable | Default | Meaning |
|---|
OTEL_EXPORTER, OTEL_EXPORTER_OTLP_PROTOCOL | console, or otlp_http once an endpoint is set | otlp_http (also http/protobuf or http/json), otlp_grpc (also grpc) or console. OTEL_EXPORTER_OTLP_PROTOCOL wins when both are set. An unknown value prints spans to the console and logs a warning. |
OTEL_ENDPOINT, OTEL_EXPORTER_OTLP_ENDPOINT | unset | The collector address. The second wins when both are set. |
OTEL_HEADERS, OTEL_EXPORTER_OTLP_HEADERS | unset | Headers sent with every export, such as an API key. The second wins when both are set. |
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT | unset, meaning NO_CONTENT | Whether spans carry prompt and answer text: NO_CONTENT, SPAN_ONLY, EVENT_ONLY or SPAN_AND_EVENT. |
OTEL_SERVICE_NAME, OTEL_ENVIRONMENT_NAME, OTEL_MODEL_ID | spanway, production, the service name | How the gateway names itself in your traces. |
OTEL_IGNORE_CONTEXT_PROPAGATION | false | On, incoming traceparent headers are ignored and every request starts a new trace. |
SPANWAY_OTEL_BAGGAGE_TEAM_METADATA_KEYS, SPANWAY_OTEL_BAGGAGE_METADATA_KEYS | unset | Team and request metadata keys copied into outgoing trace baggage. Only list keys that may leave the gateway. |
SPANWAY_OTEL_INTEGRATION_ENABLE_METRICS, SPANWAY_OTEL_INTEGRATION_ENABLE_EVENTS | false | Also export OpenTelemetry metrics, or semantic log events. |
SPANWAY_OTEL_V2 | false | Use the version 2 logger, which follows the OpenTelemetry gen_ai conventions. |
OTEL_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINT | unset | The full traces URL, used as given. Version 2 only, the older logger sends to the endpoint plus /v1/traces. |
OTEL_TRACER_NAME, SPANWAY_METER_NAME, SPANWAY_LOGGER_NAME | spanway | The names your tracing tool shows as the source of spans, metrics and log events. |
OTEL_SEMCONV_STABILITY_OPT_IN | unset | Opt in to newer OpenTelemetry attribute names, for example gen_ai_latest_experimental. |
USE_OTEL_SPANWAY_REQUEST_SPAN | false | On, a spanway_request span is always added, even under a caller's own span. |
OTEL_LOGS_EXPORTER | the span exporter | Where log events go when events are on: console, otlp_http or otlp_grpc. |
OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATE | unset | A CA bundle for a collector that uses its own certificate. |
DEBUG_OTEL | false | On, every export is logged at DEBUG. Use it for one investigation only, it is noisy. |
SPANWAY_OTEL_LEGACY_COMPAT, SPANWAY_OTEL_LANGFUSE_SPAN_SCOPE | true, full | Version 2 only. Keep the older attribute names next to the new ones, and llm_only sends only model call spans to Langfuse. |
Logging destinations
These keys live under spanway_settings in the config file. See logging for every destination.
| Setting | Where | Default | Meaning |
|---|
callbacks | spanway_settings | none | Destinations that receive both successful and failed requests, for example ["langfuse", "prometheus"]. Each one is a copy of your traffic in another system, so add only destinations you trust with it. |
success_callback | spanway_settings | none | Destinations that receive successful requests only. The Admin UI's Logging & Alerts page adds to this list. |
failure_callback | spanway_settings | none | Destinations that receive failed requests only, for example an incident tool. |
turn_off_message_logging | spanway_settings | false | On keeps prompts and answers out of every destination while usage, cost and metadata are still sent. Turn it on when destinations must not see customer text. Debugging a bad answer then needs the gateway's own logs. |
allow_dynamic_callback_disabling | spanway_settings | false | On lets any caller skip callbacks for their own request with the x-spanway-disable-callbacks header. Leave it off unless every key holder may hide their requests from your logging. A key's admin-set disabled callbacks list works either way. Needs an Enterprise license. |
global_disable_no_log_param | spanway_settings | false | On also ignores the no-log flag on the gateway's own internal calls, so even those are logged. Callers can never send no-log, the gateway drops it from request bodies. |
Audit log
| Setting | Where | Default | Meaning |
|---|
store_audit_logs | spanway_settings | follows the license | On writes an audit row for every change, off writes none. Unset, it is on for licensed gateways only. Set it to true so the record keeps going even if the license lapses, which is what auditors expect. Turning it off removes the trail, so only a security owner should do it. |
SPANWAY_STORE_AUDIT_LOGS | environment | unset | The same switch, used only when store_audit_logs is not set. |
audit_log_callbacks | spanway_settings | none | Also send each audit row to azure_sentinel, s3_v2, azure_storage or your own logger class. Nothing fires while audit logging is off. |
s3_audit_callback_params | spanway_settings | unset | Bucket settings for the s3_v2 audit destination, so audit rows can go to a different bucket than request logs. Unset uses s3_callback_params. |
Control plane
| Setting | Where | Default | Meaning |
|---|
worker_registry | top level of config.yaml | unset | Makes this instance a control plane: its Admin UI manages the listed worker gateways, each with worker_id, name and url. Set it only on the control plane instance, which should not be given model traffic. Enterprise only, a gateway without the license refuses to start with it. |
Billing and payments
| Setting | Where | Default | Meaning |
|---|
STRIPE_SECRET_KEY | environment | unset | Lets billing create Stripe customers and invoices. Unset, issuing or voiding a Stripe invoice answers 502. |
STRIPE_WEBHOOK_SECRET | environment | unset | The signing secret of the Stripe webhook endpoint. Unset, every call to /billing/webhook/stripe answers 400. |
SPANWAY_BILLING_METRICS_ENDPOINT | environment | unset | Turns on usage metering to Spanway's collector, together with the client certificate and key below. |
SPANWAY_BILLING_METRICS_CLIENT_CERT | environment | unset | Client certificate for usage metering, a path or the PEM text. |
SPANWAY_BILLING_METRICS_CLIENT_KEY | environment | unset | Client key for usage metering, a path or the PEM text. |
SPANWAY_BILLING_METRICS_CA_CERT | environment | unset | Only for a private collector whose certificate is not publicly trusted. |
SPANWAY_BILLING_METRICS_EXPORT_INTERVAL_MS | environment | 60000 | How often usage counts are sent. |
SPANWAY_MARKETPLACE_PROVIDER | environment | unset | Turns on cloud marketplace mode for the planned marketplace listings, where the licence features come from the marketplace entitlement instead of a license key. aws, azure or gcp. No listing is live yet, so leave it unset. The Helm chart sets it from marketplace.provider. |
SPANWAY_AWS_MARKETPLACE_PRICING | environment | hourly | How the AWS Marketplace listing is priced: hourly, contract or usage. Set from marketplace.aws.pricing. |
SPANWAY_AWS_MARKETPLACE_PRODUCT_CODE | environment | unset | The listing's product code, required for hourly and usage pricing. |
SPANWAY_AWS_MARKETPLACE_PRODUCT_SKU | environment | unset | The listing's product SKU, required for contract pricing. |
SPANWAY_AWS_MARKETPLACE_METERING | environment | unset, which means off | true sends one AWS Marketplace usage record per pod per hour for a usage listing, in units of 1,000 successful requests. Off, a usage listing turns every licensed feature off instead, so nothing is used without being paid for. It stays off until the listing is live, see Usage metering switch. Set from marketplace.aws.metering.enabled. |
Settings managed from the API
Some settings have their own endpoints so that admins can change them without editing the file. store_model_in_db must be on. Coordination Redis settings are saved to the database and applied at the next restart, and the test endpoint pings a throwaway client with the submitted credentials.
Secret manager connections for HashiCorp Vault and CyberArk are stored as config overrides, with a test connection endpoint for each. Values are redacted in responses and in the audit log.
Change a setting and confirm it
-
Find the key in the tables above and note which section it belongs to. Most keys here go under general_settings.
-
Edit config.yaml and validate it before deploying:
docker run --rm -v "$PWD:/app/work" -w /app/work registry.spanway.ai/spanway/spanway-ai:2.0.0 --config config.yaml --validate_config
Expected result: Spanway: config OK (N models) and exit code 0. The check catches YAML errors, broken include files and models that fail to load, and those exit 1. It does not catch a misspelled key or a key in the wrong section. Unknown keys under general_settings and spanway_settings are ignored without a message, and unknown router_settings keys only log a warning, so compare each key with the tables above.
-
Roll the gateway. Settings that have their own routes, such as the coordination Redis and secret manager connections, can be changed without a restart from the Admin UI or the API instead:
curl http://localhost:4000/coordination_redis/settings -H "Authorization: Bearer $SPANWAY_API_KEY"
Expected result: the saved values with credentials shown as ***REDACTED***, the field definitions and source saying whether the values come from coordination_redis, the cache backend or the environment.
-
In the Admin UI open Settings, then Router Settings, and the General tab. Each general setting shows its current value and a Status badge. In Config means the value comes from the config file, In DB means it was saved from the Admin UI, and Not Set means neither, so the default listed on this page applies even though the value column is empty. For example, a Not Set max_request_size_mb still caps requests at 100 MB. Admin Settings holds the settings with their own tabs, such as Hashicorp Vault, CyberArk Conjur and UI Settings.
Errors
| Symptom | Meaning | Fix |
|---|
A setting has no effect although --validate_config printed config OK | The key is misspelled or in the wrong section, and the check does not look at key names. | Compare the key with the table for its section. For router_settings, look for a warning that the key is not a valid Router argument. |
Spanway: config validation failed: ... and exit code 1 | The file is not valid YAML, an include file is missing, or a model entry failed to load. | Fix the line or entry the message names. |
A setting shows default as its source after a deploy | The config file the gateway loaded does not contain it. | Check CONFIG_FILE_PATH or the --config path, and the include files. |
403 Only proxy admins can manage coordination Redis settings | The key used for a settings route is not a proxy admin key. | Use a proxy admin key. |
500 Set 'STORE_MODEL_IN_DB='True' in your env to enable this feature. | Settings routes that store to the database need that variable. | Set STORE_MODEL_IN_DB=True. |