Agent skill

Elevenlabs SDK Patterns

by jeremylongshore in jeremylongshore/tons-of-skills-marketplace

Apply production-ready ElevenLabs SDK patterns for TypeScript and Python.

MITAuto-check passedMedia & Creative

Install Elevenlabs SDK Patterns

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill elevenlabs-sdk-patterns -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace elevenlabs-sdk-patterns --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/elevenlabs-sdk-patterns .claude/skills/elevenlabs-sdk-patterns && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
elevenlabs-sdk-patterns
GitHub stars
2.8k
Token cost
~1.5k tokens
SKILL.md length
480 words
Files
2 (incl. references)
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Apply production-ready ElevenLabs SDK patterns for TypeScript and Python.

  • Works in 6 steps: Singleton client. Create one… → Type-safe TTS service. Wrap… → Error classification. Map raw SDK errors… → …
  • Implementing ElevenLabs integrations
  • SKILL.md covers Overview, Prerequisites, Instructions and Output, plus 4 more sections
  • Needs ELEVENLABS_API_KEY

What it does

Elevenlabs SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Apply production-ready ElevenLabs SDK patterns for TypeScript and Python. Use when implementing ElevenLabs integrations, refactoring SDK usage, or establishing team coding standards for audio AI applications. Trigger with "elevenlabs SDK patterns", "elevenlabs best practices", "elevenlabs code patterns", "idiomatic elevenlabs", "elevenlabs typescript".

Its SKILL.md is about 1.5k tokens, which your agent loads only when the skill is triggered. The skill folder holds 2 other files, including reference files (for example `references/implementation.md`). Compatibility notes: Designed for Claude Code

It sits in Media & Creative, covering Text to speech and voice. It works with ElevenLabs, TypeScript and Python. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • Implementing ElevenLabs integrations
  • Refactoring SDK usage
  • Establishing team coding standards for audio AI applications
  • With elevenlabs SDK patterns

Example prompts

  • “elevenlabs SDK patterns”
  • “elevenlabs best practices”
  • “elevenlabs code patterns”
  • “/elevenlabs-sdk-patterns”

Requirements

  • Python 3
  • A credential in ELEVENLABS_API_KEY
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Read, Write, Edit

Workflow steps

6 steps, taken from the first numbered list in SKILL.md.

  1. Singleton client. Create one lazily-initialized ElevenLabsClient guarded by an
  2. Type-safe TTS service. Wrap textToSpeech.convert behind a typed TTSOptions interface
  3. Error classification. Map raw SDK errors to an ElevenLabsServiceError carrying a stable
  4. Retry with a concurrency queue. Route calls through a p-queue sized to your plan's
  5. Multi-tenant factory. For SaaS platforms, key one client per tenant in a Map so each
  6. Python async. Mirror the singleton + streaming-to-file pattern with AsyncElevenLabsClient

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Read
    • Write
    • Edit

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are typescript).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • github.com
    • pypi.org

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names these keys or tokens, usually read from environment variables:

    • ELEVENLABS_API_KEY

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Elevenlabs SDK Patterns loads about 1.5k tokens when it runs, and up to ~3.5k if it reads all its reference files. Until then it costs about 95 tokens; SKILL.md has 480 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~95
When it runs · the whole SKILL.md, loaded when a task matches
~1.5k
With references · SKILL.md plus every file in references/, read only if the agent opens them
~3.5k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 480 words, ~1,483 tokens.

Download SKILL.mdSave it as .claude/skills/elevenlabs-sdk-patterns/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
elevenlabs-sdk-patterns
description
Apply production-ready ElevenLabs SDK patterns for TypeScript and Python. Use when implementing ElevenLabs integrations, refactoring SDK usage, or establishing team coding standards for audio AI applications. Trigger with "elevenlabs SDK patterns", "elevenlabs best practices", "elevenlabs code patterns", "idiomatic elevenlabs", "elevenlabs typescript".
allowed-tools
Read, Write, Edit
compatibility
Designed for Claude Code
version
1.6.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, voice, ai, elevenlabs, sdk, patterns

ElevenLabs SDK Patterns

Overview

Production-ready patterns for the ElevenLabs TypeScript and Python SDKs. Covers singleton clients, type-safe TTS wrappers, error classification, retry with a concurrency queue, and multi-tenant client factories. Adopt them incrementally — the singleton client alone fixes the most common mistakes; add error classification and the queue as throughput grows.

The full, copy-ready code for all six patterns lives in references/implementation.md. This file gives the high-level workflow plus the essential skeleton so you can follow it end to end, then drill into the reference for depth.

