Skip to main content

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​

KeyTypeDefaultMeaning
completion_modelstringunsetSends 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_modelstringunsetSends every /v1/moderations call to this model, whatever model the caller named. Unset, the caller's model is used.
image_generation_modelstringunsetModel 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_paramsboolfalseLets 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_workerintunsetTurns 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_workerintsame as in flightHow 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_secondsfloat1.0How long a waiting request waits for a slot before it gets 503. Only used while admission control is on.
max_parallel_requestsintunsetParallel requests allowed per key.
global_max_parallel_requestsintunsetParallel requests allowed per gateway instance.
fail_closed_rate_limit_enforcementbooltrueReturn 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_enforcementbooltrueReturn 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_limitsboolunsetA request rejected by a per model key, team, organization or project rate limit returns 429 instead of trying fallbacks.
expose_fallback_errors_to_callerboolunset (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_mbint100Reject 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_mbintunsetReject responses above this size.
cancel_on_disconnectboolunsetCancel the upstream call when the client disconnects, logging a 499.
pass_through_request_timeoutfloat600Upstream timeout for native and custom pass-through endpoints.
responses_websocket_session_limit_secondsfloat3600Lifetime of a Responses API WebSocket session, between 60 and 7200.
enable_openai_websocket_passthroughboolunsetServe the OpenAI pass-through WebSocket route.
pass_through_endpointslistunsetCustom pass-through endpoints, see pass-through.
pass_through_env_var_allowlistlist of stringsunsetEnvironment 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_bucketslist of stringsunsetS3 buckets non admin keys may use through the Amazon Transcribe pass-through.
missing_session_idgenerate, reject or omitunsetWhat to do with requests that carry no session id.
include_call_id_in_error_bodyboolunsetCopy the x-spanway-call-id header value into JSON error bodies.
infer_model_from_keysboolunsetHave /models infer available models from provider keys in the environment.
model_list_healthy_onlyboolunsetHide models whose deployments are all unhealthy from /models and /model/info. Needs background_health_checks.
forward_client_headers_to_llm_apiboolunsetForward client headers such as Authorization to the provider, needed for Claude Code with a subscription.
reject_clientside_metadata_tagsboolunsetRefuse 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_prefixeslist of stringsunsetExtra 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.

VariableDefaultMeaning
SPANWAY_RUSTunset (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​

KeyTypeDefaultMeaning
max_file_size_mbintunsetLargest 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_mbintunsetLargest batch input file.
max_batch_file_recordsintunsetRecords per batch input file, per key. Key metadata may override it and team metadata adds a team cap.
max_batch_file_uploads_per_dayintunsetBatch uploads per key per UTC day, with the same key and team overrides.
max_file_downloads_per_minuteintunsetGET /v1/files/{id}/content calls per key per file per minute.
allowed_file_extensionslist of stringsunsetThe only extensions accepted on upload. An empty list rejects every upload.
blocked_file_extensionslist of stringsunsetExtensions rejected on upload. Deprecated in favour of the allow list but still enforced after it.
track_unmanaged_batch_costboolfalseOn 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_intervalint, seconds3600How 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 variableDefaultMeaning
PROXY_BATCH_POLLING_ENABLEDtruefalse 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_CYCLE50How many open batches one run of the cost job checks.
MANAGED_OBJECT_STALENESS_CUTOFF_DAYS7Batches still open after this many days are marked stale and no longer polled.
SPANWAY_EXECUTED_BATCH_CONCURRENCY4How 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:

BlockDefaultMeaning
files_settingsunsetA 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_settingsunsetThe same shape for fine-tuning jobs, see fine-tuning.
assistant_settingsunsetcustom_llm_provider and spanway_params for the Assistants API, see assistants.
search_toolsunsetThe 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​

KeyTypeDefaultMeaning
master_keystringunsetThe admin key every management call needs.
dangerously_permit_weak_or_unset_master_keyboolunsetLocal 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_authstringunsetPath to your own authentication function, see custom auth.
custom_auth_run_common_checksboolfalseOff 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.modeon, off or autoonon 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_validatestringunsetmodule.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_jwtauthbool, objectunsetAccept identity provider JWTs, see JWT authentication. These keys are accepted under general_settings and the model does not list them.
enable_oauth2_authboolfalseOn 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_mappingsbool, mapfalse, unsetOn 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_paramboolfalseOn 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_routeslistunsetGateway 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_forlist, boolunsetClient 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_sizeint200Entries each worker keeps in its in memory auth cache.
user_header_namestringunsetDeprecated. Header whose value is the end user id.
user_header_mappingslistunsetHeaders that identify the caller, each with header_name and the role it applies to, see customers.
key_management_systemstringunsetSecret manager that loads and decrypts keys, see secret managers.
key_management_settings.hosted_keyslist of stringsunsetThe os.environ/ names looked up in the secret manager. Unset sends every name there.
key_management_settings.access_moderead_only, write_only or read_and_writeread_onlyWhether 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_keysboolfalseOn 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_keysstringspanway/Where stored virtual keys go in the secret manager.
key_management_settings.primary_secret_namestringunsetRead every secret from one secret that holds a JSON object.
key_management_settings.description, tags, kms_key_idstring, map, stringunsetDescription, tags and customer managed encryption key for secrets the gateway writes.
key_management_settings.custom_secret_managerstringunsetThe 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_endpointstringunsetHow the gateway signs in to AWS Secrets Manager, for example by assuming a role, see secret managers.
key_management_settings.replica_regionslist of stringsunsetExtra AWS regions each new secret is copied to.
use_google_kmsboolunsetDecrypt keys with Google KMS.
use_azure_key_vaultboolunsetLoad keys from Azure Key Vault.
disable_budget_reservationboolunsetTurn off the optimistic per request budget reservation. Weakens hard budget enforcement under concurrency.
apply_user_budget_to_team_keysboolunset (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_keysboolfalseOn: 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_adminboolfalseOn: 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_userboolfalseOn: 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_fieldslistemptyWhat 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_schemalistunsetTeam 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_quotaboolfalseOn: 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_uiboolfalseStored 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_accessboolunsetOnly attempt fallbacks the calling key may use.
vector_store_deny_by_defaultboolfalseA vector store must be granted explicitly in object_permission.vector_stores.
search_tool_deny_by_defaultboolfalseA search tool must be granted explicitly in object_permission.search_tools.
egress_allowlistlistunsetHosts, *. wildcard suffixes and CIDRs the gateway may connect to. Every other outbound connection is refused, see egress allowlist.
server_toolsobjectunsetGateway-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_securityboolunsetStop enforcing ownership of Responses API ids. Removes tenant isolation on /v1/responses.
allow_unmanaged_response_idsboolunsetLet keys address response ids the gateway did not issue.
trusted_proxy_rangeslist of CIDRsunsetThe 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_loginboolfalseRequire an authenticator app code for every Admin UI username and password sign-in, see two-factor sign-in.
key_hygieneobjectunsetPolicy 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_hostslist of stringsunsetHosts a request may redirect a provider call's destination URL to.
deployment_url_allowed_hostslist of stringsunsetInternal 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_validationbooltrueMaster switch for the SSRF guard on user supplied URLs such as image_url, file_url and MCP or OpenAPI spec URLs.
user_url_allowed_hostslist of stringsunsethostname or hostname:port entries that skip the blocked network check but still resolve DNS.

Customers​

These keys live under spanway_settings.

KeyTypeDefaultMeaning
max_end_user_budget_idstringunsetA 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_budgetfloatunsetNot applied. Use max_end_user_budget_id instead.
blocked_user_listlist or file pathunsetCustomer 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_codeint422Also applies to customer budgets. Described once under users, keys and budgets.
enable_post_custom_auth_checksboolfalseOn 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.

VariableDefaultMeaning
JWT_PUBLIC_KEY_URL, JWT_AUDIENCE, JWT_ISSUERunsetWhere 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_SECRETunsetThe 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_NAMEsub, role, team_idFields 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_SECRETunsetThe Admin UI sign-in provider, see Admin UI SSO. Setting one turns SSO on.
GENERIC_AUTHORIZATION_ENDPOINT, GENERIC_TOKEN_ENDPOINT, GENERIC_USERINFO_ENDPOINT, GENERIC_SCOPEunsetEndpoints and scopes of a generic OIDC provider.
GENERIC_USER_PROVIDER_ATTRIBUTEproviderField of the user info answer that names the provider.
GENERIC_USER_EXTRA_ATTRIBUTESunsetComma separated user info fields copied onto the user.
GENERIC_INCLUDE_TOKEN_CLAIMSfalseOn 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_IDunsetSAML sign-in for the Admin UI. One of the metadata settings turns it on.
SAML_ALLOW_UNSOLICITEDfalseOn 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_CERTtrueKeep SAML responses strictly checked and the metadata certificate validated. Turn off only to debug a test identity provider.
SAML_AUTHN_REQUESTS_SIGNEDfalseOn signs the sign-in requests the gateway sends, for identity providers that require it.
SAML_SP_NAME_ID_FORMATurn:oasis:names:tc:SAML:1.1:nameid-format:emailAddressThe name id format the gateway asks for.
PROXY_ADMIN_IDunsetThe user id that is made a proxy admin when they sign in. This is the only setting that promotes someone through SSO.
PROXY_BASE_URLunsetThe public address of the gateway, used to build the sign-in callback.
ALLOWED_EMAIL_DOMAINSunsetComma separated email domains allowed to sign in through SSO. Unset allows every domain the provider signs in.
SPANWAY_UI_SESSION_DURATION24hHow long an Admin UI session lasts before signing in again.
SPANWAY_CLI_JWT_EXPIRATION_HOURS24How 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_MAPunsetIdentity provider claims copied into the user's metadata at CLI sign-in.
PKCE_STRICT_CACHE_MISSfalseOn 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_DEBUGfalseOn 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​

KeyTypeDefaultMeaning
ui_access_modeadmin_only, all or an objectallWho 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_sourceint10Failed 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_overridesmap of address or CIDR to intunsetPer address overrides. 0 exempts the address.
failed_login_window_secondsint60Fixed window over which failures are counted.
failed_login_block_secondsint300How long a blocked address, or address and username, stays blocked.
password_policy_min_lengthint12Minimum password length for local users, never below 8.
password_policy_require_uppercasebooltrueRequire an uppercase letter.
password_policy_require_lowercasebooltrueRequire a lowercase letter.
password_policy_require_numbersbooltrueRequire a digit.
password_policy_require_special_charactersbooltrueRequire a non alphanumeric character.
password_policy_check_breached_passwordsbooltrueOn 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_enabledboolunsetWith SSO configured, turn off username and password sign-in.
disable_env_credential_loginboolunsetTurn off sign-in with UI_USERNAME and UI_PASSWORD or the master key. Create a password admin first.
allow_cli_sso_verification_uri_completeboolunsetPre-fill the user code in the browser for the CLI device flow.
hide_default_credentials_hintboolfalseHides 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_urlstringunsetThe control plane that manages this instance, see control plane.
pluginslistunsetExternal services embedded in the Admin UI, see UI plugins.

Environment variables for the Admin UI and its sign-in, set on the gateway container:

VariableDefaultWhat it does
UI_USERNAMEadminUsername of the built-in admin account.
UI_PASSWORDthe master keyPassword of the built-in admin account. Setting it also hides the default credentials notice.
DISABLE_ADMIN_UIfalsetrue stops serving the Admin UI, the sign-in page shows Admin UI Disabled. The API keeps working.
AUTO_REDIRECT_UI_LOGIN_TO_SSOfalsetrue 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_HINTfalsetrue hides the Default Credentials notice, like hide_default_credentials_hint.
SPANWAY_UI_API_DOC_BASE_URLunsetThe 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_URLunsetWhere 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_URLunsetThe public address of the gateway, used in SSO redirects and links in emails.
SERVER_ROOT_PATHunsetA path prefix when the gateway is served under one, such as /spanway.
SERVER_ROOT_PATHSunsetSeveral 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_LIMITfalsetrue turns the failed sign-in lockout off, so password guessing is no longer slowed down. Use it only in tests.
SPANWAY_ENABLE_HSTSfalsetrue 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_DOCSfalsetrue 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​

SettingTypeDefaultMeaning
SPANWAY_LICENSEenvironmentunsetThe 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_licensegeneral settingunsetThe 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_DESCRIPTIONenvironmentSpanway API and the default textWith a license, the title and description of the API explorer at /.
DOCS_FILTEREDenvironmentFalseWith 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​

VariableDefaultWhat it does
SPANWAY_AIRGAPPEDunsettrue, 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_RESOLVERtrueOn 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_URLunsetThe 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​

KeyTypeDefaultMeaning
SPANWAY_FIPS_MODEenvironment variable, booltrue in the spanway-ai-fips image, unset elsewhereOn 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.

KeyTypeDefaultMeaning
database_urlstringunsetPostgres connection string, needed for keys, spend and everything stored.
database_connection_pool_limitint10Connection pool size.
database_connection_timeoutfloat60Timeout to obtain a connection.
database_connect_timeoutfloatunsetPrisma connect_timeout in seconds.
database_socket_timeoutfloatunsetAbort an operation that has produced no data within this many seconds.
database_max_idle_connection_lifetimefloat60Close pooled connections idle longer than this, before load balancers drop them.
database_extra_connection_paramsmapunsetExtra query parameters appended to the database URL, such as sslmode.
database_disable_prepared_statementsboolunsetSet Prisma's pgbouncer=true for transaction pooling deployments.
database_type, database_argsstring, objectunsetDeclared for a DynamoDB backend, but no code path reads them. Postgres is the only supported database.
store_model_in_dbboolunsetStore models, settings and other objects in the database and let the Admin UI edit them.
supported_db_objectslistunsetWhich 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_secondsint30How often each instance reloads database stored objects.
encryption_algorithmstringunsetaes-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_redisobjectunsetA standalone Redis for cross instance coordination, see Redis requirements and the endpoints below.
scheduled_job_staggerobjectenabledSpread scheduled background jobs across a window. enabled, window_seconds and per job pins.

Spend logs and retention​

KeyTypeDefaultMeaning
disable_spend_logsboolfalseOn 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_logsboolunsetKeep 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_fieldsobjectunsetinclude or exclude lists of metadata keys written to the spend log table.
maximum_spend_logs_retention_perioddurationunset (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_intervalduration1dHow 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_croncrontabunsetWhen set, the cleanup job runs on this schedule instead of the interval, for example 0 3 * * * for 03:00 UTC.
maximum_autorouter_session_retention_perioddurationunsetDelete auto router session rollups older than this.
maximum_health_check_retention_perioddurationunsetDelete health check rows older than this.
maximum_daily_tag_spend_retention_perioddurationunsetDelete per day tag spend rows older than this.
maximum_audit_log_retention_perioddurationunsetDelete audit log rows older than this.
audit_webhookobjectunsetPost every audit log row to an HTTPS endpoint as signed JSON batches. See Audit logs.
audit_log_content_readsboolunset (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_readsboolunset (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_perioddurationunsetDelete memory rows not updated within this period.
maximum_online_eval_score_retention_perioddurationunsetDelete online eval scores older than this period, or older than maximum_spend_logs_retention_period when that is shorter.
maximum_eval_feedback_retention_perioddurationunsetDelete end-user eval feedback created before this period, or before maximum_spend_logs_retention_period when that is shorter.
maximum_eval_dataset_retention_perioddurationunsetRemove 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_perioddurationunsetDelete 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_perioddurationunsetDelete 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_perioddurationunsetDelete custom agent runs older than this period, or older than maximum_spend_logs_retention_period when that is shorter.
maximum_workflow_trigger_fire_retention_perioddurationunsetDelete workflow trigger fires received longer ago than this period, or than maximum_spend_logs_retention_period when that is shorter.
maximum_approval_request_retention_perioddurationunsetDelete settled human approval requests created longer ago than this period, once they are past their expiry.
maximum_environment_record_retention_perioddurationunsetDelete 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_perioddurationunsetDelete finished code graph index runs older than this period.
maximum_cloud_closed_tenant_retention_perioddurationunset (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_perioddurationunsetDelete archived deleted keys and deleted teams older than this period, counted from deletion.
maximum_access_request_retention_perioddurationunsetDelete 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_perioddurationunsetDelete 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_perioddurationunsetDelete 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_perioddurationunsetDelete legacy error logs older than this period, or than maximum_spend_logs_retention_period when that is shorter.
maximum_code_repo_retention_perioddurationunsetDelete disconnected code graph repositories, with their index runs, this long after their index rows were removed.
maximum_managed_file_retention_perioddurationunsetDelete 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_perioddurationunsetDelete adaptive router session state with no activity within this period.
maximum_invitation_retention_perioddurationunsetDelete invitation links, accepted or not, whose expiry passed longer ago than this period.
maximum_sanctions_record_retention_perioddurationunsetHow 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_perioddurationunsetDelete compliance report snapshots taken longer ago than this period.
maximum_compliance_evidence_retention_perioddurationunsetDelete compliance evidence bundles generated longer ago than this period.
compliance_evidence_intervaldurationunsetHow 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_perioddurationunsetDelete entries of the data subject request log older than this period. Erased subjects appear there only under a pseudonym.
use_spend_logs_partitioningboolunsetDrop 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_sizeint1000Rows deleted per statement by the cleanup job.
maximum_spend_logs_cleanup_max_batchesint500Delete statements per table per run.
maximum_spend_logs_cleanup_run_budgetduration5mWall clock budget for one cleanup run.
maximum_spend_logs_cleanup_batch_timeoutduration30sStatement and lock timeout per delete batch.
spend_capture_rate_checkobjectunsetDaily check of captured spend against the provider bill, see spend capture rate.
disable_auto_add_proxy_admin_to_teamsboolunsetDo not add the admin who creates a team as its member.
required_model_regioneu, uk, ch, us, ca or apacunsetData residency policy reported by /compliance/residency.
enforce_required_model_regionboolfalseHold every request to required_model_region, see data residency.
billing_auto_generate_invoicesboolunset (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_insuranceboolfalseBill 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​

KeyTypeDefaultMeaning
background_health_checksboolunset (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_intervalint300Seconds between background checks (DEFAULT_HEALTH_CHECK_INTERVAL changes the default). Shorter spots a broken provider sooner and spends more tokens.
health_check_concurrencyintunset (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_modelsboolfalseOn: 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_groupslist of stringsunset (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_detailsbooltrueOff: health results only say healthy or unhealthy, without deployment parameters and the full provider error. Applied at startup.
use_shared_health_checkboolfalseOn: 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_thresholdinttwice the intervalSeconds after which a stored result is too old to route on. Also accepted under router_settings.
health_check_ignore_transient_errorsboolfalseOn: 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_endpointboolfalseOn: 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_tokenstringunsetThe 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_routingboolfalseOn, 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_SECONDSenv, int60Seconds one health check may take before it counts as failed. model_info.health_check_timeout overrides it per deployment.
DEFAULT_HEALTH_CHECK_PROMPTenv, stringtest from spanwayThe text a chat health check sends.
BACKGROUND_HEALTH_CHECK_MAX_TOKENSenv, intunsetmax_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_REASONINGenv, intunsetmax_tokens for health checks of reasoning models only, which need more room to answer at all.
allow_public_health_readiness_detailsboolfalseShapes what /health/readiness shows callers without a key. Described once under Admin UI settings.
alertinglistunsetAlerting integrations, slack, webhook, email, see alerting.
alert_typeslistthe types marked on by default in alert typesWhich 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_urlmapunsetWebhook per alert type.
alerting_argsmapunsetReport intervals, alert quiet periods and outage counts, see alerting. The PagerDuty thresholds live here too, see PagerDuty.
alert_type_configmapunsetPer alert type digest (default false) and digest_interval (default 86400 seconds), which collect repeats into one summary message, see digest mode.
alerting_thresholdint300Seconds a request may run before it counts as slow or hanging. DEFAULT_SLACK_ALERTING_THRESHOLD changes the default.
SLACK_WEBHOOK_URL, ALERTING_WEBHOOK_URLenvironmentunsetThe Slack compatible webhook for alerts. ALERTING_WEBHOOK_URL is used when SLACK_WEBHOOK_URL is unset.
SLACK_DAILY_REPORT_FREQUENCYenvironment43200Default seconds between the slow and failing deployment reports.
EMAIL_INCLUDE_API_KEYenvironmentfalseOn 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_TTLenvironment0.8, 86400When the max budget email goes out and how long the same one stays quiet, see email.
default_key_max_budget_alert_emailsspanway_settingsunsetBudget email thresholds with extra recipients for every key, see email.
EMAIL_SUBJECT_INVITATION, EMAIL_SUBJECT_KEY_CREATED, EMAIL_SUBJECT_KEY_EXPIRING, EMAIL_SUBJECT_KEY_COMPROMISEDenvironmentunsetReplace one email subject each. Needs a license, see email branding.
otelboolunsetHas no effect, nothing reads it. Turn OpenTelemetry on with callbacks: ["otel"] under spanway_settings, see OpenTelemetry and OpenTelemetry settings.
spend_report_frequencystring7dHow 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​

KeyTypeDefaultMeaning
public_mcp_hub_strict_whitelistbooltrueA 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_hubboolfalseLet 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_hubboolfalseOlder 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_catalogueboolfalsePublishes 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_hoursint24Window the catalogue aggregates over.
public_catalogue_cache_secondsint60Catalogue cache lifetime.
public_statusboolfalseServe GET /public/status without authentication, see status page.
public_status_cache_secondsint60How long the status payload is cached and advertised in Cache-Control: max-age.
status_incident_uptime_thresholdfloat9924 hour uptime percent under which GET /status/suggestions proposes an incident.
analytics_queryobjectunsetQuery 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_anomaliesobjectunsetUsage 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_reportsbooltrueLets 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_minuteint10Leaked 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_minuteint120How 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_assistantboolfalseServe the website assistant at POST /public/assistant/chat and GET /public/assistant/search.
public_assistant_originslisthttps://www.spanway.ai, https://spanway.aiWebsites allowed to call the assistant chat route.
public_assistant_index_bucketstringunsetS3 bucket, or file:// directory, holding the assistant knowledge index.
public_assistant_daily_turn_ceilingint5000Most 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.

KeyTypeDefaultMeaning
public_model_groupslistunsetThe 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_linksobjectunsetThe Useful Links shown on the AI hub, each a name with an http or https URL and a display index.
public_agent_groupslistunsetThe agents listed on the AI hub.
public_mcp_serverslistunsetThe 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.

KeyTypeDefaultMeaning
disable_model_add_for_internal_usersboolfalseOn, 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_userboolfalseOn, team admins cannot remove members from their teams, which suits teams whose members come from SCIM. Off, they may.
enabled_ui_pages_internal_userslistunsetThe 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_apiboolfalseOn, 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_headersboolfalseOn, 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_usersboolfalseOn, internal users lose the Agents page and the agent management routes.
allow_agents_for_team_adminsboolfalseOn, team admins keep agent access while the switch above is on.
disable_vector_stores_for_internal_usersboolfalseOn, internal users lose the Vector Stores page and its management routes.
allow_vector_stores_for_team_adminsboolfalseOn, team admins keep vector store access while the switch above is on.
disable_custom_api_keysboolfalseOn, 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_adminboolfalseOn, 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_orgboolfalseOn, 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_uiboolfalseOn, the sidebar shows the Chat page. Off, it is hidden.
allow_public_health_readiness_detailsboolfalseOn, /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_fieldslist[]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.

KeyTypeDefaultMeaning
cloud.enabledboolfalseOn, 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_urlstringrequiredThe Admin UI address used in emails and checkout links, and the API address shown to tenants.
cloud.verification_ttl_hoursint24How long a signup verification link works.
cloud.trial_daysint14Accepted for older configs. No trial is started today.
cloud.credit_check_ttl_secondsint60From 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_usdfloat5.0The balance under which a tenant gets a low balance alert.
cloud.zero_completion_insurancebooltrueOn, a request whose model produced nothing is not charged. Off, every request is charged.
cloud.signup_allowlistlistunsetUnset, 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_usdfloat1.15From 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_idstringunsetThe 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.regionstringus-east-1The 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_urlsobjectemptyThe 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.plansobjectthe built-in tiersPrices and limits per tier. An overridden tier replaces the whole built-in tier, so a limit you leave out means unlimited.

Evals​

KeyTypeDefaultMeaning
eval_remote_scorer_hostslist of stringsunsetHosts (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_hostslist of stringsunsetHosts (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_perioddurationunsetDeletes human review items older than this, see Human review. Unset keeps them.
EVAL_CI_MAX_ACTIVE_RUNSenvironment5How 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_SECONDSenvironment7200After 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_TASKSenvironment32How 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_ROWSenvironment10000How 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​

KeyTypeDefaultMeaning
mcp_internal_ip_rangeslist of CIDRsRFC 1918 and loopbackNetworks that count as internal for servers not available on the public internet.
mcp_advertised_versionslistlegacy revisionsProtocol revisions offered to clients.
mcp_allowed_clientslist of {alias, value}unsetClient applications admitted, see MCP access control.
mcp_client_id_headerstringunsetHeader 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_rangeslist of CIDRsunsetOlder 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_hopsintunsetWhich 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_documentboolunsetPrefer the gateway's client metadata document over dynamic registration, see MCP OAuth.
mcp_required_fieldslist of stringsunsetFields a submitted server must fill in.
user_mcp_management_moderestricted or view_allunsetWhat non admins see on the MCP Servers page.
enable_mcp_registryboolunset (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_signingobjectunsetSign 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.

VariableDefaultWhat it does
SPANWAY_ENABLE_ADMIN_MCPfalsetrue 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_ROLEproxy_adminThe 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_ONLYfalsetrue or 1 offers only the tools that read, so an assistant can never change anything.
SPANWAY_ADMIN_TOOLSallA comma separated allow list of tool names. An unknown name stops the gateway from starting.
SPANWAY_MCP_PUBLIC_URLPROXY_BASE_URLThe public HTTPS origin clients use. Requests naming another host are refused, which stops DNS rebinding.
SPANWAY_ADMIN_RESPONSE_VIEWfullcompact returns results over 16 KB as an index the assistant pages through, which keeps its context small.
SPANWAY_ADMIN_SCHEMA_MODEfulldiscovery advertises short tool schemas and lets the assistant ask for the rest, which makes the tool list smaller.
SPANWAY_ADMIN_AGENT_URLunsetThe 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_TOKENunsetThe 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.

VariableDefaultWhat it changes
SPANWAY_ENABLE_MCP_STDIOoffAllows MCP servers that run as a local command (stdio). Off keeps the gateway from starting programs on its own host.
SPANWAY_MCP_STDIO_EXTRA_COMMANDSemptyComma-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_TIMEOUT60 secondsHow long one call to an upstream MCP server may take.
SPANWAY_MCP_TOOL_LISTING_TIMEOUT30 secondsHow long listing a server's tools may take before it counts as a timeout.
SPANWAY_MCP_METADATA_TIMEOUT10 secondsHow long fetching a server's OAuth metadata may take.
SPANWAY_MCP_HEALTH_CHECK_TIMEOUT10 secondsHow long one MCP server health check may take.
MCP_NPM_CACHE_DIR/tmp/.npm_mcp_cacheWhere npx based stdio servers keep their package cache. Mount a writable volume there on a read-only root filesystem.
DEFAULT_MCP_SEMANTIC_FILTER_EMBEDDING_MODELtext-embedding-3-smallThe embedding model the semantic tool filter uses when its settings name none.
DEFAULT_MCP_SEMANTIC_FILTER_TOP_K10How many tools the semantic filter keeps when its settings name no top_k.
DEFAULT_MCP_SEMANTIC_FILTER_SIMILARITY_THRESHOLD0.3The lowest similarity a tool needs to be kept when the settings name no threshold.
MAX_MCP_SEMANTIC_FILTER_TOOLS_HEADER_LENGTH150The longest x-spanway-semantic-filter-tools response header, in characters. Longer lists are cut.
MCP_OAUTH2_TOKEN_CACHE_MIN_TTL10 secondsThe shortest time an upstream OAuth token is cached.
MCP_PER_USER_TOKEN_DEFAULT_TTL43200 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_SECONDS60How 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_SIZE500How many exchanged on-behalf-of tokens the gateway keeps in memory.
MCP_SSO_ASSERTION_CACHE_TTL_SECONDS60How 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​

KeyTypeDefaultMeaning
enable_claude_code_gatewayboolunsetServe the Claude Code gateway protocol under /claude_code_gateway, see Claude Code gateway.
claude_code_gateway_managed_settingsobjectunsetManaged settings served verbatim to Claude Code.
skill_scan_guardrailslistunsetGuardrails 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_modefail_closed or fail_openfail_closedWhat 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​

KeyTypeDefaultMeaning
workflow_runner.enabledbooltrueRun 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_secondsfloat2How often each replica claims ready steps and renews its leases.
workflow_runner.lease_secondsint30How long a claimed step stays with a replica that stops renewing it.
workflow_runner.max_concurrent_steps_per_podint16Steps one replica runs at the same time.
workflow_runner.capture_iobooltrueLet 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_secondsint0How 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_reclaimsint3Times 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_stepsint16Steps one organization, team or key may have running at once across every replica.
workflow_runner.default_tenant_max_active_runsint200Pending, running or paused runs one organization, team or key may have. More starts or resumes answer 429.
workflow_runner.backlog_alert_secondsint300Raise 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_depthint4How 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_stepsint500Steps 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​

KeyTypeDefaultMeaning
workflow_triggers.enabledbooltrueRun the workflow trigger jobs and accept trigger writes. Needs a database.
workflow_triggers.inbound_webhooksboolfalseServe 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_podint50Inbound webhook requests per second per replica.
workflow_triggers.inbound_max_per_ip_per_minuteint600Inbound webhook requests per client IP per minute.
workflow_triggers.cron_poll_secondsfloat15How often each replica looks for due cron triggers.
workflow_triggers.dispatch_poll_secondsfloat2How often each replica claims pending fires.
workflow_triggers.index_ttl_secondsint30How long a replica caches the event types triggers subscribe to.
workflow_triggers.fire_retention_daysint30Days fire rows and processed events are kept.
workflow_triggers.min_cron_interval_secondsint60Shortest allowed gap between two cron fires.

Environments​

KeyTypeDefaultMeaning
environments.namestringunsetThis 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_approvalbooltrueMake 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_minutesint60How long a plan stays appliable, from 1 to 1,440 minutes.

Workload identity​

KeyTypeDefaultMeaning
workload_identity.trustlistunsetTrust 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_secondsint900Lifetime 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_hoursint24Hours 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​

KeyTypeDefaultMeaning
sanctions_geofence.enabledboolfalseRefuse requests from restricted places with HTTP 451, see sanctions geofence. Spanway Cloud always enforces it.
sanctions_geofence.on_unknownallow or blockallowWhat to do with requests whose location cannot be resolved.
sanctions_geofence.geoobjectunsetprovider (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_networkslistunsetPlaces and CIDR ranges always allowed.
sanctions_geofence.extra_block_countries, extra_block_subdivisionslistunsetPlaces blocked on top of the policy.
sanctions_geofence.policy_pathstringunsetYour 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.

KeyTypeDefaultMeaning
on_possible_match_existingalert or holdalertalert 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_unavailablehold or allowholdhold 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_hoursint, 24 to 744168How often the lists are downloaded. Shorter catches new listings sooner.
max_data_age_daysint, 1 to 6010How old the active list may get before the status turns stale and an alert is sent.
sourceofac, mirror or localofacWhere the lists come from. local suits an air-gapped deployment.
mirror_urlstringunsetYour mirror of the OFAC files, used with source: mirror.
local_dirstringunsetThe folder holding SDN.XML and CONSOLIDATED.XML, used with source: local.
sdn_sha256, consolidated_sha256stringunsetThe SHA-256 of the local files, so a tampered copy is refused.
max_removed_sharenumber, above 0 to 10.05The 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.

VariableTypeDefaultMeaning
DEFAULT_ACCESS_GROUP_CACHE_TTLseconds600How 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.

KeyTypeDefaultMeaning
scim_upsert_userbooltrueWhat 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_groupstringunsetThe 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"]
KeyTypeDefaultMeaning
default_internal_user_paramsobjectunsetWhat 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_budgetfloatunsetThe 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_durationstringunsetHow often that default budget resets, for example 30d. Applied the same way as max_internal_user_budget.
budget_exceeded_status_codeint422The 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_percentagefloatunsetA 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_paramsobjectunsetValues every new key gets when the request leaves them out, for example max_budget or models.
upperbound_key_generate_paramsobjectunsetThe 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_settingsobjectunsetWho 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_validationboolfalseOn: 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_patternstringunsetYour 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
KeyTypeDefaultMeaning
enable_json_schema_validationboolfalseOn, 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_paramsboolfalseOn, 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_codeint422Also applies to inference routes. Described once under users, keys and budgets.
request_timeoutfloat6000Seconds 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_filesboolfalseOn, 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_cachebool, "all" or list of modelsfalseOn, 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_modelist of models[]Models that keep using the provider's own background mode even when polling through the cache is on.
responses.background_mode.ttlint3600Seconds a polled background response stays in Redis.
vector_store_search_failure_modeannotate or errorannotateWhat 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 variableWhereDefaultMeaning
guardrailstop levelnoneThe 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.
policiestop levelnoneNamed groups of guardrails with optional inheritance and conditions.
policy_attachmentstop levelnoneWhere each policy applies, by scope, team, key, model or tag. Needs no license.
skip_system_message_in_guardrailspanway_settingsfalseOn 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_guardrailspanway_settingsfalseOn 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_BASEenvironmentnoneThe Presidio analyzer address used by a Presidio guardrail that sets none of its own.
PRESIDIO_ANONYMIZER_API_BASEenvironmentnoneThe Presidio anonymizer address, used the same way.
GENERIC_GUARDRAIL_API_BASEenvironmentnoneThe service address used by a generic guardrail API guardrail that sets no api_base.
MAX_POLICY_ESTIMATE_IMPACT_ROWSenvironment1000How 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_SECONDSenvironment86400 (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
KeyTypeDefaultMeaning
websearch_interception_params.enabled_providerslistunset, meaning Bedrock onlyProviders 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_namestringfirst configured search toolThe entry of search_tools that runs the searches.
websearch_interception_params.max_agentic_loopsint3Follow-up model calls one request may chain. Each loop is one more billed model call plus the search cost.
code_interpreter_interception_params.enabledbooltrueOn, 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_providerslistunset, meaning every providerProviders whose requests are intercepted.
code_interpreter_interception_params.sandbox_tool_namestringunsetThe entry of sandbox_tools that runs the code. Required, a request fails when no sandbox can be found.
code_interpreter_interception_params.allow_internet_accessboolfalseOn, 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_toolslistunsetTop-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.

SettingWhereDefaultMeaning
token_rate_limit_typegeneral_settingstotalWhich 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_reservationspanway_settingsunsetShares 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_priorityspanway_settings0.25The share of a model's capacity that keys with no priority class share between them.
priority_reservation_settings.saturation_thresholdspanway_settings0.50How 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_ttlspanway_settings60Seconds 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_capspanway_settingsunsetThe largest share of a model one team may use, even while borrowing idle capacity. Unset means no cap.
priority_reservation_settings.active_team_splitspanway_settingsfalseOn, 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_limita deployment's spanway_paramsunsetA 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_SIZEenvironment60Length 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_ENABLEDenvironmenttrueOn, 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_LIMITINGenvironmentfalseOn, 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.

SettingWhereDefaultMeaning
cost_discount_configspanway_settingsunsetA 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_configspanway_settingsunsetA 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_pricingspanway_settingsfalseOn, 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_budgetedspanway_settingsfalseLike the switch above, but only for requests that have a key, team, user, customer, organization, per-model or global budget.
SPANWAY_MODEL_COST_MAP_URLenvironmentthe public price mapWhere the price map is fetched from, an https:// or file:// URL.
SPANWAY_MODEL_COST_MAP_SHA256environmentunsetThe 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_MAPenvironmentFalseTrue uses only the price map bundled with the build and never fetches one.

See custom pricing for the full behaviour.

Budgets and resets​

SettingWhereDefaultMeaning
timezonespanway_settingsUTCThe time zone budget resets follow, for example America/Chicago, so a daily budget resets at your midnight instead of UTC midnight.
budget_reset_timespanway_settings00:00The 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_TIMEenvironment597, 605The 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_SIZEenvironment500Budgets the reset job updates per database write.
RESET_BUDGET_JOB_MAX_CHUNKS_PER_RUNenvironment100Batches one run of the reset job handles. Anything left waits for the next run.
proxy_batch_write_atgeneral_settings10Seconds 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_MSenvironment5000How 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.

KeyTypeDefaultMeaning
spanway_settings.cacheboolfalseOn turns the response cache on with cache_params. Off answers every request from the provider.
cache_params.typestringlocalThe backend, such as redis, redis-semantic, s3 or qdrant-semantic. local is per worker and not shared between replicas.
cache_params.modedefault_on or default_offdefault_ondefault_off caches only requests that send "cache": {"use-cache": true}.
cache_params.ttlfloat, secondsunsetHow long an entry lives. Unset keeps Redis entries until they are deleted or evicted.
cache_params.namespacestringunsetPrefix for every cache key, so environments sharing one Redis stay apart.
cache_params.supported_call_typeslistcompletion, embedding, transcription, text completion, rerank, Responses and Anthropic Messages callsWhich calls are cached.
cache_params.max_messagesint4Requests 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_ttlfloat, secondsunsetReplace ttl for the local backend or for the Redis backends.
cache_params.similarity_thresholdfloatunset, 0.8 in the Admin UIRequired similarity for semantic backends, from 0 to 1.
cache_params.semantic_cache_scopekey or end_userkeyWho may share a semantic hit, see cache backends.
cache_params.host, port, password, username, url, sslstring, boolunsetRedis 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.

SettingEnvironment variableDefaultMeaning
enable_anthropic_prompt_cachingSPANWAY_ENABLE_ANTHROPIC_PROMPT_CACHINGfalseOn, 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_ttlSPANWAY_ANTHROPIC_PROMPT_CACHING_TTLunset (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_firstnonefalseOn, 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_COUNTthe variable itself1024The 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_paramsnoneunsetSettings 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.

KeyTypeDefaultMeaning
prompt_integrationstringrequiredWhere the template lives: dotprompt, langfuse, gitlab, bitbucket, arize_phoenix, generic_prompt_management or custom.
prompt_filepathunsetOne .prompt file to load.
dotprompt_contentstringunsetThe whole dotprompt template inline.
prompt_idstringthe entry's prompt_idThe id the integration looks the template up by.
ignore_prompt_manager_modelboolfalseOn, the request's own model wins over the prompt's model. Off, the prompt picks the model.
ignore_prompt_manager_optional_paramsboolfalseOn, the request's own parameters such as temperature win. Off, the prompt's parameters are used.
api_base, api_keystringunsetAddress and key of a remote prompt service. Use os.environ/NAME for the key.
provider_specific_query_paramsmapunsetExtra query parameters for a remote prompt service, such as a label.
prompt_info.environmentstringdevelopmentThe 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.

SettingDefaultMeaning
SPANWAY_LENS_URLunsetThe 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_URLunsetThe address browsers and agents use to reach Lens, which the Admin UI opens.
LENS_GATEWAY_SECRETunsetThe 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_URLunsetOptional. The Lens ClickHouse address with a user that may delete rows, so data subject erasure deletes Lens copies directly instead of asking Lens.
CLICKHOUSE_DATABASEspanwayThe 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_DAYS14How 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_TOKENunsetThe 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.typeunsetSet to lens to turn tracing on from config.yaml. The two variables above are still required.
TRACE_READ_RETRY_AFTER_SECONDS2The 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_SECONDS2The Retry-After sent with a busy or failed trace upload.
AGENT_TRACING_LIST_PAGE_SIZE50How many traces one page of GET /v1/traces returns. A larger page means fewer calls but slower answers.
AGENT_TRACING_AGENT_LIST_LIMIT500The 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.

SettingDefaultMeaning
LENS_ADMIN_TOKENrequiredThe worker's private login credential. The worker stops with a configuration error without it.
AGENT_TRACING_RETENTION_DAYS14How many days traces and request log copies are kept. Longer keeps more history and more prompt text.
LENS_KEEP_SPAN_CONTENTfalseKeep 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_MODELSunsetA JSON array of the deployments Lens may use for findings analysis, the list the Model dropdown of Findings settings offers.
LENS_EVALUATION_MODELSunsetA JSON array of the deployments Lens may use for signals and other evaluation calls.
LENS_EVAL_JUDGE_MODELunsetThe 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_KEYunsetThe 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_CHARSno limitThe 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_URLunsetPosts each new open finding to one Slack channel.
SPANWAY_LENS_LISTEN0.0.0.0:4318The address the worker listens on.
LENS_MODEunsetOnly 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.

KeyTypeDefaultMeaning
agent_access_default_denybooltrueWhether 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_tagsboolfalseOff (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_modelstringunsetThe 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_indexboolfalseOn, 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_indexboolfalseOn, 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_usersboolfalseOn, 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_adminsboolfalseOnly 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.

VariableDefaultMeaning
SPANWAY_MAX_ITERATIONS_TTL3600Seconds 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_TTL3600The same for a session's spend under max_budget_per_session.
SPANWAY_SENSITIVE_ROUTING_TTL3600Seconds 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_TIMEOUT6000Seconds 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_TIMEOUT5.0Seconds the Health Check switch on the Agents page waits for one agent.
SPANWAY_AGENT_HEALTH_CHECK_GATHER_TIMEOUT30.0Seconds 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.

VariableDefaultMeaning
SPANWAY_CODE_GRAPH_DATABASE_URLunsetTurns 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_URLunsetA 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_SIZE5Connections in the application role's pool. A value that is not a whole number stops the code graph from starting.
SPANWAY_CODE_GRAPH_PARTITIONS1Hash 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_WORKERembeddedembedded 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_POLLonon 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_CREDENTIALunsetThe stored credential that holds your GitHub App. Unset, Install GitHub App answers 503.
SPANWAY_CODE_GRAPH_PARSER_PYTHONthe gateway's interpreterThe interpreter that runs the sandboxed parser. When it cannot parse a sample, indexing stays off and the gateway logs why.
SPANWAY_CODE_GRAPH_PARSER_ISOLATIONlinux_netns on Linux, darwin_sandbox on macOSHow 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_HOSTSunsetComma-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_HOSTSunsetComma-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.

KeyTypeDefaultMeaning
callbacks: ["prometheus"]listunsetTurns metrics on. Off, /metrics answers 404.
require_auth_for_metrics_endpointbooltrueOn, /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_metricsboolfalseOn, 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_configlistunsetRecord only the listed metrics, each with only the listed labels. Unknown names stop startup.
prometheus_exclude_metrics, prometheus_exclude_labelslistunsetDrop metrics or labels everywhere. Unknown names stop startup.
prometheus_metrics_max_series_per_metricintunsetSeries cap per metric. Past it, counters and histograms add to one series whose labels are other.
prometheus_metrics_ttl_secondsfloatunsetForget series not updated for this long. Ignored with several workers.
prometheus_metrics_cleanup_interval_secondsfloat60How often expired series are removed.
prometheus_end_user_metrics_max_series_per_metricint10000Series cap for metrics with end_user.
prometheus_end_user_metrics_ttl_seconds, prometheus_end_user_metrics_cleanup_interval_secondsfloat3600, 60How long an end_user series lives without updates and how often they are checked.
prometheus_latency_bucketslist of floatsunsetLatency histogram bucket bounds in seconds, replacing the built-in ones.
prometheus_emit_stream_labelboolfalseAdd stream to the request counter.
prometheus_emit_input_sequence_length_labelboolfalseAdd a prompt length bucket label.
prometheus_emit_rate_limit_labelsboolfalseAdd rate_limit_category and rate_limit_type to failed requests, so a 429 says who limited it.
prometheus_deployment_and_latency_caller_identitystringapi_key_aliasThe 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_aliasboolfalseAdd user_email and user_alias to user budget gauges. Personal data.
custom_prometheus_metadata_labelslist[]Request metadata fields to add as labels, such as metadata.project.
custom_prometheus_tagslist[]Request tags to add as tag_<name> labels.
enable_end_user_cost_tracking_prometheus_only, disable_end_user_cost_tracking_prometheus_onlyboolunsetFill, 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.

VariableDefaultMeaning
OTEL_EXPORTER, OTEL_EXPORTER_OTLP_PROTOCOLconsole, or otlp_http once an endpoint is setotlp_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_ENDPOINTunsetThe collector address. The second wins when both are set.
OTEL_HEADERS, OTEL_EXPORTER_OTLP_HEADERSunsetHeaders sent with every export, such as an API key. The second wins when both are set.
OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENTunset, meaning NO_CONTENTWhether spans carry prompt and answer text: NO_CONTENT, SPAN_ONLY, EVENT_ONLY or SPAN_AND_EVENT.
OTEL_SERVICE_NAME, OTEL_ENVIRONMENT_NAME, OTEL_MODEL_IDspanway, production, the service nameHow the gateway names itself in your traces.
OTEL_IGNORE_CONTEXT_PROPAGATIONfalseOn, incoming traceparent headers are ignored and every request starts a new trace.
SPANWAY_OTEL_BAGGAGE_TEAM_METADATA_KEYS, SPANWAY_OTEL_BAGGAGE_METADATA_KEYSunsetTeam 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_EVENTSfalseAlso export OpenTelemetry metrics, or semantic log events.
SPANWAY_OTEL_V2falseUse the version 2 logger, which follows the OpenTelemetry gen_ai conventions.
OTEL_TRACES_ENDPOINT, OTEL_EXPORTER_OTLP_TRACES_ENDPOINTunsetThe 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_NAMEspanwayThe names your tracing tool shows as the source of spans, metrics and log events.
OTEL_SEMCONV_STABILITY_OPT_INunsetOpt in to newer OpenTelemetry attribute names, for example gen_ai_latest_experimental.
USE_OTEL_SPANWAY_REQUEST_SPANfalseOn, a spanway_request span is always added, even under a caller's own span.
OTEL_LOGS_EXPORTERthe span exporterWhere log events go when events are on: console, otlp_http or otlp_grpc.
OTEL_EXPORTER_OTLP_CERTIFICATE, OTEL_EXPORTER_OTLP_TRACES_CERTIFICATEunsetA CA bundle for a collector that uses its own certificate.
DEBUG_OTELfalseOn, every export is logged at DEBUG. Use it for one investigation only, it is noisy.
SPANWAY_OTEL_LEGACY_COMPAT, SPANWAY_OTEL_LANGFUSE_SPAN_SCOPEtrue, fullVersion 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.

SettingWhereDefaultMeaning
callbacksspanway_settingsnoneDestinations 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_callbackspanway_settingsnoneDestinations that receive successful requests only. The Admin UI's Logging & Alerts page adds to this list.
failure_callbackspanway_settingsnoneDestinations that receive failed requests only, for example an incident tool.
turn_off_message_loggingspanway_settingsfalseOn 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_disablingspanway_settingsfalseOn 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_paramspanway_settingsfalseOn 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​

SettingWhereDefaultMeaning
store_audit_logsspanway_settingsfollows the licenseOn 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_LOGSenvironmentunsetThe same switch, used only when store_audit_logs is not set.
audit_log_callbacksspanway_settingsnoneAlso 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_paramsspanway_settingsunsetBucket 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​

SettingWhereDefaultMeaning
worker_registrytop level of config.yamlunsetMakes 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​

SettingWhereDefaultMeaning
STRIPE_SECRET_KEYenvironmentunsetLets billing create Stripe customers and invoices. Unset, issuing or voiding a Stripe invoice answers 502.
STRIPE_WEBHOOK_SECRETenvironmentunsetThe signing secret of the Stripe webhook endpoint. Unset, every call to /billing/webhook/stripe answers 400.
SPANWAY_BILLING_METRICS_ENDPOINTenvironmentunsetTurns on usage metering to Spanway's collector, together with the client certificate and key below.
SPANWAY_BILLING_METRICS_CLIENT_CERTenvironmentunsetClient certificate for usage metering, a path or the PEM text.
SPANWAY_BILLING_METRICS_CLIENT_KEYenvironmentunsetClient key for usage metering, a path or the PEM text.
SPANWAY_BILLING_METRICS_CA_CERTenvironmentunsetOnly for a private collector whose certificate is not publicly trusted.
SPANWAY_BILLING_METRICS_EXPORT_INTERVAL_MSenvironment60000How often usage counts are sent.
SPANWAY_MARKETPLACE_PROVIDERenvironmentunsetTurns 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_PRICINGenvironmenthourlyHow the AWS Marketplace listing is priced: hourly, contract or usage. Set from marketplace.aws.pricing.
SPANWAY_AWS_MARKETPLACE_PRODUCT_CODEenvironmentunsetThe listing's product code, required for hourly and usage pricing.
SPANWAY_AWS_MARKETPLACE_PRODUCT_SKUenvironmentunsetThe listing's product SKU, required for contract pricing.
SPANWAY_AWS_MARKETPLACE_METERINGenvironmentunset, which means offtrue 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.

MethodPathSummary
GET/coordination_redis/settingsRead the coordination Redis settings
POST/coordination_redis/settingsSave the coordination Redis settings
POST/coordination_redis/settings/testTest a coordination Redis connection

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.

MethodPathSummary
GET/config_overrides/cyberarkRead the CyberArk Conjur connection
POST/config_overrides/cyberarkSave the CyberArk Conjur connection
DELETE/config_overrides/cyberarkRemove the CyberArk Conjur connection
POST/config_overrides/cyberark/test_connectionTest the CyberArk Conjur connection
GET/config_overrides/hashicorp_vaultRead the HashiCorp Vault connection
POST/config_overrides/hashicorp_vaultSave the HashiCorp Vault connection
DELETE/config_overrides/hashicorp_vaultRemove the HashiCorp Vault connection
POST/config_overrides/hashicorp_vault/test_connectionTest the HashiCorp Vault connection

Change a setting and confirm it​

  1. Find the key in the tables above and note which section it belongs to. Most keys here go under general_settings.

  2. 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.

  3. 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.

  4. 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​

SymptomMeaningFix
A setting has no effect although --validate_config printed config OKThe 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 1The 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 deployThe 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 settingsThe 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.