Authentication
The SpeakEasy API uses API keys to authenticate requests. Every request must include your API key as a Bearer token in the Authorization header.
Authorization: Bearer YOUR_API_KEYAll API requests must be made over HTTPS. Requests without a valid API key will return a 401 Unauthorized error.
Getting an API Key
- Create an account — Sign up at app.tryspeakeasy.io.
- Go to your dashboard — Navigate to Dashboard → API Keys.
- Generate a key — Click Create API Key, give it a name, and copy the key. You won't be able to see it again.
Code Examples
cURL
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"Python (OpenAI SDK)
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)JavaScript (fetch)
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 ${process.env.SPEAKEASY_API_KEY}`,
},
body: formData,
});
const data = await response.json();
console.log(data.text);Security Best Practices
- Never commit API keys to version control. Add your
.envfile to.gitignoreand keep keys out of your source code. - Use environment variables. Store your API key in an environment variable like
SPEAKEASY_API_KEYand reference it at runtime. - Rotate keys regularly. If you suspect a key has been compromised, revoke it immediately from your dashboard and generate a new one.
- Restrict key permissions. When possible, create separate keys for different environments (development, staging, production).
- Never expose keys on the client side. API calls should be made from your server. Never include your API key in frontend JavaScript that ships to the browser.
OpenAI SDK Compatibility
SpeakEasy is fully compatible with the OpenAI SDK. If you already use the OpenAI Python or Node.js library, you can switch to SpeakEasy by changing just the base_url— no other code changes required.
# Before — using OpenAI directly
client = OpenAI(api_key="sk-...")
# After — using SpeakEasy
client = OpenAI(
api_key="YOUR_SPEAKEASY_API_KEY",
base_url="https://api.tryspeakeasy.io/v1"
)All endpoints, request parameters, and response formats match the OpenAI API specification. Your existing code, tools, and integrations work out of the box.
$1. 50 hours. Both STT and TTS.
Your current speech API provider is charging you too much. Switch in one line of code.