Skip to main content

Good defaults

GoModel uses a good defaults philosophy. This means that the default settings should be enough to use it.

How to override the default settings?

We use a three-layer configuration pipeline. Every setting has a sensible default, so you can start the server with zero configuration.
As GoModel works out of the box with no configuration files, you can try it in a minute.Start here: Quick Start
GoModel automatically discovers providers from well-known environment variables.

Configuration Methods

1. Environment Variables

The most common way to configure GoModel. Set any of the variables below to override defaults.

Server

MCP Gateway

See MCP Gateway for the full feature guide.

Logging

Runtime logger output. For the persisted API audit trail (request/response bodies, headers), see Audit Logging below.

Cache

See Cache for exact-cache behavior, response headers, analytics endpoints, and the note that user_path alone does not partition the exact cache.
CACHE_REFRESH_INTERVAL also sets how often the dashboard re-checks provider health (“Last checked”), and PROVIDER_RECHECK_INTERVAL how quickly a failed provider is re-probed for recovery. See Resilience.

Storage

Storage is shared by audit logging, usage tracking, and future features like IAM.

Audit Logging

When LOGGING_LOG_BODIES is enabled, request and response bodies are stored in full. These may contain sensitive data such as PII or API keys embedded in prompts.
LOGGING_LOG_AUDIO_BODIES refines LOGGING_LOG_BODIES for audio endpoints — it has no effect unless body logging is enabled. With both on, /v1/audio/speech stores its text input and the generated audio (base64, capped at 8 MB) so the dashboard can play it back, and /v1/audio/transcriptions stores the uploaded audio (base64, capped at 8 MB, also playable) plus its upload metadata. It defaults to false because audio payloads are large and grow the audit store quickly. When body logging is on but this is off, audio bodies (the speech response and the transcription upload, which keeps its metadata) are recorded as a lightweight {__audio__, content_type, bytes, stored: false} placeholder; when body logging is off, no audio body is stored at all.

Token Usage Tracking

Budgets

Budgets use tracked usage cost records. If usage tracking is disabled, GoModel starts with budget management disabled and logs a warning. SET_BUDGET_<PATH> supports the standard periods hourly, daily, weekly, and monthly. The <PATH> suffix is lowercased; use double underscores (__) between path segments, while single underscores stay inside a segment. For example, SET_BUDGET_TEAM__ALPHA__SERVICE="daily=10" configures /team/alpha/service, and SET_BUDGET_TEAM_ALPHA="daily=10" configures /team_alpha. This differs from provider <SUFFIX> variables below, which convert underscores to hyphens in provider names. SET_BUDGET_="monthly=500" means a literal environment variable named SET_BUDGET_, which configures the root path /. POSIX permits that name, but some shells and orchestrators, including some Kubernetes validators, may reject it. Use YAML or the dashboard when your environment cannot set it. Migration note: budget management depends on usage tracking. If USAGE_ENABLED=false, GoModel starts with budgets disabled and logs a warning, even when BUDGETS_ENABLED=true. Set both USAGE_ENABLED=true and BUDGETS_ENABLED=true to enforce budgets. See Budgets for YAML examples, periods, matching, and workflow enforcement.

Metrics

Prometheus support is experimental. See the Prometheus Metrics guide for details.

Admin

Live dashboard logs are compact previews for the Audit Logs and Usage pages. They update rows before the async database flush finishes. The stored audit and usage tables remain the source of truth; if a browser reconnects with a cursor outside the replay window, the dashboard reloads from the normal REST APIs.

HTTP Client

These control timeouts for upstream API requests to LLM providers.

Provider API Keys

