Migrate to Audra with the OpenAI SDK in 5 minutes — Audra
The fastest way to migrate off OpenAI TTS is to not migrate at all: the OpenAI JS and Python SDKs work against Audra with one constructor argument. This post is the complete swap in both languages, plus the field map for when you want the native v2 endpoint underneath.
JavaScript: change one line
import OpenAI from "openai";
const client = new OpenAI({
apiKey: process.env.AUDRA_API_KEY,
baseURL: "https://audratalks.com/v1", // compat shim → v2 speech
});
const speech = await client.audio.speech.create({
model: "audra-essential",
voice: "june",
input: "Your script here.",
});
const buf = Buffer.from(await speech.arrayBuffer());
// save buf as MP3
Python: change one argument
from openai import OpenAI
client = OpenAI(
api_key="sk-audra-...",
base_url="https://audratalks.com/v1",
)
resp = client.audio.speech.create(
model="audra-essential",
voice="june",
input="Your script here.",
)
resp.stream_to_file("out.mp3")
Prefer native v2?
POST /v2/speech uses field text instead of input and format instead of response_format. Same auth and binary MP3 response. See /migrate for the full parameter map and /openapi.yaml for machine-readable specs.