Prerequisites

  • @elevenlabs/elevenlabs-js installed (TypeScript) or elevenlabs (Python)
  • ELEVENLABS_API_KEY exported in the environment (never hardcode the key)
  • Familiarity with async/await patterns and error handling best practices

Instructions

Apply the patterns in order — each builds on the previous one:

  1. Singleton client. Create one lazily-initialized ElevenLabsClient guarded by an ELEVENLABS_API_KEY check so misconfiguration fails fast at startup. Expose a resetClient() for tests. This is the skeleton every other pattern imports:

    typescript
    let instance: ElevenLabsClient | null = null;
    export function getClient(): ElevenLabsClient {
      if (!instance) {
        if (!process.env.ELEVENLABS_API_KEY) {
          throw new Error("ELEVENLABS_API_KEY environment variable is required");
        }
        instance = new ElevenLabsClient({
          apiKey: process.env.ELEVENLABS_API_KEY,
          maxRetries: 3,
          timeoutInSeconds: 60,
        });
      }
      return instance;
    }
  2. Type-safe TTS service. Wrap textToSpeech.convert behind a typed TTSOptions interface and named VoicePreset records (narration / conversational / dramatic / neutral) so voice settings are compile-time checked and consistent across the codebase.

  3. Error classification. Map raw SDK errors to an ElevenLabsServiceError carrying a stable code (auth_failed, quota_exceeded, rate_limited, concurrent_limit, voice_not_found, invalid_request, server_error, network_error) and a retryable flag driven by HTTP status.

  4. Retry with a concurrency queue. Route calls through a p-queue sized to your plan's concurrent-request limit, retrying only retryable errors with exponential backoff + jitter.

  5. Multi-tenant factory. For SaaS platforms, key one client per tenant in a Map so each customer's API key stays isolated.

  6. Python async. Mirror the singleton + streaming-to-file pattern with AsyncElevenLabsClient for non-blocking Python backends.

See references/implementation.md for the complete code for every step above.

Show full SKILL.md (195 more words)Show less

Output

Applying these patterns produces a small set of focused SDK modules in the target project:

  • src/elevenlabs/client.ts — singleton client with config + resetClient()
  • src/elevenlabs/tts-service.ts — typed generateSpeech() / generateToFile() with voice presets
  • src/elevenlabs/errors.ts — ElevenLabsServiceError + classifyError()
  • src/elevenlabs/queue.ts — queuedRequest() with backoff and plan-aware concurrency
  • src/elevenlabs/multi-tenant.ts — per-tenant client factory (SaaS only)
  • elevenlabs_service.py — async singleton + streaming generator (Python backends)

TTS calls return an audio stream you pipe to a file or HTTP response; mp3_44100_128 is the default output format.

Error Handling

PatternError TypeBenefit
classifyError()All API errorsMaps HTTP status to actionable codes
queuedRequest()429, 5xxAuto-retry with exponential backoff + jitter
Singleton guardMissing env varFails fast at startup, not at first call

Only retryable codes (rate_limited, concurrent_limit, server_error, network_error) are retried; auth_failed, quota_exceeded, voice_not_found, and invalid_request throw immediately so callers surface a real problem instead of looping.

Examples

Generate speech to a file (TypeScript):

typescript
import { generateToFile } from "./elevenlabs/tts-service";

await generateToFile(
  { voiceId: "21m00Tcm4TlvDq8ikWAM", text: "Welcome aboard.", preset: "narration" },
  "welcome.mp3"
);

Wrap a call in the retry queue:

typescript
import { queuedRequest } from "./elevenlabs/queue";
import { generateSpeech } from "./elevenlabs/tts-service";

const audio = await queuedRequest(() =>
  generateSpeech({ voiceId: "21m00Tcm4TlvDq8ikWAM", text: "High-throughput job." })
);

Full runnable examples — including the Python async path and multi-tenant usage — are in references/implementation.md.

Resources

Next Steps

Apply these patterns in elevenlabs-core-workflow-a for TTS generation, or see elevenlabs-rate-limits for advanced throttling and plan-aware concurrency tuning.

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file (references) in skills/.curated/elevenlabs-sdk-patterns of jeremylongshore/tons-of-skills-marketplace.

  • SKILL.md
  • references/implementation.md

Open the folder on GitHubat commit cfae287

Compare with similar skills

Elevenlabs SDK Patterns next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Elevenlabs SDK Patterns compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Elevenlabs SDK Patterns this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.5kAutomated safety check: PassMIT
Floe GuardFloe-Labs/floe-guard357—~853Automated safety check: PassMIT
Remotionzhuzhaoyun/Molio433—~4kAutomated safety check: PassCustom licence
Speech Engineelevenlabs/skills482—~2.5kAutomated safety check: WarnMIT
Elevenlabs Ttsglebis/claude-skills391—~792Automated safety check: NotesMIT
Gemini API Devgoogle-gemini/gemini-skills4.3k—~5.1kAutomated safety check: PassApache-2.0

