Skip to main content
The goal in GoModel is to make config.yaml optional as much as possible. Prefer environment variables for normal deployments, CI, containers, and secret injection. Use config.yaml when you need structure that env vars cannot express cleanly, especially:
  • per-provider resilience overrides
  • custom provider instance names that do not fit the generated <provider-type>-<suffix> env naming
  • richer reviewable provider model lists, especially when using allowlist mode
  • reviewable budget limits by user_path
  • larger nested config that is easier to review in one file
For multiple provider instances, env vars support <PROVIDER>_<SUFFIX>_API_KEY, <PROVIDER>_<SUFFIX>_BASE_URL, and <PROVIDER>_<SUFFIX>_MODELS. The suffix becomes a hyphenated provider name: OPENAI_EAST_API_KEY registers openai-east, and OLLAMA_A_BASE_URL registers ollama-a. Azure also supports <PROVIDER>_<SUFFIX>_API_VERSION. Google Vertex AI follows the same suffix-to-name rule (VERTEX_US_PROJECT registers vertex-us). Vertex project, location, and other Vertex settings must use the same suffix for each instance: for example, pair VERTEX_US_PROJECT with VERTEX_US_LOCATION, not the generic VERTEX_PROJECT or VERTEX_LOCATION. VERTEX_AUTH_TYPE defaults to gcp_adc. Configured provider model lists can stay in env via <PROVIDER>_MODELS, for example OPENROUTER_MODELS, ORACLE_MODELS, AZURE_MODELS, SGLANG_MODELS, VLLM_MODELS, or LLMD_MODELS. llm-d instances also accept suffixed LLMD_<SUFFIX>_INFERENCE_OBJECTIVE and LLMD_<SUFFIX>_FAIRNESS_FROM_USER_PATH controls.

Models modes

CONFIGURED_PROVIDER_MODELS_MODE (YAML: models.configured_provider_models_mode) decides how a provider’s configured list combines with what its /models endpoint returns. It only matters for providers that define a list. With allowlist, only the configured IDs are served: models the provider lists but you didn’t configure are never added, and requests for any other model return 404 (model not found). To let discovery drive the list again, set CONFIGURED_PROVIDER_MODELS_MODE=fallback, or override one provider with <PROVIDER>[_SUFFIX]_MODELS_MODE / models_mode. fallback and merge read the provider’s /models on every refresh. allowlist reads it only for metadata — context window, max output tokens, pricing, display name, and model type — for your listed models, while ALLOWLIST_UPSTREAM_METADATA is true (the default; YAML: models.allowlist_upstream_metadata) and GOMODEL_OFFLINE is off. That call never adds models, but upstream prices can decide which configured models pass a model_filter.max_price_per_mtok cap. If it fails, the metadata from the last successful listing is kept.
Breaking change: the default used to be fallback. Under the default allowlist mode, providers with a models: or <PROVIDER>_MODELS list now serve only those models (providers set to fallback or merge are unaffected); set CONFIGURED_PROVIDER_MODELS_MODE=fallback to keep the old behavior.
Set models_mode on a provider to override the global mode for that provider only. Leave it unset to use the global mode. For example, you can expose a single OpenRouter model while self-hosted providers keep discovering their own:
The dashboard’s provider dialog exposes the same setting as Models mode under the advanced options.

Filtering a provider’s models

