| name | cohere-security-basics |
| description | Apply Cohere security best practices for API key management and access control.
Use when securing API keys, implementing key rotation,
or auditing Cohere security configuration.
Trigger with phrases like "cohere security", "cohere secrets",
"secure cohere", "cohere API key security", "cohere key rotation".
|
| allowed-tools | Read, Write, Grep |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","ai","nlp","cohere"] |
| compatibility | Designed for Claude Code |
Cohere Security Basics
Overview
Security best practices for Cohere API keys, request validation, and data protection. Cohere uses bearer token auth with trial and production key tiers.
Prerequisites
- Cohere account at dashboard.cohere.com
- Understanding of environment variables
- Secret management solution for production
Instructions
Step 1: API Key Management
export CO_API_KEY="your-key-here"
CO_API_KEY=your-key-here
.env
.env.local
.env.*.local
Key types:
- Trial keys — free, rate-limited, for development only
- Production keys — metered billing, for live applications
Step 2: Runtime Validation
import { CohereClientV2 } from 'cohere-ai';
function createSecureClient(): CohereClientV2 {
const apiKey = process.env.CO_API_KEY;
if (!apiKey) {
throw new Error('CO_API_KEY is required. Set it as an environment variable.');
}
if (apiKey.length < 20) {
throw new Error('CO_API_KEY appears malformed. Check dashboard.cohere.com.');
}
({ : apiKey });
}