Overview
LiteLLM provides comprehensive support for Cohere’s models including Command R+, chat completions, embeddings, and reranking capabilities.Quick Start
1
Install LiteLLM
2
Set API Key
3
Make Your First Call
Supported Models
- Command R+
- Command R
- Command
Most capable model for complex tasks.
Authentication
- Environment Variable
- Direct Parameter
Function Calling
Cohere supports function calling with automatic tool translation.Streaming
Embeddings
- v3 Models
- v2 Models
- Input Types
Latest embedding models with improved performance.
Reranking
Cohere’s rerank models improve search results.Citations
Cohere automatically provides citations for grounded responses.Configuration
- Basic Config
- Cohere-Specific
Supported Parameters
Error Handling
LiteLLM Proxy
Use Cohere through the LiteLLM proxy server.Best Practices
Token Management
Token Management
- Use
max_completion_tokensinstead of deprecatedmax_tokens - Monitor token usage via
response.usage - Cohere uses billed units for accurate billing
Performance
Performance
- Use Command R for balanced performance/cost
- Use Command R+ for complex reasoning
- Enable streaming for faster perceived response times
Function Calling
Function Calling
- LiteLLM automatically converts OpenAI format to Cohere format
- Use
force_single_step=Truewhen needed - Handle tool results properly in conversation history