model_filter narrows a provider’s inventory to the models you actually want routable. Use it when a provider’s catalog is far larger than what you want to expose — for example running OpenRouter’s free tier for experiments while a separate provider serves production traffic.
Patterns are globs matched case-insensitively against the raw provider model ID. * matches any run of characters including /, so *:free matches deepseek/deepseek-r1:free; ? matches exactly one character. A model with no known pricing is dropped while max_price_per_mtok is set: a price cap that lets models of unknown price through is not a cap. Prices come from the model registry and from what the provider itself reports — OpenRouter publishes its own rates, so its catalog (:free variants included) is priced without extra configuration. Local providers usually report no pricing at all, so filter those by pattern rather than by price. max_price_per_mtok must be a finite number of 0 or more. A negative, NaN, or infinite cap fails startup rather than silently rejecting every model or disabling the cap, and so does an env value that is not a number at all — a cost control the operator believes is in force must never be quietly absent. Filtering applies to the final inventory, after configured_provider_models_mode has resolved, so it also narrows models added by models. Filtered models leave the routable catalog entirely: they disappear from GET /v1/models and requests for them return “model not found”. Filtering is a view over what a provider serves, not a deletion. The gateway keeps the unfiltered inventory in memory and in its model cache, so loosening a filter — or a model becoming cheap enough to pass the cap — restores it at the next metadata refresh, without waiting for a successful upstream /models call. The same filters are available per provider in env:
Each rule overlays independently, so an env price cap narrows a YAML pattern filter without restating the patterns. Suffixed instances use the same rule as other provider env vars: OPENROUTER_EU_MODEL_FILTER_INCLUDE configures openrouter-eu.

Priority Order

Effective precedence is:
  1. environment variables
  2. optional config/config.yaml or config.yaml
  3. built-in defaults from code
.env is not a separate priority layer. It is just a convenient way to load environment variables before startup. Each layer is applied on top of the previous one, so a provider declared in config.yaml and overlaid by env vars still counts as coming from the file.

Startup Validation

Declarative config is parsed strictly: an unknown key is a startup error, not a silently ignored one. This catches typos (prot: instead of port:) and, more importantly, misindented sections — see the gotcha below. This applies to config.yaml and to the env vars that declare the same structures as JSON: VIRTUAL_MODELS, SET_RATE_LIMIT_*, and SET_BUDGET_*. Because env entries override YAML entries, a typo in one of them would otherwise silently win over a correct YAML entry. The default is strict because a dropped providers, rate_limits, budgets, or guardrails entry silently changes routing, cost, or security — a cost cap that never applies looks exactly like a cost cap that does. Set CONFIG_STRICT=false to downgrade unknown keys to warnings and boot without them. This is for rolling a binary back under a newer config file, not for everyday use:
CONFIG_STRICT relaxes which keys are accepted, never whether a value makes sense. A malformed value (port: [9999, 8080]) aborts startup in either mode. Entity-level validation also still applies: a virtual model whose target names a provider that does not exist fails startup even when the key that would have declared that provider was ignored with a warning. To confirm which layer supplied your providers, GoModel logs one line at boot:
from_config_file: 0 while a file is loaded means the file contributed no providers. GoModel also logs config file loaded with the resolved path, or no config file found with the paths it searched.

Current Schema

The current source of truth lives in the main codebase: For deployments mounted below a domain root, set server.base_path or BASE_PATH. For example, BASE_PATH=/g serves the gateway at /g/v1/..., /g/admin/..., and /g/health. To change the inbound user path header, set server.user_path_header or USER_PATH_HEADER. The default remains X-GoModel-User-Path. Edits to this file are applied to a running gateway with gomodel --reload, which re-reads the file and the environment and rebuilds the gateway in place — see CLI Operations. Nothing changes if the new file fails to load. server.port and server.pid_file are the exceptions: both are fixed for the life of the process, so a reload logs a warning and keeps the running values until the gateway is restarted.

Exporting the Effective Configuration

