Unified.to
All articles

How to Get a Cohere API Key — and Connect It to Your Product

·

Cohere provides enterprise-grade language models and a set of dedicated AI endpoints that go beyond standard text generation. Cohere offers dedicated endpoints and models for embeddings and reranking alongside its chat models.

If you're building an AI-native SaaS product, retrieval system, or internal assistant, you'll need a Cohere API key.

This guide covers:

  1. Creating your Cohere account
  2. Generating and securing your API key
  3. Setting up billing
  4. Testing your first API call
  5. Using Cohere through Unified's Generative AI API
  6. Connecting Cohere to SaaS platforms via [Unified MCP](/mcp)

Cohere's Product Surface

Before getting your key, it's worth understanding what Cohere actually offers — because it's structurally different from other LLM providers:

Command models: text generation and conversation via the Chat API. As of 20 October 2026, the newest is Command A+ (command-a-plus-05-2026, released 20 May 2026).

Embed models — dedicated embedding endpoint for semantic search, clustering, and RAG pipelines. Cohere's Embed is a native embedding product, not a generic LLM approximating embeddings.

Rerank — a dedicated endpoint for reordering search results by semantic relevance. Designed specifically for search pipelines.

One API key covers all of these. The endpoint you call determines which product you're using.

Step 1: Create a Cohere Account

Go to https://dashboard.cohere.com and sign up with email, Google, or GitHub.

After verifying your email you'll be redirected to your dashboard. Cohere automatically generates a trial API key when you create an account — you don't need to create one manually for your first key.

Step 2: Locate Your API Key

In the dashboard sidebar, click API Keys.

Your trial key will be visible there. Copy it and store it securely.

Key names cannot contain spaces — use hyphens or underscores when naming keys (e.g., prod-backend, staging_worker).

Step 3: Create Additional Keys (Optional)

Click Create API Key to generate additional keys for different environments. Name each clearly:

  • development
  • staging
  • production

You can also create keys via the Cohere CLI:

co key create my-prod-key

You must be signed in to the CLI for this command. The same no-spaces rule applies.

Step 4: Understand Trial vs Production Keys

Trial keyProduction key
CostFreePay-per-token
Monthly cap1,000 API calls/monthNo cap, except on newer Chat model variants (1,000 API calls/month)
Chat RPM20 req/min per model500 req/min (Command A, R+, R, R7B); contact sales for Command A+, A Reasoning, A Translate, A Vision
Embed2,000 inputs/min2,000 inputs/min
Rerank10 req/min1,000 req/min
Tokenize100 req/min2,000 req/min
Billing requiredNoYes
Limits from Cohere's rate-limits page, as of 20 October 2026.

Trial keys are suitable for evaluation and development. For production workloads, upgrade to a production key by adding a payment method in Billing → Add payment method.

Step 5: Store Your Key Securely

Cohere's Python SDK reads CO_API_KEY by default — use that as your canonical environment variable name:

# macOS / Linux
export CO_API_KEY="your-api-key"

# Windows PowerShell
setx CO_API_KEY "your-api-key"

Note on environment variable names: CO_API_KEY is the canonical name that Cohere's SDK auto-detects. Any other variable name, such as COHERE_API_KEY, must be passed to the client explicitly. For maximum compatibility with Cohere's own tooling, standardize on CO_API_KEY.

For production: use a secrets manager — AWS Secrets Manager, GCP Secret Manager, or HashiCorp Vault. Never commit keys to Git or embed them in frontend code.

Step 6: Test Your API Key

Cohere's current SDK is ClientV2 with co.chat(). The old co.generate() pattern is deprecated as of September 15, 2025 — don't use it in new code.

Python (ClientV2):

import cohere

co = cohere.ClientV2()  # reads CO_API_KEY automatically

response = co.chat(
    model="command-a-03-2025",
    messages=[
        {"role": "user", "content": "Explain what an API key is in two sentences."}
    ]
)
print(response.message.content[0].text)

curl:

curl https://api.cohere.com/v2/chat \
  -H "Authorization: Bearer $CO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "command-a-03-2025",
    "messages": [
      {"role": "user", "content": "Explain what an API key is in two sentences."}
    ]
  }'

A successful response returns the model output in JSON.

Which Cohere Model Should You Use?

As of 20 October 2026, Cohere's Models page lists:

  • Command models (text generation): the newest is Command A+ (command-a-plus-05-2026, released 20 May 2026), which Cohere's own API examples use. command-a-03-2025, used in the examples on this page, is still live.
  • Embedding models: embed-v4.0, Embed 5 (embed-v5.0-pro, embed-v5.0-fast) and Embed v3 (embed-english-v3.0, embed-multilingual-v3.0), for semantic search, clustering and RAG retrieval.
  • Rerank models: rerank-v4.0-pro, rerank-v4.0-fast and rerank-v3.5, for reordering search results by semantic relevance.

