Skip to main content
GoModel wraps every upstream provider call with two resilience layers:
  1. Retry with exponential backoff — repeats a failed request against the same provider with growing delays.
  2. Circuit breaker — short-circuits calls to a provider that has been failing repeatedly, then probes once the timeout elapses.
Both layers apply per provider. They do not switch to a different model or provider on failure. For cross-model fallback, see Failover.

Defaults

The defaults are tuned to be safe for most deployments. Override only what you need.

Environment Variables

These set the global defaults that apply to every provider unless overridden in YAML.

Retry

Circuit Breaker

YAML

The same fields are available under the global resilience: block, and can be overridden per provider:
Only fields explicitly listed under a provider’s resilience: block are overridden. Everything else inherits from the global section, which in turn inherits from the built-in defaults.
Per-provider tuning must come from YAML. Environment variables set global defaults only — RETRY_MAX_RETRIES cannot target a single provider. See config.yaml gotchas.

Worked example

Given the YAML above, the effective per-provider settings are: anthropic and ollama inherit every field they did not explicitly override.

Failover vs. Resilience

The retry and circuit breaker layers stay on a single provider. If you also want GoModel to try a different model or provider when the primary keeps failing, configure manual fallback rules. See Failover.