gomodel config export prints the settings a gateway started now would run with as one config.yaml, ready to review, commit, or load on another instance. It reads the files, environment, and database afresh, so it shows what the next start would run, which after a rejected reload is not what the running gateway holds. When the current files no longer load, it fails with the same error. A few objects have no config.yaml form and are left out; see the end of this section.
Settings that hold their default value are left out, since they load the same way, so the file shows only what differs from the defaults. A setting that differs is kept even when empty, such as enable_passthrough_routes: false or an explicit empty list such as retry_on_statuses: [], and so is a ${VAR} expansion or a secret reference, whatever it gives. A gateway with nothing configured exports {}. Defaults that depend on where the gateway runs, such as storage.sqlite.path, are left out too, so the instance that loads the file uses its own. Pass --include-defaults to also write the defaults, for a file that keeps its values when a later version changes one. Settings that are empty by default ("", 0, false, unset) are left out either way.
Write the export to a new file, not onto the config.yaml the gateway reads: the shell empties that file before the command starts, so the original is gone. Run locally, the command then refuses to print. Through docker exec it cannot tell, since its output goes to Docker rather than the file, and it exports defaults from the emptied file.
It reads the same configuration, environment, and database as the gateway, so run it where the gateway runs, with the same environment. It is safe while the gateway is running. Logs go to stderr; stdout holds only the file. There is no HTTP endpoint or dashboard button for it: exporting needs shell access to the gateway, not an admin login. The file merges built-in defaults, config.yaml, environment variables, and the objects saved in the dashboard: providers, virtual models, users, MCP servers, budgets, rate limits, and tagging headers. Loaded as config.yaml, those dashboard objects become read-only in the dashboard, like any other declared object. Secrets are not written. Each one appears as where it comes from:
A file with such a comment does not start until you set that variable, so it never runs with an empty master key or credential. Secrets include API keys, the master and encryption keys, MCP env values, MCP and OpenTelemetry headers, URL passwords, connection-string passwords, the values of credential flags in MCP args (--api-key=..., --token ...), and plugin settings the plugin marks as secret. Under extensions:, plugin settings, and maps such as resource_attributes, any string under a key naming a credential (token, api_key, password, auth, …) counts as one too. So does any other text holding a secret’s value, a Bearer token, or a credential assignment such as password=.... In plugin settings and under extensions:, the value of a Name: value header line is one when the name names a credential (X-Proxy-Key: ...) or the value is a Bearer token or Basic credentials, as in a header_edit rule’s upstream_set, commented out with # or not. Each such line gets its own variable; the header name and the other lines are kept.
Free-form text, such as a description typed into the dashboard, is checked for those shapes only. A bare token pasted into one is written as is, so review such text before sharing an export.
Other settings keep their ${VAR} expansions as written in config.yaml. Text saved in the dashboard is written so it loads back as the same text: a $ in it is escaped (\x24), so a description such as ${env:GOMODEL_MASTER_KEY} stays text and never becomes a reference. These have no config.yaml form and are listed as not exported in the file’s header: managed API keys, workflows, guardrails created in the dashboard (they run only in the workflows that name them, while guardrails.rules adds each rule to the default workflow), model pricing overrides, runtime settings, disabled provider credentials, and MCP server display names.

Docker

GoModel reads config/config.yaml first, then config.yaml. With docker run, you can keep a host file named config.yml and mount it to the in-container path GoModel expects:
With Docker Compose:
If env vars and YAML both define the same setting, the environment variable wins.
If the mounted path exists but cannot be read — most often a directory bind-mounted where a file was expected — startup fails rather than silently falling back to defaults.

Gotchas

Unresolved ${VAR} placeholders drop the provider

If ${OPENAI_API_KEY} appears in YAML but the env var is not actually set, the literal string ${OPENAI_API_KEY} ends up as the API key value. The credential filter detects the ${ substring and removes the provider entirely. This also applies if ${VAR} appears in the middle of the value, such as prefix-${OPENAI_API_KEY}. Always verify your env vars are exported before starting the process, or supply a default: ${OPENAI_API_KEY:-}. To stop startup instead, use the strict secret reference ${env:OPENAI_API_KEY}.

A misindented providers: section is rejected

YAML reads this as an empty providers: section plus two unrelated top-level keys, not as two providers:
Strict parsing rejects it at startup, naming every offending line:
Indent provider entries two spaces under providers:. Before strict parsing, this booted with zero YAML providers and no error. With CONFIG_STRICT=false it boots with zero YAML providers and one warning per unindented key.

Per-provider resilience can only come from YAML

The env-var override walk skips map fields. RETRY_MAX_RETRIES changes the global default for all providers but cannot target a single provider. Per-provider tuning requires a providers.<name>.resilience: block in config.yaml.

Partial YAML leaves the rest at defaults

YAML is unmarshalled onto a struct that has already been populated with built-in defaults. Only fields that appear in the file are written. Omitting max_backoff from resilience.retry leaves it at its built-in default; you do not need to repeat defaults you are happy with.
Last modified on November 23, 2026