For current prices, see Cohere's pricing page. Command A+ is free on trial and production keys until rate limits are reached; higher production limits for it are contact-sales (as of 20 October 2026).

Important: always use explicit, versioned model IDs, such as command-a-03-2025. The aliases command-r and command-r-plus were deprecated on 15 September 2025. List current IDs with co model list or Cohere's Models page.

Migrating from co.generate()****: if your code still uses co.generate(), migrate to co.chat() with a Command model. Cohere's Generate API was deprecated September 15, 2025. See Cohere's "Migrating from Generate to Chat" docs.

Is the Cohere API Free?

Yes — trial keys are free with no credit card required. Limits:

  • 1,000 API calls per month across all endpoints
  • 20 RPM for Command models
  • 10 RPM for Rerank
  • 2,000 inputs/min for Embed

Trial keys are suitable for evaluation and development. For production, upgrade to a production key by adding billing.

Security Best Practices

  • Use CO_API_KEY as the canonical env var — it's what Cohere's SDK reads by default
  • Use separate keys per environment — dev, staging, and prod should never share a key
  • Keep keys out of frontend code: send all Cohere API calls through a trusted backend
  • Rotate keys quarterly — and immediately if you suspect compromise
  • Monitor usage — watch for unexpected spikes in the dashboard
  • Revoke unused keys — unused keys are an unnecessary attack surface
  • Use a secrets manager in production — AWS Secrets Manager, GCP Secret Manager, HashiCorp Vault

Rate Limits

Cohere enforces rate limits by key type, endpoint, and model. The dimensions are:

  • Requests per minute: per endpoint and model
  • Monthly call cap: 1,000 calls/month for trial keys, and for production keys on newer Chat model variants

When you exceed limits you receive a 429 Too Many Requests response. Implement exponential backoff.

Check Cohere's "Different Types of API Keys and Rate Limits" docs for current per-model limits — specific numbers can change as Cohere adjusts capacity.

How Cohere API Keys Compare to Other LLM Providers

ProviderAuth headerEndpointEnv varOpenAI SDK compatible?
OpenAIAuthorization: Bearerapi.openai.com/v1OPENAI_API_KEY✓ native
Anthropic Claudex-api-keyapi.anthropic.com/v1ANTHROPIC_API_KEY✗
Google Geminix-goog-api-keygenerativelanguage.googleapis.com/v1betaGEMINI_API_KEY✗
X.ai GrokAuthorization: Bearerapi.x.ai/v1XAI_API_KEY✓
GroqAuthorization: Bearerapi.groq.com/openai/v1GROQ_API_KEY✓
Mistral AIAuthorization: Bearerapi.mistral.ai/v1MISTRAL_API_KEY✓
CohereAuthorization: Bearerapi.cohere.com/v2CO_API_KEY✓ (Compatibility API)
DeepSeekAuthorization: Bearerapi.deepseek.com/v1DEEPSEEK_API_KEY✓
Hugging FaceAuthorization: Bearerapi-inference.huggingface.coHF_TOKENpartial (chat only)
Azure OpenAIapi-key{resource}.openai.azure.comAZURE_OPENAI_API_KEY✓ (via Azure SDK)
AnyScale¹Authorization: Bearerapi.endpoints.anyscale.com/v1ANYSCALE_API_KEY✓
¹ Effective August 1, 2024, Anyscale Endpoints is available exclusively via the Hosted Anyscale Platform; multi-tenant LLM access was removed.

Cohere offers dedicated Embed and Rerank endpoints alongside Chat. If embeddings or search ranking are core to your product, Cohere's Embed and Rerank are native solutions — not a generic model approximating these capabilities.

Using Cohere in a Multi-Model Architecture

Most AI-native SaaS teams don't rely on a single provider long term. Common reasons: cost optimization, fallback when one provider degrades, model specialization, enterprise customer preference.

Instead of building separate integrations for Cohere, OpenAI, Anthropic, Gemini, and Mistral, you can integrate once against Unified's Generative AI API.

Build once across LLM providers

Unified.to's Generative AI API has eight objects (as of 19 October 2026). On Cohere it supports three:

Model — id, max_tokens, temperature support

Prompt — model_id, messages, temperature, max_tokens, responses, tokens_used

Embedding — model_id, content, dimension, embeddings, tokens_used

The Embedding object maps directly to Cohere's native Embed endpoint — when you call Unified for embeddings with a Cohere connection, you're calling Cohere's dedicated embedding service, not a generic model approximating embeddings.

