Overview
CLI Proxy API supports adding custom OpenAI-compatible providers through theopenai-compatibility configuration. This allows you to integrate third-party services like OpenRouter, Groq, DeepSeek, Together AI, or any other service that implements the OpenAI API format.
Basic Configuration
Add providers to yourconfig.yaml under the openai-compatibility section:
config.yaml
Configuration Examples
OpenRouter
OpenRouter provides access to multiple AI models through a single API:config.yaml
Groq
Groq provides ultra-fast inference for open-source models:config.yaml
DeepSeek
DeepSeek offers competitive pricing for coding models:config.yaml
Together AI
Together AI provides access to open-source models:config.yaml
Advanced Configuration
Multiple API Keys
Configure multiple API keys for load balancing:config.yaml
Per-Key Proxy Settings
Route specific API keys through different proxies:config.yaml
Custom Headers
Add custom headers for provider-specific requirements:config.yaml
Model Prefixes
Use prefixes to organize providers:config.yaml
Model Pools
Create internal model pools for automatic failover:config.yaml
smart-model, CLI Proxy API will:
- Round-robin between the three upstream models
- Automatically failover if one model fails before producing output
- Expose only one model name (
smart-model) to clients
Excluding Models
Exclude specific models from being exposed:config.yaml
Integration Examples
Using with Cursor
Using with Cline
Using with curl
Model Discovery
List available models including custom providers:Management API
The Management API provides endpoints to manage OpenAI-compatible providers dynamically:List Providers
Add Provider
Update Provider
Delete Provider
Troubleshooting
Provider Connection Failed
If requests to your custom provider fail:-
Verify the
base-urlis correct -
Test the upstream API directly:
- Check for network/firewall issues
- Verify the API key is valid
Model Not Available
If a model doesn’t appear in the model list:- Check the
modelsconfiguration - Verify the upstream model name is correct
- Ensure no
excluded-modelspatterns are matching - Restart CLI Proxy API if you just added the provider
Authentication Errors
If you see authentication errors:- Verify the API key in
api-key-entriesis valid - Check if the provider requires specific headers (add them under
headers) - Some providers need API keys in custom header formats
Rate Limiting
If you hit rate limits:-
Add multiple API keys in
api-key-entries -
Configure request retry settings:
config.yaml
Best Practices
- Use descriptive aliases for easy model identification
- Configure multiple API keys for load balancing and redundancy
- Set up model pools for automatic failover between similar models
- Use prefixes to organize different provider groups
- Monitor costs by checking provider dashboards regularly
- Enable debug logging during initial setup:
debug: true - Test providers before production use with curl or similar tools
- Document model capabilities for your team (context length, pricing, etc.)
See Also
- Cursor Integration - Use custom providers with Cursor
- Cline Integration - Use custom providers with Cline
- Amp CLI Integration - Advanced model routing
- Management API - Dynamically manage providers