Skip to main content

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

Most capable model for complex tasks.

Authentication

Function Calling

Cohere supports function calling with automatic tool translation.

Streaming

Embeddings

Latest embedding models with improved performance.

Reranking

Cohere’s rerank models improve search results.

Citations

Cohere automatically provides citations for grounded responses.

Configuration

Supported Parameters

Error Handling

LiteLLM Proxy

Use Cohere through the LiteLLM proxy server.

Best Practices

  • Use max_completion_tokens instead of deprecated max_tokens
  • Monitor token usage via response.usage
  • Cohere uses billed units for accurate billing
  • Use Command R for balanced performance/cost
  • Use Command R+ for complex reasoning
  • Enable streaming for faster perceived response times
  • LiteLLM automatically converts OpenAI format to Cohere format
  • Use force_single_step=True when needed
  • Handle tool results properly in conversation history