This allows you to:

  • Switch between Cohere and other providers without rewriting integration code
  • Run the same prompt across models and compare outputs
  • Route requests dynamically based on cost or availability
  • Generate embeddings consistently across providers using Cohere's native Embed product

Let Cohere take action via Unified MCP

Text generation is one layer. Production AI features require structured, authorized reads and writes against customer SaaS platforms — listing CRM deals, retrieving candidates, fetching files, updating records, writing notes.

Unified's MCP server connects Cohere to customer integrations through tool-calling.

High-level flow:

  1. Fetch tools formatted for Cohere: GET /tools?type=cohere
  2. Include tools in your co.chat() request
  3. When Cohere returns a tool call, execute it: POST /tools/{id}/call
  4. Return the tool result back to Cohere

MCP URLs (regional):

  • US: https://mcp-api.unified.to/mcp
  • EU: https://mcp-api-eu.unified.to/mcp
  • AU: https://api-au.unified.to/mcp

A credential works only on its own region's host. Send the token in the Authorization: Bearer header, never in the URL; keep your workspace API key on your server and give agents a connection-scoped signed token, which works for one connection only.

MCP safety controls:

  • hide_sensitive=true — removes PII fields from tool results
  • permissions=... — restricts what the connection can do
  • tools=... — limits the tool set to reduce model overload
  • defer_tools — lowers tool token usage

LLMs have tool limits. Scoping is not optional — it's required for stable deployments.

Troubleshooting Common Errors

401 Unauthorized Key is invalid, inactive, or revoked. Check the Authorization: Bearer format and look for trailing whitespace. Regenerate at dashboard.cohere.com under API Keys if needed.

400 Bad Request Request payload is malformed. Most common cause: using the generate() endpoint pattern instead of chat(), or wrong role fields in the messages array (e.g., using "system" where "user" is required).

404 Not Found Model string is wrong or the endpoint URL is incorrect. Avoid unversioned aliases — use explicit IDs like command-a-03-2025. List current IDs with co model list.

429 Too Many Requests Rate limit exceeded. On trial keys, the 1,000 calls/month cap applies globally. Implement exponential backoff. Upgrade to a production key for higher limits.

co.generate() DeprecationWarning You're using the old v1 SDK pattern. Migrate to ClientV2 + co.chat(). The Generate API was deprecated September 15, 2025.

FAQ

Is the Cohere API free? Yes — trial keys are free with 1,000 API calls/month and no credit card required. For production workloads, add billing to upgrade to a production key.

Which environment variable should I use — CO_API_KEY or COHERE_API_KEY****? Use CO_API_KEY — it's the canonical name that Cohere's Python SDK reads automatically. Any other name, such as COHERE_API_KEY, must be passed to the client explicitly.

Why shouldn't I use co.generate()****? The Generate API was deprecated on September 15, 2025. Use ClientV2 + co.chat() with a versioned Command model ID instead. See Cohere's "Migrating from Generate to Chat" docs.

What's the difference between Cohere and other LLM providers? Cohere offers dedicated Embed and Rerank models and endpoints alongside its Command chat models.

Can I use the OpenAI SDK with Cohere? Yes, through Cohere's Compatibility API: point the OpenAI client at https://api.cohere.ai/compatibility/v1. Chat completions and embeddings work; Cohere-specific features such as documents need Cohere's own SDK.

What's the trial key monthly limit? 1,000 API calls per month across all endpoints combined (as of 20 October 2026). For higher limits, upgrade to a production key.

How do I verify my key is working? Run the test call in Step 6. A successful response confirms the key is valid and active.

How do I set CO_API_KEY in Python?

export CO_API_KEY="your-api-key"

Then in Python:

import cohere

co = cohere.ClientV2()  # reads CO_API_KEY automatically

response = co.chat(
    model="command-a-03-2025",
    messages=[{"role": "user", "content": "Hello, Cohere!"}]
)
print(response.message.content[0].text)

Key takeaway

Calling Cohere directly is straightforward. Building multi-model routing, native embedding pipelines, search ranking, and enterprise-grade SaaS integrations requires infrastructure.

Unified was built for AI-native SaaS teams that need:

  • Pass-through reads at request time, and writes on supported integrations
  • No customer records at rest; connection credentials and operational metadata encrypted at rest
  • Usage-based pricing aligned with API volume
  • MCP-compatible integration across 2154 integrations

Cohere generates intelligence — and with its native Embed and Rerank endpoints, powers the retrieval layer too. Unified connects both to structured SaaS data and authorized actions.

→ Start your 30-day free trial

→ Book a demo

All articles