Similar skills

  • Floe Guard

    Floe-Labs/floe-guard

    Know what every AI call really costs — floe-guard meters STT + TTS + LLM + telephony per call (Pipecat, LiveKit — Python & TypeScript), keeps a live ledger of real spend, and hard-stops the next…

    357 GitHub stars~853 tokensUpdated 6 days ago
    Media & CreativeAuto-check passed
  • Remotion

    zhuzhaoyun/Molio

    Molio's builtin skill for MAKING a video from any source — wiki notes, articles, scripts, product info, or a brief — and rendering it to MP4.

    433 GitHub stars~4k tokensUpdated yesterday
    Media & CreativeAuto-check passed
  • Speech Engine

    elevenlabs/skills

    Add real-time voice conversations to a custom agent runtime with ElevenLabs Speech Engine.

    482 GitHub stars~2.5k tokensUpdated yesterday
    Media & CreativeAuto-check: warnings
  • Elevenlabs Tts

    glebis/claude-skills

    This skill converts text to high-quality audio files using ElevenLabs API.

    391 GitHub stars~792 tokensUpdated 3 days ago
    Media & CreativeAuto-check: notes
  • Gemini API Dev

    google-gemini/gemini-skills

    Official

    A skill your agent uses when writing code that calls the Gemini API for text generation, multi-turn chat, multimodal understanding, image generation, video generation, speech generation (TTS), voice…

    4.3k GitHub stars~5.1k tokensUpdated 4 days ago
    AI & LLM EngineeringAuto-check passed
  • Agents

    tadaspetra/loop

    Build voice AI agents with ElevenLabs. An agent skill from tadaspetra/loop.

    296 GitHub starsUsed in 1 repo~2.5k tokens
    AI & LLM EngineeringAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Elevenlabs SDK Patterns

What does Elevenlabs SDK Patterns do?

Apply production-ready ElevenLabs SDK patterns for TypeScript and Python. Elevenlabs SDK Patterns is an agent skill from jeremylongshore/tons-of-skills-marketplace. Apply production-ready ElevenLabs SDK patterns for TypeScript and Python.

When should I use Elevenlabs SDK Patterns?

Elevenlabs SDK Patterns fits situations like: implementing ElevenLabs integrations; refactoring SDK usage; establishing team coding standards for audio AI applications; with elevenlabs SDK patterns.

How do I install Elevenlabs SDK Patterns in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill elevenlabs-sdk-patterns -a claude-code`. Or copy the skill folder (skills/.curated/elevenlabs-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/elevenlabs-sdk-patterns in your project. Claude Code loads it when a task matches its description.

How do I install Elevenlabs SDK Patterns in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill elevenlabs-sdk-patterns -a codex`. Or copy the skill folder (skills/.curated/elevenlabs-sdk-patterns in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/elevenlabs-sdk-patterns in your project. Codex loads it when a task matches its description.

Can I use Elevenlabs SDK Patterns in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill elevenlabs-sdk-patterns -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/elevenlabs-sdk-patterns, .gemini/skills/elevenlabs-sdk-patterns, .github/skills/elevenlabs-sdk-patterns and .opencode/skills/elevenlabs-sdk-patterns in your project.

What does Elevenlabs SDK Patterns need to run?

Going by SKILL.md and its folder, Elevenlabs SDK Patterns needs credentials named ELEVENLABS_API_KEY. Our summary lists: Python 3; A credential in ELEVENLABS_API_KEY. Its frontmatter pre-approves these tools: Read, Write, Edit. Compatibility (from SKILL.md): Designed for Claude Code.

Does Elevenlabs SDK Patterns access the network?

SKILL.md names 2 domains. As links in the text: github.com and pypi.org. This is read from the text; nothing was executed.

Is Elevenlabs SDK Patterns safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Elevenlabs SDK Patterns use?

Elevenlabs SDK Patterns is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Elevenlabs SDK Patterns use?

About 1.5k tokens (SKILL.md is roughly 5.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full. Its references folder adds about 2k tokens, read only when the agent opens those files.

What are the alternatives to Elevenlabs SDK Patterns?

Skills that share tags, products or a category with Elevenlabs SDK Patterns: Floe Guard (Floe-Labs/floe-guard, 357 stars), Remotion (zhuzhaoyun/Molio, 433 stars), Speech Engine (elevenlabs/skills, 482 stars) and Elevenlabs Tts (glebis/claude-skills, 391 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Elevenlabs SDK Patterns?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.