Overview
Advanced configuration options allow fine-tuning of the CLI Proxy API behavior including network proxies, request payload manipulation, custom headers, retry strategies, and streaming optimizations.Proxy Configuration
Global proxy URL for outbound requests. Supports Examples:
socks5, http, and https protocols.Format:Per-Provider Proxy Override
Each provider supports per-credential proxy configuration:Custom Headers
Add custom HTTP headers to upstream provider requests.Custom headers for provider requests. Applied to all requests made with this credential.Example:
Supported Providers
All API key providers support custom headers:gemini-api-keyclaude-api-keycodex-api-keyopenai-compatibilityvertex-api-key
Headers Example
Passthrough Headers
When true, forward filtered upstream response headers to downstream clients.Forwarded headers include:
Content-TypeX-Request-ID- Custom provider headers
Security-sensitive headers (Authorization, Set-Cookie) are always filtered and never forwarded.
Retry Configuration
Number of times to retry a request. Retries occur if HTTP response code is 403, 408, 500, 502, 503, or 504.Example:
Maximum number of different credentials to try for one failed request.Values:
0- Try all available credentials (legacy behavior)- Positive integer - Limit credential rotation
Maximum wait time in seconds for a cooled-down credential before triggering a retry.Example:
Quota Exceeded Behavior
Behavior when API quota limits are exceeded.
Retry Example
Routing Strategy
Credential selection strategy when multiple credentials match.Supported values:
"round-robin"- Distribute requests evenly across all credentials"fill-first"- Use first credential until quota exhausted, then next
Streaming Configuration
Server-side streaming behavior (SSE keep-alives and safe bootstrap retries).
Emit blank lines every N seconds for non-streaming responses to prevent idle timeouts.Values:
0- Disabled (default)- Positive integer - Interval in seconds
Streaming Example
Payload Rules
Payload rules allow modification of request payloads before forwarding to upstream providers.Default and override parameter rules applied to provider payloads.
Payload Rule Structure
Each rule contains:models- List of model patterns and protocol constraintsparams- JSON path → value mappings (or array of paths for filter rules)
Payload Examples
Default Rules (Set if Missing)
Default Raw Rules (Raw JSON)
Override Rules (Always Set)
Override Raw Rules
Filter Rules (Remove Parameters)
Model Patterns
Supports wildcard matching:"gpt-*"- Prefix match (gpt-4, gpt-5, etc.)"*-mini"- Suffix match (gpt-4-mini, claude-3-haiku-mini, etc.)"*codex*"- Substring match (gpt-5-codex, codex-turbo, etc.)"gemini-2.5-pro"- Exact match
Protocol Constraints
Supported protocols:"openai"- OpenAI Chat Completions format"gemini"- Google Gemini format"claude"- Anthropic Claude format"codex"- OpenAI Codex format"antigravity"- Gemini 3.0 experimental
WebSocket Authentication
When true, enable authentication for the WebSocket API (
/v1/ws).Example:WebSocket authentication uses the same API keys as HTTP requests.
Complete Advanced Configuration Example
Best Practices
Retry Strategy:
- Higher
request-retryincreases reliability but adds latency - Set
max-retry-credentialsto prevent exhausting all keys on persistent failures - Adjust
max-retry-intervalbased on your quota reset periods
Troubleshooting
Proxy Not Working
- Verify proxy URL format (protocol://host:port)
- Test proxy connectivity outside the application
- Check firewall rules allow proxy connections
- Verify authentication credentials if required
Payload Rules Not Applied
- Check model name pattern matches exactly (case-sensitive)
- Verify protocol constraint matches provider
- Validate raw JSON strings are well-formed
- Check server logs for rule validation errors
Headers Not Forwarded
- Ensure
passthrough-headers: true - Check upstream provider actually sends the headers
- Verify headers are not security-sensitive (filtered automatically)
Excessive Retries
- Lower
request-retryvalue - Set
max-retry-credentialsto limit credential rotation - Check upstream provider status (may be down)
- Review quota limits and cooldown periods