Overview
The Settings Management API allows you to retrieve and update system-wide configuration settings for Codex-LB, including routing strategy, authentication requirements, and feature flags.All Settings endpoints require dashboard authentication via session cookie.
Get Settings
Retrieve current system settings.
Response
Whether to maintain thread affinity (keep same account for a conversation thread)
Whether to prefer accounts with earlier reset times for load balancing
Load balancing strategy:
usage_weighted or round_robinWhether to skip importing accounts that already exist (by identity)
Whether TOTP (2FA) is required for dashboard login
Whether TOTP has been configured for the admin user
Whether API key authentication is required for proxy endpoints
Example Request
Example Response
Update Settings
Update system settings. All boolean fields are required; optional fields default to current values.
Request Body
Enable thread affinity to keep conversations on the same account
Prioritize accounts with earlier quota reset times
Load balancing strategy:
usage_weighted: Route to accounts with more available capacityround_robin: Distribute requests evenly across accounts
Skip importing accounts that already exist in the database
Require TOTP (2FA) verification on every dashboard login
Require valid API key authentication for all proxy requests
Response
Returns the updated settings object (same structure as GET response).Example Request
Example Response
Error Responses
invalid_totp_config: Cannot enable TOTP requirement without configuring it first
Setting Descriptions
Routing Strategy
usage_weighted (Recommended)
usage_weighted (Recommended)
Routes requests to accounts with the most available capacity. This maximizes overall throughput and prevents quota exhaustion on individual accounts.Best for: Production environments with varying load patterns
round_robin
round_robin
Distributes requests evenly across all active accounts, regardless of their current usage levels.Best for: Testing environments or when you want predictable distribution
Thread Affinity
When
sticky_threads_enabled is true, requests with the same conversation thread ID are routed to the same Claude account. This can improve conversation coherence but may lead to uneven load distribution.API Key Authentication
When API key authentication is enabled:- All proxy endpoints (
/v1/*,/backend-api/codex/*,/backend-api/transcribe) require a valid Bearer token - The
/api/codex/usageendpoint remains accessible without authentication - Dashboard endpoints (
/api/*) continue to use session-based authentication
TOTP (Two-Factor Authentication)
Thetotp_required_on_login setting enforces 2FA for dashboard access:
- First, configure TOTP in the dashboard settings (sets
totp_configured: true) - Then enable the requirement via this API or the dashboard UI
- Subsequent logins will require a TOTP code from your authenticator app
You cannot enable
totp_required_on_login without first configuring TOTP. The API will return a 400 error if you try.Import Behavior
Whenimport_without_overwrite is enabled:
- Account imports check for existing identities before inserting
- If a matching identity exists, the import is skipped (no error)
- This prevents duplicate accounts when re-importing the same auth.json files
Cache Behavior
Settings are cached in memory for performance. When you update settings via the API:- Changes are written to the database
- The in-memory cache is invalidated
- Next request fetches fresh settings from the database
Authentication
All settings endpoints require dashboard authentication via session cookie. You must be logged in as an admin to view or modify settings.Common Error Codes
| Code | Description |
|---|---|
invalid_totp_config | Attempted to enable TOTP requirement without configuring it first |
unauthorized | Missing or invalid dashboard session cookie |