Settings Reference

Complete reference of every configurable parameter, default value, and behavior in ClawRouter.

Version 1.0.18


Provider Settings

These settings are configured per provider in the Settings tab of the provider's detail page.

Core Settings

SettingDefaultOptionsDescription
NameFrom template or user inputAny stringUnique identifier for the provider. Also generates the provider ID (URL slug).
API FormatFrom templateopenai-completions, openai-responses, anthropic-messages, google-generative-ai, elevenlabsDetermines how ClawRouter communicates with the upstream provider. Set at creation, read-only after.
Upstream URLFrom templateAny valid URLThe base URL of the upstream AI provider's API.
Enabledtruetrue / falseWhether the provider accepts proxy requests. Disabled providers are also excluded from fallback chains.

Key Management Settings

SettingDefaultOptionsDescription
API Key ModeManagedManaged, None, Pass ThroughHow API keys are handled for this provider.
Key Rotation ModeOn ErrorOn Error, Round RobinWhen to rotate between managed keys. Only applies when API Key Mode = Managed.
Requests Per Key1Any positive integer(Round Robin only) Number of requests sent to one key before rotating to the next.

API Key Mode Details

ModeBehavior
ManagedClawRouter stores and manages multiple API keys. The client's API key header is stripped and replaced with the managed key. Supports rotation, backoff, and automatic disabling.
NoneNo API key is sent to the upstream. The proxy strips any auth headers from the client request and sends the provider's Default Headers instead. Use for keyless providers (OpenCode Zen, Kilo AI (Free), Ollama Local). Key-add endpoints return 400 for these providers.
Pass ThroughThe client's API key is forwarded to the upstream without modification. No key rotation or management. ClawRouter acts as a transparent proxy for auth.

Default Headers

