Developers

Documentation

A technical guide to integrating leading AI models through Oblion's unified API.

On this page

Text-to-Speech Guide

Convert text into spoken audio. This is the reverse of Python Speech-to-Text (audio → text) — here you send text and get an audio file back.

POST https://api.oblion.io/v1/audio/speech

Basic request

curl https://api.oblion.io/v1/audio/speech \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer YOUR_API_KEY' \
  -d '{
    "model": "tts-1",
    "input": "Welcome to Oblion AI.",
    "voice": "alloy"
  }' \
  --output speech.mp3
from openai import OpenAI

client = OpenAI(base_url="https://api.oblion.io/v1", api_key="YOUR_API_KEY")

response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="Welcome to Oblion AI.",
)
response.stream_to_file("speech.mp3")
import fs from "fs";
import OpenAI from "openai";

const openai = new OpenAI({ baseURL: "https://api.oblion.io/v1", apiKey: "YOUR_API_KEY" });

const response = await openai.audio.speech.create({
  model: "tts-1",
  voice: "alloy",
  input: "Welcome to Oblion AI.",
});
const buffer = Buffer.from(await response.arrayBuffer());
fs.writeFileSync("speech.mp3", buffer);

Available voices

Standard OpenAI-compatible voices: alloy, echo, fable, onyx, nova, shimmer.

Choosing a model

ModelNotes
tts-1Optimized for speed — good for real-time use cases
tts-1-hdOptimized for audio quality — better for pre-recorded content

Higher-fidelity alternatives are also available, such as qwen3-tts-flash and the speech-2.x family — see Audio: TTS, Transcription & Music in Supported Models.

Output format

The response body is raw audio bytes (audio/mpeg by default). Pass response_format to request a different container:

response = client.audio.speech.create(
    model="tts-1",
    voice="alloy",
    input="Welcome to Oblion AI.",
    response_format="wav",  # also supports: mp3, opus, aac, flac, pcm
)