api-authentication

ElevenLabs API Authentication

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "api-authentication" with this command: npx skills add vanman2024/ai-dev-marketplace/vanman2024-ai-dev-marketplace-api-authentication

ElevenLabs API Authentication

Comprehensive authentication setup for ElevenLabs voice AI platform including SDK installation, API key management, environment configuration, and connection testing.

Overview

This skill provides:

  • Automated SDK installation for TypeScript and Python

  • Secure API key configuration with environment variables

  • Connection testing and validation scripts

  • Production-ready client templates

  • Complete authentication examples for Next.js and Python projects

Authentication Method

ElevenLabs uses API key authentication via HTTP headers:

xi-api-key: YOUR_ELEVENLABS_API_KEY

Security Requirements:

  • API keys must be stored in environment variables (never hardcoded)

  • Keys should never be exposed in client-side code

  • Each key can have endpoint restrictions and credit quotas

Scripts

All scripts are fully functional and production-ready:

  1. setup-auth.sh

Configures ELEVENLABS_API_KEY in .env file with validation.

bash scripts/setup-auth.sh [api-key]

  1. test-connection.sh

Tests API connectivity using curl and validates credentials.

bash scripts/test-connection.sh

  1. install-sdk.sh

Installs @elevenlabs/elevenlabs-js (TypeScript) or elevenlabs (Python) SDK.

bash scripts/install-sdk.sh [typescript|python]

  1. validate-env.sh

Validates .env file has required ELEVENLABS_API_KEY.

bash scripts/validate-env.sh

  1. generate-client.sh

Generates API client boilerplate from templates.

bash scripts/generate-client.sh [typescript|python] [output-path]

Templates

All templates are production-ready and fully implemented:

Environment Configuration

  • templates/.env.template
  • Environment variable template with all required keys

TypeScript Templates

  • templates/api-client.ts.template

  • ElevenLabs client with error handling

  • templates/api-client-nextjs.ts.template

  • Next.js server-side client

  • templates/api-client-edge.ts.template

  • Edge runtime compatible client

Python Templates

  • templates/api-client.py.template

  • ElevenLabs client with error handling

  • templates/api-client-async.py.template

  • Async client with connection pooling

  • templates/api-client-fastapi.py.template

  • FastAPI integration client

Examples

All examples include complete README.md files with step-by-step instructions:

Basic Usage Examples

examples/nextjs-auth/README.md

  • Complete Next.js authentication example

  • Environment setup

  • Server action implementation

  • API route handler

  • Error handling patterns

examples/python-auth/README.md

  • Complete Python authentication example

  • Environment configuration

  • Client initialization

  • Error handling

  • Connection testing

examples/edge-runtime/README.md

  • Edge runtime authentication example

  • Vercel Edge Functions setup

  • Cloudflare Workers setup

  • Deno Deploy setup

  • Environment variable access

Advanced Examples

examples/multi-environment/README.md

  • Multi-environment configuration (dev, staging, prod)

  • Environment-specific API keys

  • Configuration management

  • Platform-specific setup (Vercel, Railway, Fly.io)

examples/api-key-rotation/README.md

  • API key rotation patterns

  • Zero-downtime rotation strategies

  • Dual-key pattern implementation

  • Automated rotation scripts

Usage Instructions

Initial Setup

Install SDK:

For TypeScript projects

bash scripts/install-sdk.sh typescript

For Python projects

bash scripts/install-sdk.sh python

Configure API Key:

Interactive setup

bash scripts/setup-auth.sh

Or provide key directly

bash scripts/setup-auth.sh sk_your_api_key_here

Test Connection:

bash scripts/test-connection.sh

Generate Client:

TypeScript

bash scripts/generate-client.sh typescript src/lib/elevenlabs.ts

Python

bash scripts/generate-client.sh python src/elevenlabs_client.py

Integration Workflow

For Next.js projects:

  • Run bash scripts/install-sdk.sh typescript

  • Run bash scripts/setup-auth.sh

  • Read examples/nextjs-auth/README.md for integration guide

  • Generate client: bash scripts/generate-client.sh typescript src/lib/elevenlabs.ts

For Python projects:

  • Run bash scripts/install-sdk.sh python

  • Run bash scripts/setup-auth.sh

  • Read examples/python-auth/README.md for integration guide

  • Generate client: bash scripts/generate-client.sh python src/elevenlabs_client.py

For FastAPI projects:

  • Run bash scripts/install-sdk.sh python

  • Run bash scripts/setup-auth.sh

  • Use template: templates/api-client-fastapi.py.template

Validation

Validate your setup:

Check environment variables

bash scripts/validate-env.sh

Test API connection

bash scripts/test-connection.sh

Security Best Practices

  • Never commit .env files - Add to .gitignore

  • Use environment-specific keys - Different keys for dev/staging/prod

  • Rotate keys regularly - Follow key rotation patterns in examples

  • Set endpoint restrictions - Configure in ElevenLabs dashboard

  • Monitor credit usage - Set custom credit quotas per key

Troubleshooting

API Key Not Found:

  • Run bash scripts/validate-env.sh

  • Ensure .env file exists in project root

  • Check environment variable is loaded (dotenv)

Connection Failed:

  • Run bash scripts/test-connection.sh for detailed diagnostics

  • Verify API key is valid in ElevenLabs dashboard

  • Check network connectivity and firewall rules

SDK Installation Failed:

  • Ensure Node.js/npm (for TypeScript) or Python/pip (for Python) is installed

  • Check package.json or requirements.txt exists

  • Run with verbose flag: bash -x scripts/install-sdk.sh typescript

References

  • ElevenLabs Authentication Docs

  • ElevenLabs Quickstart

  • TypeScript SDK Docs

  • Python SDK Docs

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Coding

document-parsers

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

stt-integration

No summary provided by upstream source.

Repository SourceNeeds Review
Coding

model-routing-patterns

No summary provided by upstream source.

Repository SourceNeeds Review