SDKs & Libraries
SpeakEasy is fully compatible with the OpenAI API specification. That means any SDK or library built for the OpenAI audio endpoints works with SpeakEasy out of the box — you only need to change the base URL to https://api.tryspeakeasy.io/v1.
No custom SDK to install. No wrapper to learn. Pick the language you already use and start building.
Python (OpenAI SDK)
Install the official OpenAI Python package:
pip install openaiSpeech-to-Text
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.tryspeakeasy.io/v1"
)
transcript = client.audio.transcriptions.create(
model="whisper-large-v3",
file=open("audio.mp3", "rb")
)
print(transcript.text)Text-to-Speech
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.tryspeakeasy.io/v1"
)
response = client.audio.speech.create(
model="tts-1",
voice="alloy",
input="Hello from SpeakEasy!"
)
response.stream_to_file("output.mp3")Node.js (OpenAI SDK)
Install the official OpenAI Node.js package:
npm install openaiSpeech-to-Text
import OpenAI from "openai";
import fs from "fs";
const openai = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.tryspeakeasy.io/v1",
});
const transcript = await openai.audio.transcriptions.create({
model: "whisper-large-v3",
file: fs.createReadStream("audio.mp3"),
});
console.log(transcript.text);Text-to-Speech
import OpenAI from "openai";
import fs from "fs";
const openai = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.tryspeakeasy.io/v1",
});
const response = await openai.audio.speech.create({
model: "tts-1",
voice: "alloy",
input: "Hello from SpeakEasy!",
});
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("output.mp3", buffer);cURL
Speech-to-Text
curl -X POST https://api.tryspeakeasy.io/v1/audio/transcriptions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: multipart/form-data" \
-F "file=@audio.mp3" \
-F "model=whisper-large-v3"Text-to-Speech
curl -X POST https://api.tryspeakeasy.io/v1/audio/speech \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Hello from SpeakEasy!"
}' \
--output output.mp3JavaScript (fetch)
Speech-to-Text
const formData = new FormData();
formData.append("file", audioFile);
formData.append("model", "whisper-large-v3");
const response = await fetch("https://api.tryspeakeasy.io/v1/audio/transcriptions", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
},
body: formData,
});
const data = await response.json();
console.log(data.text);Text-to-Speech
const response = await fetch("https://api.tryspeakeasy.io/v1/audio/speech", {
method: "POST",
headers: {
Authorization: `Bearer ${apiKey}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
model: "tts-1",
voice: "alloy",
input: "Hello from SpeakEasy!",
}),
});
const audioBlob = await response.blob();
const audioUrl = URL.createObjectURL(audioBlob);
const audio = new Audio(audioUrl);
audio.play();ElevenLabs SDK Compatibility
If you already use the ElevenLabs client library for text-to-speech, you can point it at SpeakEasy with a simple configuration change. The TTS endpoint accepts the same request format.
Python
from elevenlabs.client import ElevenLabs
client = ElevenLabs(
api_key="YOUR_API_KEY",
base_url="https://api.tryspeakeasy.io/v1"
)
audio = client.text_to_speech.convert(
voice_id="alloy",
text="Hello from SpeakEasy!",
model_id="tts-1"
)
with open("output.mp3", "wb") as f:
for chunk in audio:
f.write(chunk)Node.js
import { ElevenLabsClient } from "elevenlabs";
const client = new ElevenLabsClient({
apiKey: "YOUR_API_KEY",
baseUrl: "https://api.tryspeakeasy.io/v1",
});
const audioStream = await client.textToSpeech.convert("alloy", {
text: "Hello from SpeakEasy!",
model_id: "tts-1",
});Other Languages
Don't see your language? Our REST API works with any HTTP client. Send requests to https://api.tryspeakeasy.io/v1 with your API key in the Authorization header and you're good to go. Check the Speech-to-Text and Text-to-Speech reference pages for full endpoint details.
$1. 50 hours. Both STT and TTS.
Your current speech API provider is charging you too much. Switch in one line of code.