Skip to content

Cohere API Key: Create, Secure, and Use

By the end of this guide you will have a Cohere API key stored in an environment variable and a working Python call that returns a chat completion. You will also understand the difference between Cohere’s trial and production keys and when to upgrade.

Requirement Notes
Cohere account Sign up at dashboard.cohere.com
Verified email Required before creating keys
Payment method Only required for production keys
Python 3.9+ To run the verification samples

The free trial key works without a payment method and covers development and testing.

Cohere provides a trial key automatically on account creation.

  1. Sign in at dashboard.cohere.com.
  2. Click API Keys in the left sidebar.
  3. Your trial key is listed here. Copy it.
  4. To create an additional key, click Create API Key, give it a name, and click Create.

Unlike some providers, Cohere lets you view the full key value at any time from the dashboard.

Trial key Production key
Payment required No Yes
Rate limit 100 requests/min Higher (plan-dependent)
Monthly quota Limited Pay-as-you-go
Suitable for Development and testing Live applications

For production workloads, go to Billing in the dashboard, add a payment method, and use a production key.

Linux / macOS (current shell session):

Terminal window
export COHERE_API_KEY="your-key-here"

Windows PowerShell (current session):

Terminal window
$env:COHERE_API_KEY = "your-key-here"

.env file for local development (add .env to .gitignore):

COHERE_API_KEY=your-key-here

Load it in Python with python-dotenv:

from dotenv import load_dotenv
load_dotenv()

Install the SDK, then run a minimal request.

Terminal window
pip install cohere

Save as check_key.py and run with python check_key.py (Python 3.9+):

import cohere
import os
co = cohere.ClientV2(api_key=os.environ["COHERE_API_KEY"])
response = co.chat(
model="command-r-plus",
messages=[{"role": "user", "content": "Reply with the word VERIFIED."}],
)
print(response.message.content[0].text)
# Expected output: VERIFIED

Or use cURL:

Terminal window
curl https://api.cohere.com/v2/chat \
-H "Authorization: Bearer $COHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "command-r-plus",
"messages": [{"role": "user", "content": "Reply with the word VERIFIED."}]
}'
Model Best for
command-r-plus Complex reasoning, retrieval-augmented generation
command-r Balanced general-purpose tasks
command-light Fast responses, lower cost
embed-english-v3.0 English semantic search
embed-multilingual-v3.0 Multilingual embeddings
rerank-english-v3.0 Re-scoring search results for relevance

Model availability and pricing change. Check docs.cohere.com/docs/models for the current list.

View keys: Dashboard � API Keys shows each key’s name, type, creation date, and actions.

Delete a key: Click the trash icon and confirm. Any application using that key immediately receives 401 Unauthorized.

Error Likely cause Fix
401 Unauthorized Key missing, wrong value, or deleted Re-check the Authorization: Bearer header. Verify the key in the dashboard.
429 Too many requests Trial rate limit hit Implement exponential backoff or upgrade to a production key.
model not found Model name incorrect Check current model IDs at docs.cohere.com.