Skip to content

How to Create a Cohere API Key | Setup Guide

Learn how to create and manage Cohere API keys to access Cohere’s powerful language models including Command, Command R+, Embed, and Rerank.


A Cohere API key enables you to:

  • Access Cohere’s large language models
  • Use text generation and chat capabilities
  • Generate embeddings for semantic search
  • Rerank search results for better relevance
  • Build AI-powered applications and chatbots

Before creating an API key, you need:

  1. Cohere Account → Sign up at https://dashboard.cohere.com/welcome/register
  2. Email Verification → Verify your email address
  3. Internet Connection → For API access

🔹 Step-by-Step: Creating a Cohere API Key

Section titled “🔹 Step-by-Step: Creating a Cohere API Key”
  1. Go to Cohere Dashboard
  2. Click “Sign Up” or “Get Started”
  3. Create an account using:
    • Email and password
    • Google account (OAuth)
    • GitHub account
  4. Verify your email address
  1. Log in to Cohere Dashboard
  2. You’ll see the API Keys section on the main dashboard

Or navigate directly to: https://dashboard.cohere.com/api-keys

Cohere automatically provides you with:

  • Trial API Key → For testing and development
  • Production Key → For live applications (requires payment method)

Step 4: Create Additional API Keys (Optional)

Section titled “Step 4: Create Additional API Keys (Optional)”
  1. Click “Create API Key” or ”+ New API Key”
  2. Enter a name for the key (e.g., “Development”, “Production App”)
  3. Click “Create”
  1. Copy the API key from the dashboard
  2. Store it securely in a password manager or environment variable
  3. You can view your keys anytime in the dashboard

Example API key format:

abcdefgh-1234-5678-90ab-cdefghijklmn

  • ✅ Free to use
  • ✅ Access to all models
  • ⚠️ Rate limited (100 API calls per minute)
  • ⚠️ Limited to 100 requests per month (free tier)
  • ✅ Higher rate limits
  • ✅ Pay-as-you-go pricing
  • ✅ Better performance and reliability
  • ✅ Full support

  1. Go to API Keys
  2. You’ll see:
    • Key name
    • Key type (Trial/Production)
    • Created date
    • Actions (Copy, Delete)
  1. Find the key you want to remove
  2. Click the trash icon or “Delete”
  3. Confirm the deletion

⚠️ Warning: Deleting a key immediately stops all applications using it.


  • Store keys in environment variables
  • Use .env files for local development
  • Rotate keys periodically
  • Use different keys for dev and production
  • Monitor API usage regularly
  • Hardcode keys in source code
  • Commit keys to Git repositories
  • Share keys publicly
  • Use trial keys in production
  • Embed keys in client-side code

Section titled “Method 1: Environment Variable (Recommended)”

Linux/macOS:

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

Windows CMD:

Terminal window
set COHERE_API_KEY="your-api-key-here"

Windows PowerShell:

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

Create a .env file:

COHERE_API_KEY=your-api-key-here

Load it in your code:

Python:

from dotenv import load_dotenv
import os
load_dotenv()
api_key = os.getenv("COHERE_API_KEY")

Node.js:

require('dotenv').config();
const apiKey = process.env.COHERE_API_KEY;

import cohere
import os
co = cohere.Client(os.getenv("COHERE_API_KEY"))
response = co.chat(
message="Hello, Cohere!",
model="command"
)
print(response.text)
import cohere
import os
co = cohere.Client(os.getenv("COHERE_API_KEY"))
response = co.generate(
model="command",
prompt="Write a short story about AI:",
max_tokens=100
)
print(response.generations[0].text)
import cohere
import os
co = cohere.Client(os.getenv("COHERE_API_KEY"))
response = co.embed(
texts=["Hello, world!", "Cohere is amazing!"],
model="embed-english-v3.0"
)
print(response.embeddings)
Terminal window
curl https://api.cohere.ai/v1/generate \
-H "Authorization: Bearer $COHERE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "command",
"prompt": "Hello, Cohere!",
"max_tokens": 50
}'
const { CohereClient } = require('cohere-ai');
const cohere = new CohereClient({
token: process.env.COHERE_API_KEY,
});
(async () => {
const response = await cohere.chat({
message: 'Hello, Cohere!',
model: 'command',
});
console.log(response.text);
})();

ModelDescriptionBest For
command-r-plusMost capable modelComplex tasks, reasoning
command-rBalanced modelGeneral-purpose applications
commandFast, reliableProduction chatbots
command-lightFaster, smallerQuick responses
embed-english-v3.0EmbeddingsSemantic search, RAG
embed-multilingual-v3.0Multilingual embeddingsGlobal applications
rerank-english-v3.0RerankingSearch result optimization

Cohere uses pay-as-you-go pricing:

  • 100 API calls per minute
  • Limited monthly quota
  • Access to all models

Varies by model and usage:

  • Text generation: Based on tokens
  • Embeddings: Based on number of texts
  • Rerank: Based on documents processed

Check pricing: https://cohere.com/pricing

  1. Go to Usage Dashboard
  2. View:
    • API calls
    • Token consumption
    • Cost estimates

To use production keys:

  1. Go to Billing in the dashboard
  2. Click “Add Payment Method”
  3. Enter your credit card details
  4. Set spending limits (optional)
  5. Save your payment method

  • 100 requests per minute
  • Monthly quota limits
  • Higher rate limits (varies by plan)
  • Custom limits available for enterprise

To increase limits, contact support@cohere.com


Solution:

  • Verify the key is copied correctly
  • Ensure no extra spaces
  • Check if key was deleted

Solution:

  • You’ve hit the trial key limit
  • Upgrade to production key
  • Implement retry logic with backoff

Solution:

  • Add payment method
  • Top up account balance
  • Check billing settings

Solution:

  • Verify model name is correct
  • Check available models in documentation
  • Some models may require specific access

Terminal window
pip install cohere
Terminal window
npm install cohere-ai
Terminal window
go get github.com/cohere-ai/cohere-go/v2

import cohere
co = cohere.Client(api_key="your-key")
response = co.chat(
message="What is Cohere?",
documents=[
{"title": "About", "snippet": "Cohere provides LLM APIs..."}
],
model="command"
)
print(response.text)
import cohere
co = cohere.Client(api_key="your-key")
stream = co.chat_stream(
message="Tell me a story",
model="command"
)
for event in stream:
if event.event_type == "text-generation":
print(event.text, end='')


You now know how to: ✅ Create and manage Cohere API keys
✅ Choose between trial and production keys
✅ Use Cohere models in your applications
✅ Monitor usage and manage billing
✅ Troubleshoot common issues

Start building with Cohere’s powerful language models! 🎯