Set these to automatically register providers. No YAML configuration required. Most providers can use a custom base URL via <PROVIDER>_BASE_URL (for example OPENAI_BASE_URL). DeepSeek defaults to https://api.deepseek.com; set DEEPSEEK_BASE_URL only for a compatible proxy or alternate DeepSeek endpoint. OpenRouter defaults to https://openrouter.ai/api/v1 and can be overridden with OPENROUTER_BASE_URL. Z.ai defaults to https://api.z.ai/api/paas/v4; set ZAI_BASE_URL=https://api.z.ai/api/coding/paas/v4 for the GLM Coding Plan endpoint. vLLM defaults to http://localhost:8000/v1 when VLLM_API_KEY is set, but keyless deployments should set VLLM_BASE_URL explicitly to register the provider. Azure uses AZURE_BASE_URL for its deployment base URL and accepts an optional AZURE_API_VERSION override; otherwise it defaults to 2024-10-21. Oracle requires ORACLE_BASE_URL because its OpenAI-compatible endpoint is region-specific. Every provider type also accepts a comma-separated configured model list via <PROVIDER>_MODELS, for example OPENROUTER_MODELS, ORACLE_MODELS, AZURE_MODELS, or VLLM_MODELS. By default, CONFIGURED_PROVIDER_MODELS_MODE=fallback uses configured lists only when upstream /models fails, returns nil, or returns an empty list. Set CONFIGURED_PROVIDER_MODELS_MODE=allowlist to expose only configured models for providers that define a list and skip their upstream /models calls. YAML providers.<name>.models provides the same model-list input for named provider blocks. For OpenRouter, GoModel also sends default attribution headers unless the request already sets them. Override those defaults with OPENROUTER_SITE_URL and OPENROUTER_APP_NAME.

2. .env File

GoModel automatically loads a .env file from the working directory at startup. This is convenient for local development.
Copy .env.template to .env and uncomment the values you need:
Real environment variables always override values from the .env file. The .env file is only loaded if it exists — missing it is not an error.

3. Configuration File (YAML)

For more complex setups, you can use an optional YAML configuration file. GoModel looks for it in two locations (in order):
  1. config/config.yaml
  2. config.yaml
If you are deciding whether you need YAML at all, see config.yaml. To get started, copy the example:
Then uncomment and edit the settings you want to change:
The YAML file supports environment variable expansion using ${VAR} and ${VAR:-default} syntax:
The YAML file is entirely optional. Any setting you can put in YAML can also be set via environment variables. Use YAML when you need per-provider resilience overrides, generated provider names are not enough, or you prefer a structured config file.

Provider Configuration

Auto-Discovery from Environment Variables

The simplest way to add providers. GoModel checks for well-known API key environment variables and automatically registers providers:
Use suffixed variables to register more than one instance of the same provider type without YAML. GoModel normalizes the suffix to lowercase and converts underscores to hyphens in the configured provider name:
The same pattern works for every registered provider type: <PROVIDER>_<SUFFIX>_API_KEY, <PROVIDER>_<SUFFIX>_BASE_URL, and <PROVIDER>_<SUFFIX>_MODELS. Azure also supports <PROVIDER>_<SUFFIX>_API_VERSION. Azure and Oracle still require their suffixed BASE_URL values because their endpoints are deployment- or region-specific. Google Vertex AI uses the VERTEX_* prefix and follows the same suffix-to-name rule as other providers:

YAML Provider Blocks

For more control (custom names, per-provider resilience, or larger structured settings), use the YAML file:
models: works for every provider block. In fallback mode it is a safety net when upstream /models is unavailable or empty. In allowlist mode it becomes the exposed inventory for that provider and skips upstream /models. For Oracle GenAI, see the Oracle GenAI guide for the required OCI policy and a tested configuration.

Ollama (Local Models)

Ollama does not require an API key. Set the base URL to enable it:
Or in YAML:

vLLM

vLLM uses its OpenAI-compatible /v1 API. In Docker, set VLLM_BASE_URL to register a keyless vLLM server:
If the upstream server was started with vllm serve ... --api-key token-abc123, also set:
You can also register more than one vLLM instance without YAML:
This registers providers vllm and vllm-test. Use YAML only when the generated provider names are not enough or you need a larger structured block.

Provider Behavior Notes

Anthropic max_tokens default

Anthropic requires max_tokens on every /v1/messages request. If a client omits it, GoModel injects a fallback so the request still succeeds. OpenAI and Gemini treat the field as optional and GoModel does not inject a default for them. Raise this for newer models that routinely produce longer outputs (Sonnet 4.6, Opus 4.7). Setting max_tokens explicitly on a request always wins over the env-driven default. Invalid or non-positive values fall back to 4096.