/elevenlabs-pack:elevenlabs-reference-architecturefrom elevenlabs-pack
Provides a production-ready layered architecture for ElevenLabs TTS/voice applications, covering project layout, service layers, caching, streaming, and multi-model orchestration.
Ships in elevenlabs-pack. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Production-ready architecture for ElevenLabs TTS/voice applications. Covers project
layout, service layers, caching, streaming, and multi-model orchestration. The full
code for each layer lives in references/ so this file stays a navigable map; drill
into a reference file when you need the exact implementation.
elevenlabs-sdk-patterns)ELEVENLABS_API_KEY (read by the
config layer). This is the only ElevenLabs credential — your app's own request
auth (middleware/auth.ts) is separate and unrelated.Build the service in six layers. Each step below is the high-level move; the verbatim code and diagrams are in the linked reference files.
Split the codebase into elevenlabs/ (client, config, models, errors, types),
services/ (tts, voice, audio, cache), api/ (routes + middleware), queue/, and
monitoring/. See the full project tree.
Define an environment-aware ElevenLabsConfig — dev uses the cheap/fast
eleven_flash_v2_5 and small output format; production uses eleven_multilingual_v2
at higher quality, more concurrency, and a larger cache. loadConfig() merges the
per-environment defaults with ELEVENLABS_API_KEY. Full interface and ENV_CONFIGS:
implementation walkthrough.
Wrap the SDK client in a TTSService that owns a singleton client and a p-queue
sized to maxConcurrency (this is what prevents 429s). generate() supports both
streaming and buffered convert, logs latency, and routes errors through
classifyError. generateLongText() splits on sentence boundaries under the 5000-char
limit to preserve prosody. Full class:
implementation walkthrough.
A VoiceService over the client for list/clone/get-settings/update-settings/delete,
with category filtering (premade / cloned / generated). Full class:
implementation walkthrough.
Requests flow Client → API layer → Cache/TTS/Voice services → queue → singleton SDK client → ElevenLabs REST/WS endpoints. See the data flow diagram.
Compose a /health route that runs connectivity, quota, and cache checks with
Promise.allSettled, returning healthy / degraded / unhealthy (degraded once
quota exceeds 90%). Full function:
implementation walkthrough.
Every architectural choice (singleton client, p-queue, LRU-vs-Redis, sentence splitting, environment-based model selection, HTTP-vs-WS streaming) and its rationale is tabulated in the architecture decisions table.
Applying this skill produces a layered service scaffold, not a single file:
TTSService (queued, retry-aware, streaming-capable) and a VoiceService./health route returning { status, services, timestamp } where status is
healthy, degraded, or unhealthy.generate() returns a Buffer (or a ReadableStream when
streaming: true); generateLongText() returns Buffer[], one per chunk.| Issue | Cause | Solution |
|---|---|---|
| Circular dependencies | Wrong layering | Services depend on client, never reverse |
| Cold start latency | Client initialization | Pre-warm in server startup |
| Memory pressure | Unbounded audio cache | Set maxSizeMB on cache |
| Type errors | SDK version mismatch | Pin SDK version in package.json |
| Frequent 429s | Concurrency above plan limit | Lower maxConcurrency in config |
| Missing API key | ELEVENLABS_API_KEY unset | Export it before loadConfig() runs |
Generate speech through the service layer:
const tts = new TTSService();
const audio = await tts.generate("Hello from production.", {
voiceId: "21m00Tcm4TlvDq8ikWAM",
});
Stream a long article with prosody-preserving chunking:
const chunks = await tts.generateLongText(longArticleText);
// chunks: Buffer[] — concatenate or pipe in order
For the complete, runnable layers behind these snippets — config, full TTSService,
VoiceService, and the /health composition — see the
implementation walkthrough. For the project tree,
data flow, and decision rationale, see architecture.md.
Start with elevenlabs-install-auth for setup, then apply this architecture. Use
elevenlabs-core-workflow-a and elevenlabs-core-workflow-b for feature implementation.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
18 skills in this plugin
/elevenlabs-ci-integrationConfigure CI/CD pipelines for ElevenLabs with mocked unit tests and gated
integration tests.
Use when setting up GitHub Actions for TTS projects, configuring CI test
strategies, or automating ElevenLabs integration validation without burning
character quota on every PR.
Trigger with "elevenlabs CI", "elevenlabs GitHub Actions",
"elevenlabs automated tests", "CI elevenlabs", "elevenlabs pipeline".
/elevenlabs-common-errorsDiagnose and fix ElevenLabs API errors by HTTP status code.
Use when encountering ElevenLabs errors, debugging failed TTS/STS requests,
or troubleshooting voice cloning and streaming issues.
Trigger with "elevenlabs error", "fix elevenlabs", "elevenlabs not working",
"debug elevenlabs", "elevenlabs 401", "elevenlabs 429", "elevenlabs 400".
/elevenlabs-core-workflow-aImplement ElevenLabs text-to-speech and voice cloning workflows.
Use when building TTS features, cloning voices from audio samples, streaming
speech to a chatbot, or implementing the primary ElevenLabs money-path: voice
generation.
Trigger with "elevenlabs TTS", "text to speech", "voice cloning elevenlabs",
"clone a voice", "generate speech", "elevenlabs voice".
/elevenlabs-core-workflow-bImplement ElevenLabs speech-to-speech, sound effects, audio isolation, and
speech-to-text.
Use when converting one voice to another, generating sound effects from a text
description, removing background noise from a recording, or transcribing audio.
Trigger with "elevenlabs speech to speech", "voice changer", "sound effects",
"audio isolation", "remove background noise", "elevenlabs transcribe".
/elevenlabs-cost-tuningOptimize ElevenLabs costs through model selection, character-efficient patterns,
caching, and usage monitoring with budget alerts.
Use when analyzing ElevenLabs billing, reducing character usage, hunting down bill
shock, or implementing quota monitoring for TTS workloads.
Trigger with "elevenlabs cost", "elevenlabs billing", "reduce elevenlabs costs",
"elevenlabs pricing", "elevenlabs expensive", "elevenlabs budget",
"elevenlabs characters", "elevenlabs quota".
/elevenlabs-debug-bundleCollect ElevenLabs debug evidence for support tickets and troubleshooting.
Use when encountering persistent issues, preparing a support ticket, or
gathering diagnostic information (SDK version, API connectivity, quota, voice
inventory, model availability) for an ElevenLabs problem, with secrets
redacted automatically. Trigger with "elevenlabs debug", "elevenlabs support
bundle", "collect elevenlabs logs", "elevenlabs diagnostic", "elevenlabs
support ticket".
npx claudepluginhub jeremylongshore/tons-of-skills-marketplace --plugin elevenlabs-packOther plugins' skills for the same job