GPU-accelerated text-to-speech · OpenAI-compatible API

GPU
VRAM
0s
Uptime
Text Input
0 characters
1.0×
✓ MP3 · 32 kbps · 22050 Hz · Mono ↓ Download
Authentication
API Reference
OpenAI-compatible — POST /v1/audio/speech
# curl
curl http://HOST:8880/v1/audio/speech \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "kokoro",
    "voice": "af_heart",
    "input": "Hello world!",
    "speed": 1.0
  }' --output speech.mp3

# Python (openai library)
from openai import OpenAI
client = OpenAI(
    base_url="http://HOST:8880/v1",
    api_key="YOUR_API_KEY"
)
response = client.audio.speech.create(
    model="kokoro",
    voice="af_heart",
    input="Hello world!"
)
response.stream_to_file("speech.mp3")
Node.js (openai library) — POST /v1/audio/speech
// npm install openai
const { OpenAI } = require('openai');
const fs = require('fs');

const client = new OpenAI({
  baseURL: 'http://HOST:3011/v1',
  apiKey: 'YOUR_API_KEY'
});

async function generateSpeech() {
  const mp3 = await client.audio.speech.create({
    model: 'kokoro',
    voice: 'bm_fable',
    input: 'Hello world! This is a test of Kokoro TTS in Node JS.',
    speed: 0.8  // <-- Set speed here
  });

  const buffer = Buffer.from(await mp3.arrayBuffer());
  fs.writeFileSync('speech.mp3', buffer);
}
generateSpeech();
List voices — GET /v1/audio/voices
curl http://HOST:8880/v1/audio/voices \
  -H "Authorization: Bearer YOUR_API_KEY"
Server stats — GET /stats
curl http://HOST:8880/stats