SKILL.md
Anthropic Multi-Environment Setup
Overview
Use different API keys, models, and limits across dev/staging/prod.
Environment Configuration
// config/anthropic.ts
interface AnthropicConfig {
apiKey: string;
model: string;
maxTokens: number;
maxRetries: number;
}
const configs: Record<string, AnthropicConfig> = {
development: {
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-haiku-4-5-20251001', // Cheap for dev
maxTokens: 256,
maxRetries: 1,
},
staging: {
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-sonnet-4-20250514',
maxTokens: 1024,
maxRetries: 2,
},
production: {
apiKey: process.env.ANTHROPIC_API_KEY!,
model: 'claude-sonnet-4-20250514',
maxTokens: 4096,
maxRetries: 3,
},
};
export const config = configs[process.env.NODE_ENV || 'development'];
Separate API Keys Per Environment
Use different Anthropic API keys for each environment:
- Dev key: Low tier, spending alerts at $10
- Staging key: Medium tier, spending alerts at $50
- Prod key: Highest tier, spending alerts at usage baseline + 50%
# .env.development
ANTHROPIC_API_KEY=sk-ant-dev-...
# .env.staging
ANTHROPIC_API_KEY=sk-ant-staging-...
# .env.production
ANTHROPIC_API_KEY=sk-ant-prod-...
Model Selection Strategy
| Environment | Model | Why |
|---|---|---|
| Development | Haiku | Fast iteration, cheap |
| Staging | Sonnet | Match prod quality |
| Production | Sonnet (default) | Balanced cost/quality |
| Production (complex) | Opus | Complex reasoning tasks |
