Getting Your API Key
Before you can use the Spitch API, you’ll need to get your API key:
- Sign up or log in to Spitch Studio
- Navigate to the API Keys section
- Generate a new API key
- 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
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:
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:
- Install the SDK - Choose Python or TypeScript and learn about client setup
- Quick Start Guide - Make your first API call in under 2 minutes
- Core Features - Explore speech synthesis, transcription, translation, and tone marking
Need help? Check our troubleshooting guide for common issues and solutions.