production-deployment
Production deployment patterns for ElevenLabs API including rate limiting, error handling, monitoring, and testing. Use when deploying to production, implementing rate limiting, setting up monitoring, handling errors, testing concurrency, or when user mentions production deployment, rate limits, error handling, monitoring, ElevenLabs production.
What this skill does
# Production Deployment
Complete production deployment guide for ElevenLabs API integration including rate limiting patterns, comprehensive error handling strategies, monitoring setup, and testing frameworks.
## Overview
This skill provides battle-tested patterns for deploying ElevenLabs API integration to production environments with:
- **Rate Limiting**: Concurrency-aware rate limiting respecting plan limits
- **Error Handling**: Comprehensive error recovery and retry strategies
- **Monitoring**: Real-time metrics, logging, and alerting
- **Testing**: Load testing, concurrency validation, and production readiness checks
## Quick Start
### 1. Setup Monitoring Infrastructure
```bash
bash scripts/setup-monitoring.sh --project-name "my-elevenlabs-app" \
--log-level "info" \
--metrics-port 9090
```
This script:
- Configures Winston logging with rotation
- Sets up Prometheus metrics endpoints
- Creates health check endpoints
- Initializes error tracking
### 2. Deploy Production Configuration
```bash
bash scripts/deploy-production.sh --environment "production" \
--api-key "$ELEVENLABS_API_KEY" \
--concurrency-limit 10 \
--region "us-east-1"
```
This script:
- Validates environment variables
- Applies rate limiting configuration
- Configures error handling middleware
- Sets up monitoring integrations
- Performs smoke tests
### 3. Test Rate Limiting
```bash
bash scripts/test-rate-limiting.sh --concurrency 20 \
--duration 60 \
--plan-tier "pro"
```
This script:
- Simulates concurrent requests
- Validates queue behavior
- Measures latency under load
- Generates performance report
## ElevenLabs Concurrency Limits
### Limits by Plan Tier
| Plan | Multilingual v2 | Turbo/Flash | STT | Music |
|------|-----------------|-------------|-----|-------|
| Free | 2 | 4 | 8 | N/A |
| Starter | 3 | 6 | 12 | 2 |
| Creator | 5 | 10 | 20 | 2 |
| Pro | 10 | 20 | 40 | 2 |
| Scale | 15 | 30 | 60 | 3 |
| Business | 15 | 30 | 60 | 3 |
| Enterprise | Elevated | Elevated | Elevated | Highest |
### Queue Management
When concurrency limits are exceeded:
- Requests are queued alongside lower-priority requests
- Typical latency increase: ~50ms
- Response headers include: `current-concurrent-requests`, `maximum-concurrent-requests`
### Real-World Capacity
A concurrency limit of 5 can typically support ~100 simultaneous audio broadcasts depending on:
- Audio generation speed
- User behavior patterns
- Request distribution
## Rate Limiting Patterns
### 1. Token Bucket Algorithm
Best for: Variable rate limiting with burst capacity
```javascript
// See templates/rate-limiter.js.template for full implementation
const limiter = new TokenBucketRateLimiter({
capacity: 10, // Max concurrent requests
refillRate: 2, // Tokens per second
queueSize: 100 // Max queued requests
});
```
### 2. Sliding Window with Priority Queue
Best for: Enforcing strict concurrency limits with prioritization
```python
# See templates/error-handler.py.template for full implementation
limiter = SlidingWindowRateLimiter(
max_concurrent=10
window_size=60
priority_levels=3
)
```
### 3. Adaptive Rate Limiting
Best for: Self-adjusting to API response headers
Monitors `current-concurrent-requests` and `maximum-concurrent-requests` headers to dynamically adjust rate limits.
## Error Handling Strategies
### Error Categories
**1. Rate Limit Errors (429)**
- Implement exponential backoff
- Queue requests for retry
- Monitor queue depth
**2. Service Errors (500-599)**
- Retry with exponential backoff
- Circuit breaker pattern
- Fallback to cached audio
**3. Client Errors (400-499)**
- Log for debugging
- Do not retry
- Return meaningful error to user
**4. Network Errors**
- Retry with linear backoff
- Timeout after 30 seconds
- Circuit breaker after 5 failures
### Circuit Breaker Pattern
```javascript
// Automatically opens circuit after threshold failures
const circuitBreaker = new CircuitBreaker({
failureThreshold: 5
resetTimeout: 60000
monitorInterval: 5000
});
```
## Monitoring Setup
### Key Metrics to Track
**Request Metrics:**
- `elevenlabs_requests_total` - Total requests by status
- `elevenlabs_requests_duration_seconds` - Request latency histogram
- `elevenlabs_concurrent_requests` - Current concurrent requests
- `elevenlabs_queue_depth` - Queued requests waiting
**Error Metrics:**
- `elevenlabs_errors_total` - Total errors by type
- `elevenlabs_retries_total` - Total retry attempts
- `elevenlabs_circuit_breaker_state` - Circuit breaker state
**Business Metrics:**
- `elevenlabs_characters_generated` - Total characters processed
- `elevenlabs_audio_duration_seconds` - Total audio duration
- `elevenlabs_quota_used_percentage` - Quota utilization
### Logging Best Practices
**Structure logs with:**
- Request ID for tracing
- User ID for analysis
- Timestamp in ISO 8601
- Error stack traces
- Performance metrics
**Log Levels:**
- `error` - Failures requiring attention
- `warn` - Degraded performance, retries
- `info` - Request completion, key events
- `debug` - Detailed execution flow
### Alerting Rules
**Critical Alerts:**
- Error rate > 5% over 5 minutes
- Circuit breaker open for > 1 minute
- Queue depth > 500 requests
**Warning Alerts:**
- Latency p95 > 2 seconds
- Quota usage > 90%
- Retry rate > 20%
## Testing Frameworks
### Load Testing
Simulate production traffic patterns:
```bash
# Gradual ramp-up test
bash scripts/test-rate-limiting.sh \
--pattern "ramp-up" \
--start-rps 1 \
--end-rps 10 \
--duration 300
```
### Concurrency Validation
Verify concurrency limits are enforced:
```bash
# Burst test
bash scripts/test-rate-limiting.sh \
--pattern "burst" \
--concurrency 50 \
--iterations 100
```
### Chaos Testing
Test error handling under adverse conditions:
```bash
# Simulate API failures
bash scripts/test-rate-limiting.sh \
--pattern "chaos" \
--failure-rate 0.1 \
--duration 120
```
## Production Checklist
### Pre-Deployment
- [ ] Environment variables configured
- [ ] Rate limiting configured for plan tier
- [ ] Error handling middleware implemented
- [ ] Monitoring and logging configured
- [ ] Health check endpoints created
- [ ] Load testing completed
- [ ] Chaos testing completed
### Post-Deployment
- [ ] Smoke tests passed
- [ ] Metrics dashboard configured
- [ ] Alerts configured and tested
- [ ] On-call rotation established
- [ ] Runbooks documented
- [ ] Backup/fallback strategy tested
## Scripts
### setup-monitoring.sh
Configures comprehensive monitoring infrastructure:
- Winston logging with daily rotation
- Prometheus metrics exporter
- Health check endpoints
- Error tracking integration
- Custom metric collectors
**Usage:**
```bash
bash scripts/setup-monitoring.sh \
--project-name "my-app" \
--log-level "info" \
--metrics-port 9090 \
--health-port 8080
```
### deploy-production.sh
Production deployment orchestration:
- Environment validation
- Dependency installation
- Configuration deployment
- Service health checks
- Smoke test execution
- Rollback on failure
**Usage:**
```bash
bash scripts/deploy-production.sh \
--environment "production" \
--api-key "$ELEVENLABS_API_KEY" \
--concurrency-limit 10 \
--skip-tests false
```
### test-rate-limiting.sh
Comprehensive rate limiting test suite:
- Concurrency limit validation
- Queue behavior testing
- Latency measurement
- Error rate tracking
- Performance reporting
**Usage:**
```bash
bash scripts/test-rate-limiting.sh \
--concurrency 20 \
--duration 60 \
--plan-tier "pro" \
--pattern "ramp-up"
```
### validate-config.sh
Production configuration validator:
- Environment variable checks
- API key validation
- Rate limit configuration
- Monitoring setup verification
- Security audit
**Usage:**
```bash
bash scripts/validate-config.sh \
--config-file "config/production.json" \
--strict true
```
### rollback.sh
Automated rollback script:
- Reverts to previous deployment
- RestRelated in Image & Video
watch
IncludedWatch a video (URL or local path). Downloads with yt-dlp, extracts auto-scaled frames with ffmpeg, pulls the transcript from captions (or Whisper API fallback), and hands the result to Claude so it can answer questions about what's in the video.
physical-ai-defect-image-generation
IncludedUse when the user wants to orchestrate defect image generation, run associated setup, or handle outputs on OSMO. The Day 0 path handles cold-start with USD-to-ROI, image-edit augmentation, and AnomalyGen to create initial PCBA datasets. The Day 1 path performs inference and labeling on real images. This skill helps with first-time asset setup, creation of finetuning checkpoints, and configuring deployment. Trigger keywords: defect image generation, dig workflow, dig pipeline, defect image detection workflow, aoi pipeline, aoi anomalygen, usd2roi anomalygen, day 0 pcba, day 1 pcba, day 1 real-photo alignment, day 1 manual roi, metal surface anomaly, glass defect, anomalygen finetune, setup_pcb, setup_metal, setup_glass, setup_pretrained, dig setup, dig datasets, dig pretrained checkpoint, dig image-edit endpoint.
accelint-react-best-practices
IncludedReact performance optimization and best practices. ALWAYS use this skill when working with any React code - writing components, hooks, JSX; refactoring; optimizing re-renders, memoization, state management; reviewing for performance; fixing hydration mismatches; debugging infinite re-renders, stale closures, input focus loss, animations restarting; preventing remounting; implementing transitions, lazy initialization, effect dependencies. Even simple React tasks benefit from these patterns. Covers React 19+ (useEffectEvent, Activity, ref props). Triggers - useEffect, useState, useMemo, useCallback, memo, inline components, nested components, components inside components, re-render, performance, hydration, SSR, Next.js, useDeferredValue, combined hooks.
elevenlabs-agents
IncludedBuild conversational AI voice agents with ElevenLabs Platform using React, JavaScript, React Native, or Swift SDKs. Configure agents, tools (client/server/MCP), RAG knowledge bases, multi-voice, and Scribe real-time STT. Use when: building voice chat interfaces, implementing AI phone agents with Twilio, configuring agent workflows or tools, adding RAG knowledge bases, testing with CLI "agents as code", or troubleshooting deprecated @11labs packages, Android audio cutoff, CSP violations, dynamic variables, or WebRTC config. Keywords: ElevenLabs Agents, ElevenLabs voice agents, AI voice agents, conversational AI, @elevenlabs/react, @elevenlabs/client, @elevenlabs/react-native, @elevenlabs/elevenlabs-js, @elevenlabs/agents-cli, elevenlabs SDK, voice AI, TTS, text-to-speech, ASR, speech recognition, turn-taking model, WebRTC voice, WebSocket voice, ElevenLabs conversation, agent system prompt, agent tools, agent knowledge base, RAG voice agents, multi-voice agents, pronunciation dictionary, voice speed control, elevenlabs scribe, @11labs deprecated, Android audio cutoff, CSP violation elevenlabs, dynamic variables elevenlabs, case-sensitive tool names, webhook authentication
humanizer
IncludedHumanize AI-generated text by detecting and removing patterns typical of LLM output. Rewrites text to sound natural, specific, and human. Uses 28 pattern detectors, 560+ AI vocabulary terms across 3 tiers, and statistical analysis (burstiness, type-token ratio, readability) for comprehensive detection. Use when asked to humanize text, de-AI writing, make content sound more natural/human, review writing for AI patterns, score text for AI detection, or improve AI-generated drafts. Covers content, language, style, communication, and filler categories.
generating-mermaid-diagrams
IncludedSalesforce architecture diagrams using Mermaid with ASCII fallback. Use this skill when generating text-based diagrams for Salesforce architecture, OAuth flows, ERDs, integration sequences, or Agentforce structure. TRIGGER when: user says "diagram", "visualize", "ERD", or asks for sequence diagrams, flowcharts, class diagrams, or architecture visualizations in Mermaid. DO NOT TRIGGER when: user wants PNG/SVG image output (use generating-visual-diagrams), or asks about non-Salesforce systems.