SettingDefaultDescription
Default Headers (default_headers)None (preset-dependent)Static headers (JSON object) merged into every upstream request. Managed/Pass Through auth still takes precedence on conflict. Keyless presets use this to send required headers automatically (e.g., OpenCode Zen's Authorization: Bearer public + x-opencode-client: desktop).

Automatic Anthropic Version Header

For anthropic-messages providers, ClawRouter automatically sends anthropic-version: 2023-06-01 when the client didn't include it (any casing) -- required by Anthropic-format upstreams such as Anthropic itself, Kimi for Coding, and MiniMax Coding. A client-sent value is always preserved.

Reliability Settings

SettingDefaultOptionsDescription
Timeout120000 ms (2 minutes)Any positive integer (ms)Maximum time to wait for an upstream response before considering it a timeout.
Retry on TimeoutEnabledEnabled / DisabledIf enabled, a timeout triggers a retry with the next available key. If disabled, the timeout error is returned to the client.
Model FallbackDisabledEnabled / DisabledIf enabled, model-level errors trigger automatic retry with the next model in the fallback list. Configured in the Models tab.

Global Settings

These settings apply to the entire proxy and are configured on the Settings page in the dashboard sidebar.

Key Retry Behavior

SettingDefaultOptionsDescription
Key Retry Mode (key_retry_mode)allall, fixedall -- try every available key before giving up. fixed -- try at most key_retry_limit keys before giving up.
Key Retry Limit (key_retry_limit)5Any positive integerMaximum number of keys to try per request when Key Retry Mode is fixed. Ignored when mode is all.

Rate Limit & Circuit Breaker

SettingDefaultOptionsDescription
Rate Limit Backoff (rate_limit_backoff_s)60Any positive integer (seconds)How long a key is put in cooldown after hitting a rate limit (HTTP 429).
Quota Backoff (quota_backoff_s)180060 - 86400 (seconds)Fallback backoff for window-quota exhaustion (Kimi Coding 5-hour/weekly/monthly cycles, Z.AI 5-hour/7-day windows) when no exact reset time is known; also caps reset times parsed from error bodies. Per-key window resets from quota snapshots/usage probes (and monthly-cycle anchors) are exact and bypass this cap, with a 30-day sanity ceiling. The key is never disabled -- it recovers when the window resets.
Circuit Breaker Threshold (circuit_breaker_threshold)5Any positive integerNumber of provider-level failures (all keys exhausted) within the failure window before the circuit opens.
Circuit Breaker Cooldown (circuit_breaker_cooldown_s)30Any positive integer (seconds)How long the circuit stays OPEN before transitioning to HALF_OPEN for a recovery test.
Model Circuit Threshold (model_circuit_threshold)21 - 100Consecutive failures before a model's circuit opens and the model is skipped (routed straight to the next fallback model).
Model Circuit Permanent Cooldown (model_circuit_permanent_cooldown_s)180030 - 86400 (seconds)Model-circuit cooldown for not-found/invalid/gated model errors (MODEL_ERROR).
Model Circuit Transient Cooldown (model_circuit_transient_cooldown_s)12010 - 3600 (seconds)Model-circuit cooldown for overloaded/rate-limited model failures (OVERLOADED / RATE_LIMIT).

Log Retention

SettingDefaultOptionsDescription
Auto Cleanup Logs (auto_cleanup_logs)truetrue / falseWhether old request logs are automatically deleted on a periodic schedule.
Log Retention Days (log_retention_days)7Any positive integerNumber of days to keep request logs before automatic deletion. Only applies when Auto Cleanup Logs is enabled.

Proxy Authentication

SettingDefaultOptionsDescription
Require Proxy API Key (proxy_auth_enabled)truetrue / falseRequire the proxy API key on all /proxy/* requests. Clients send it as Authorization: Bearer <key> or x-api-key: <key>; invalid or missing keys get HTTP 401. The key itself is managed from the Proxy API Key card on the Settings page.

Global settings are stored in the database and take effect immediately. Changes to circuit breaker parameters apply to new failure tracking -- existing circuit breaker states are not retroactively affected.

Appearance (Browser-Local)

SettingDefaultOptionsDescription
Provider Icon StyleColorColor, MonoHow provider brand icons are rendered across the dashboard. Managed from the Appearance card on the Settings page; applies instantly. Stored in the browser's local storage (clawrouter-icon-style) -- per-device, not synced, not part of the global settings API. Brands without a color variant render mono in both modes; unmapped/custom providers get a 2-letter brand-color tile.

Key Rotation Strategies

On Error (Default)

BehaviorDetail
Primary keyAlways uses the highest-priority (first) eligible key
Rotation triggerOnly when the current key encounters an error
Best forMaximizing usage of a single primary key before rotating
Rate limit handlingFailed key enters cooldown (default 60s, configurable), next key used
Quota window exhaustionFailed key backed off until its own exhausted window's reset (window-accurate per key; quota_backoff_s default 1800s only when no exact reset is known), never disabled -- recovers automatically
Auth error handlingFailed key permanently disabled, next key used

Round Robin

BehaviorDetail
Key distributionRotates evenly across all eligible keys
Rotation triggerAfter requests_per_key requests, rotates to next key
WrappingAfter the last key, wraps back to the first
Best forLoad balancing across multiple free-tier keys to avoid rate limits
Error handlingSame as On Error (backoff, disable, etc.)

Circuit Breaker Parameters

The Circuit Breaker is automatic and applies per-provider. Threshold and cooldown are configurable in the Settings page.

ParameterDefaultConfigurableDescription
Failure Threshold5Yes (circuit_breaker_threshold)Number of provider-level failures to trigger the circuit
Failure Window60 secondsNoTime window for counting failures
Cooldown Duration30 secondsYes (circuit_breaker_cooldown_s)Time the circuit stays OPEN before testing recovery
Recovery Test1 requestNoNumber of test requests in HALF_OPEN state

Circuit Breaker States

StateMeaningRequest Handling
CLOSEDNormal operationAll requests go to this provider
OPENProvider failed (threshold reached within 60s window)All requests skip this provider and go to fallback chain
HALF_OPENTesting recovery after cooldownOne test request sent. Success > CLOSED. Failure > back to OPEN.

Circuit breaker is in-memory and resets on proxy restart. Can be manually reset from the Settings tab.


Model Circuit Breaker Parameters

The Model Circuit Breaker is automatic and applies per model, per provider. When a model fails model_circuit_threshold consecutive times, the router skips it entirely -- requests route straight to the next fallback model with no upstream call. One model_circuit_open notification fires at trip time; repeats are silent.

ParameterDefaultConfigurableDescription
Failure Threshold2Yes (model_circuit_threshold)Consecutive model failures before the circuit opens
Permanent Cooldown1800 secondsYes (model_circuit_permanent_cooldown_s)Cooldown for MODEL_ERROR (not found / invalid / gated)
Transient Cooldown120 secondsYes (model_circuit_transient_cooldown_s)Cooldown for OVERLOADED / RATE_LIMIT model failures
RecoverySuccess resets counterNoAfter cooldown the model is probed; a success closes the circuit

Open model circuits are visible as amber "Skipped" badges on the Models tab (GET /api/providers/:id/model-circuits). If every candidate model has an open circuit, the requested model is probed anyway (fail-open). Model circuits are in-memory and reset on proxy restart.


Fallback Chain Settings

Configured in the provider's Fallback tab or the global Fallback page (sidebar) -- both edit the same data.

Provider Fallback Chain Entry

FieldRequiredDescription
Fallback ProviderYesThe provider to route to on failure. Any provider can be a fallback -- cross-format targets are translated automatically (see API Format Translation).
ModelNoAutomatic (default): the originally requested model ID is tried on the fallback provider first; if rejected with a model error, ClawRouter cascades through the fallback provider's saved model list (requires Model Fallback enabled there). Pin a specific model ID to rewrite the request model instead.
PriorityAutoOrder in which fallbacks are tried (1 = first). Reorder with the arrows.

Model Fallback List Entry

FieldRequiredDescription
Model IDYesThe model identifier to try on fallback
Display NameYesHuman-readable name (usually same as ID)
PriorityAutoOrder in which models are tried (1 = first). Reorder with the arrows.

API Formats & URL Mapping

API FormatAuth MethodProxy URL PatternUpstream URL Path
openai-completionsBearer token/proxy/{id}/v1/v1
openai-responsesBearer token/proxy/{id}/v1/v1
anthropic-messagesx-api-key header/proxy/{id}/v1/v1
google-generative-aiQuery parameter ?key=/proxy/{id}/v1beta/v1beta
elevenlabsxi-api-key header/proxy/{id}/v1/v1

elevenlabs is a passthrough audio format (ElevenLabs Speech-to-Text / Text-to-Speech) -- no chat translation. See Providers > ElevenLabs (Audio).


Notification Types Reference

TypeSeverityBadge ColorTrigger Condition
key_disabledCriticalRedAPI key permanently disabled (AUTH_ERROR)
key_rate_limitedWarningYellowKey entered cooldown (RATE_LIMIT or QUOTA_EXHAUSTED window backoff)
circuit_openCriticalRedCircuit breaker tripped (5 failures in 60s)
provider_cooldownInfoGreenProvider recovered (circuit HALF_OPEN > CLOSED)
all_keys_failedCriticalRedEvery key for provider exhausted
model_fallbackInfoBlueModel error > switched to fallback model
model_circuit_openWarningAmberModel failed repeatedly > model circuit opened, model skipped
provider_fallbackWarningYellowProvider failure > switched to fallback provider

Storage: In-memory ring buffer, max 100. Cleared on restart. Delivered via WebSocket in real-time.

Throttling: Repeat-condition notifications (key_rate_limited, all_keys_failed, model_fallback, provider_fallback) are deduplicated for 5 minutes -- the first fires, repeats are suppressed while the condition persists. Transition events (key_disabled, circuit_open, provider_cooldown, model_circuit_open) always fire immediately.


Database Configuration

SettingValue
EngineSQLite (better-sqlite3)
Fileclawrouter.db (or DB_PATH env)
ModeWAL (Write-Ahead Logging)
Foreign KeysEnabled
SynchronousNORMAL
Request Body Limit10 MB
CORSEnabled (all origins)

Request Size Limits

LimitValue
Max request body10 MB
Max log body stored5 MB (configurable via MAX_LOG_BODY_SIZE)
Key error historyLast 50 errors per key
Notification bufferLast 100 notifications
Log retention7 days (configurable via Settings page or LOG_RETENTION_DAYS env)