Get Your API Key
First, you’ll need an API key to authenticate your requests:
Navigate to API Keys
Go to Settings → API Keys in your dashboard
Create New Key
Click “Create API Key” and give it a descriptive name
Copy Your Key
Copy your API key and store it securely
Keep your API key secret! Never commit it to version control or expose it in client-side code.
Choose Your SDK
JavaScript/TypeScript
Python
Installation
Basic Usage
import { SixtyDBClient } from '@60db-own/60db-js';
// Initialize the client
const client = new SixtyDBClient('your-api-key');
// Text to Speech
const audio = await client.textToSpeech({
text: 'Hello, world!',
voice_id: 'default-voice'
});
// Get all voices
const voices = await client.getVoices();
console.log(voices);
Streaming Example
await client.textToSpeechStream(
{
text: 'This is streaming audio',
voice_id: 'default-voice'
},
{
onChunk: (chunk) => {
// Handle audio chunk
console.log('Received chunk:', chunk.length, 'bytes');
},
onComplete: () => {
console.log('Streaming complete!');
},
onError: (error) => {
console.error('Error:', error);
}
}
);
Installation
Basic Usage
from sixtydb import SixtyDBClient
# Initialize the client
client = SixtyDBClient('your-api-key')
# Text to Speech
audio = client.text_to_speech('Hello, world!', voice_id='default-voice')
# Save audio to file
with open('output.mp3', 'wb') as f:
f.write(audio)
# Get all voices
voices = client.get_voices()
print(voices)
Streaming Example
def handle_chunk(chunk):
print(f"Received {len(chunk)} bytes")
def handle_complete():
print("Streaming complete!")
def handle_error(error):
print(f"Error: {error}")
client.text_to_speech_stream(
"This is streaming audio",
on_chunk=handle_chunk,
on_complete=handle_complete,
on_error=handle_error,
voice_id='default-voice'
)
Next Steps