Skip to main content

Getting Your API Key

Before you can use the Spitch API, you’ll need to get your API key:
  1. Sign up or log in to Spitch Studio
  2. Navigate to the API Keys section
  3. Generate a new API key
  4. Store it securely in your environment variables
Keep your API key secure! Never commit it directly to version control or share it publicly.

Environment Setup

Environment Variable (Recommended)
export SPITCH_API_KEY="your_api_key_here"

Client Initialization

Python (Async)
from spitch import AsyncSpitch

# Using environment variable (recommended)
client = AsyncSpitch()  # automatically reads SPITCH_API_KEY

# Or pass directly
client = AsyncSpitch(api_key="YOUR_API_KEY")

Verifying Your Setup

Test your API key by making a simple request:
Python
from spitch import AsyncSpitch

async def test_connection():
    client = AsyncSpitch()
    
    try:
        # Test with a simple TTS request
        response = await client.speech.generate(
            text="Hello, this is a test",
            language="en",
            voice="lina"
        )
        print("✅ API key is working!")
        return True
    except Exception as e:
        print(f"❌ Error: {e}")
        return False

# Run the test
import asyncio
asyncio.run(test_connection())

Next Steps

Once your API key is set up:
  1. Install the SDK - Choose Python or TypeScript and learn about client setup
  2. Quick Start Guide - Make your first API call in under 2 minutes
  3. Core Features - Explore speech synthesis, transcription, translation, and tone marking
Need help? Check our troubleshooting guide for common issues and solutions.
I