Settings & Auth API
Manage profile settings, create presets for quick configuration switching, and control global authentication tokens for CLIProxy.Overview
Settings endpoints provide:- Profile settings CRUD (Create, Read, Update, Delete)
- Preset management for model configurations
- Global auth token management (API key, management secret)
- Token regeneration and reset
- Conflict detection with optimistic locking
Authentication
All endpoints are available on localhost only (http://localhost:3000). No authentication required.Profile Settings
GET /api/settings/:profile
Get settings for a profile with masked API keys. Path Parameters:profile: Profile name or variant (e.g.,gemini,glm,agy)
********.
GET /api/settings/:profile/raw
Get full unmasked settings for editing.PUT /api/settings/:profile
Update settings with conflict detection and automatic backup. Path Parameters:profile: Profile name or variant
settings(required): Settings object withenvfieldexpectedMtime(optional): Timestamp for optimistic locking
- Optimistic Locking: Uses
expectedMtimeto detect concurrent edits - Automatic Backup: Creates backup before modification in
~/.ccs/backups/ - Atomic Write: Temp file + rename for crash safety
- Validation Warning: Alerts if required fields missing (non-blocking)
Presets
GET /api/settings/:profile/presets
Get saved presets for a profile.POST /api/settings/:profile/presets
Create a new preset configuration. Request Body:name(required): Preset namedefault(required): Default modelopus(optional): Opus tier modelsonnet(optional): Sonnet tier modelhaiku(optional): Haiku tier model
DELETE /api/settings/:profile/presets/:name
Delete a preset by name.Global Auth Tokens
GET /api/settings/auth/tokens
Get current auth token status with masked values.isCustom:trueif user-provided,falseif default
GET /api/settings/auth/tokens/raw
Get unmasked auth tokens.PUT /api/settings/auth/tokens
Update global auth tokens and regenerate CLIProxy config. Request Body:apiKey(optional): New API key (empty string to reset to default)managementSecret(optional): New management secret
Changes require CLIProxy restart to take effect. Config is regenerated automatically.
POST /api/settings/auth/tokens/regenerate-secret
Generate a new 32-character management secret.POST /api/settings/auth/tokens/reset
Reset auth tokens to defaults.Account Management
DELETE /api/accounts/reset-default
Reset default account to CCS default.Error Responses
Security Features
- API Key Masking: Automatic masking for display endpoints
- Optimistic Locking:
mtime-based conflict detection prevents data loss - Atomic Writes: Temp file + rename ensures crash safety
- Automatic Backups: Previous settings saved before updates
- No Cache Headers: Sensitive endpoints (
/raw,/auth/tokens/raw) prevent caching - Localhost Only: API only accessible on 127.0.0.1
