- Alternative API providers (Deepseek, Together AI, etc.)
- Self-hosted model endpoints
- Corporate API gateways
- Regional API endpoints
- Custom routing services
Provider Types
Crush supports two main provider types:OpenAI-Compatible APIs
Use for services that implement OpenAI’s API format.Anthropic-Compatible APIs
Use for services that implement Anthropic’s API format.Crush distinguishes between
"openai" and "openai-compat" types. Choose carefully to ensure the best experience.OpenAI vs OpenAI-Compat
It’s important to understand the difference between these two types:"openai" Type
Use when:
- Proxying or routing requests through OpenAI
- Using OpenAI’s actual API with a custom gateway
- Your endpoint is OpenAI with additional middleware
- Corporate OpenAI API proxy
- OpenAI API with custom authentication
- Azure OpenAI Service
"openai-compat" Type
Use when:
- Using non-OpenAI providers with OpenAI-compatible APIs
- The service mimics OpenAI’s API format but uses different models
- Self-hosting models with OpenAI-compatible servers
- Deepseek API
- Together AI
- Local models (Ollama, LM Studio)
- Perplexity API
- Groq API
OpenAI-Compatible Configuration
Here’s a complete example using Deepseek, which provides an OpenAI-compatible API:Configuration Fields
type: Set to"openai-compat"for non-OpenAI providersbase_url: The API endpoint (without trailing slash for model paths)api_key: API key, supports environment variable expansion ($VAR_NAME)models: Array of model configurations
Anthropic-Compatible Configuration
For services that implement Anthropic’s API format:Configuration Fields
type: Set to"anthropic"for Anthropic-compatible APIsbase_url: The API endpointapi_key: API key, supports environment variable expansionextra_headers: Optional additional HTTP headers (e.g., API version)models: Array of model configurations
Model Metadata
Providing accurate model metadata helps Crush optimize its behavior and track costs:Required Fields
id: Model identifier used in API requests (must match provider’s model ID)name: Human-readable display name
Cost Fields
Costs are specified in USD per 1 million tokens:cost_per_1m_in: Input token costcost_per_1m_out: Output token costcost_per_1m_in_cached: Cached input token cost (if applicable)cost_per_1m_out_cached: Cached output token cost (if applicable)
Set cost fields to
0 if the service is free or you don’t want to track costs.Context Windows
context_window: Maximum total tokens (input + output)default_max_tokens: Default maximum tokens for responses
Capabilities
Optional boolean fields that describe model features:can_reason: Model supports extended thinking/reasoning (e.g., Claude 3.5 Sonnet with extended thinking)supports_attachments: Model can process file attachmentssupports_vision: Model can analyze imagessupports_function_calling: Model supports function/tool calling
Example: Complete Model Configuration
Environment Variable Expansion
Crush supports environment variable expansion in configuration values using the$VAR_NAME syntax:
- Keep sensitive credentials out of configuration files
- Use different values per environment (dev/staging/prod)
- Share configuration files without exposing secrets
Multiple Providers
You can configure multiple custom providers in the same configuration file:Troubleshooting
Provider Not Appearing
If your custom provider doesn’t show up:- Verify JSON syntax is valid
- Check that the provider ID doesn’t conflict with built-in providers
- Ensure environment variables are set and exported
- Restart Crush to reload configuration
API Connection Errors
If Crush can’t connect to your API:- Verify
base_urlis correct and accessible - Check API key environment variable is set
- Test the endpoint with
curlto confirm it’s working - Check firewall/network settings
Wrong Model Behavior
If the model behaves unexpectedly:- Verify you’re using the correct
type(openaivsopenai-compat) - Check that
idmatches the provider’s model identifier exactly - Ensure
context_windowmatches the model’s actual limits - Review provider documentation for API compatibility
Cost Tracking Issues
If costs aren’t tracked correctly:- Verify cost fields are set in USD per 1 million tokens
- Check that cost values match provider’s current pricing
- Use
crush statsto view token usage and costs
Best Practices
- Use environment variables for all sensitive credentials
- Keep costs updated to reflect current provider pricing
- Test with small requests before committing to large operations
- Document custom configurations in your project’s README
- Validate API compatibility with a simple test before full integration
- Set realistic token limits based on model capabilities
- Monitor usage with
crush statsto avoid unexpected charges
Next Steps
Local Models
Run local models with Ollama or LM Studio
Air-Gapped Environments
Configure Crush for restricted network access