Audio (Speech & Transcription)
Provides text-to-speech (TTS) and speech-to-text (STT). Compatible with the OpenAI Audio API.
Prompt-based music generation via
POST /v1/audio/generations is currently unavailable. See /docs/api/music for details.Text-to-speech#
POST/v1/audio/speech
POST /v1/audio/speech converts text into spoken audio. Requests require an API key beginning with plm_.
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Required | TTS model ID, e.g. gemini-3.8-flash-tts. |
| input | string | Required | Text to convert. Up to 8,000 bytes of UTF-8. ElevenLabs models are limited to 5,000 bytes, except eleven_flash_v2 and eleven_flash_v2_5. Each Korean character takes 3 bytes. |
| voice | string | Optional | Voice name. Accepted values differ by model; omit it to use the model's default voice. gemini-3.8-flash-tts accepts prebuilt voice names such as Kore. |
| response_format | string | Optional | Audio format (e.g. wav, mp3). Supported formats differ by model; gemini-3.8-flash-tts responds with wav. |
curl
curl https://apirouter.pleum.ai/v1/audio/speech \
-H "Authorization: Bearer $PLEUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gemini-3.8-flash-tts",
"input": "Hello from PleumRouter.",
"voice": "Kore",
"response_format": "wav"
}' \
--output out.wavOpenAI SDK (Python)
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["PLEUM_API_KEY"], base_url="https://apirouter.pleum.ai/v1")
response = client.audio.speech.create(
model="gemini-3.8-flash-tts",
input="Hello from PleumRouter.",
voice="Kore",
response_format="wav",
)
response.write_to_file("out.wav")OpenAI SDK (TypeScript)
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({ apiKey: process.env.PLEUM_API_KEY, baseURL: "https://apirouter.pleum.ai/v1" });
const response = await client.audio.speech.create({
model: "gemini-3.8-flash-tts",
input: "Hello from PleumRouter.",
voice: "Kore",
response_format: "wav",
});
fs.writeFileSync("out.wav", Buffer.from(await response.arrayBuffer()));The response body of this endpoint is raw audio bytes, not JSON. The Content-Type is set according to the format, e.g.
audio/wav or audio/mpeg (mp3). Cost is returned in the response headers X-Cost-Krw and X-Cost-Usd, not in the body. The billing unit depends on the model (characters or tokens); check price_unit in the GET /v1/models response.Transcription#
POST/v1/audio/transcriptions
POST /v1/audio/transcriptions transcribes an audio file into text. Requests require an API key beginning with plm_.
This endpoint is requested as multipart/form-data — you upload the file as a form field rather than sending a JSON body.
| Parameter | Type | Required | Description |
|---|---|---|---|
| file | file | Required | Audio file to transcribe, uploaded as a form field. Accepts flac, mp4, mpeg, ogg, wav, and webm, up to 25MB. The Content-Type of the part must match the format, for example audio/mpeg for mp3. An unsupported type returns 415, and a file over 25MB returns 413. |
| model | string | Optional | Transcription model ID (form field). Default whisper-1. |
curl
curl https://apirouter.pleum.ai/v1/audio/transcriptions \
-H "Authorization: Bearer $PLEUM_API_KEY" \
-F "file=@speech.mp3;type=audio/mpeg" \
-F model=whisper-1OpenAI SDK (Python)
import os
from openai import OpenAI
client = OpenAI(api_key=os.environ["PLEUM_API_KEY"], base_url="https://apirouter.pleum.ai/v1")
with open("speech.mp3", "rb") as f:
response = client.audio.transcriptions.create(model="whisper-1", file=f)
print(response.text)OpenAI SDK (TypeScript)
import OpenAI, { toFile } from "openai";
import fs from "node:fs";
const client = new OpenAI({ apiKey: process.env.PLEUM_API_KEY, baseURL: "https://apirouter.pleum.ai/v1" });
const response = await client.audio.transcriptions.create({
model: "whisper-1",
file: await toFile(fs.createReadStream("speech.mp3"), "speech.mp3", { type: "audio/mpeg" }),
});
console.log(response.text);The response is JSON containing the transcribed text, the model used, and cost (KRW cost, FX rate, markup). Billing is per minute of audio.
200 OK
{
"text": "Hello from PleumRouter.",
"model": "whisper-1",
"cost": {
"usd": 0.006,
"krw": 8.1,
"fx_rate": 1342.48,
"markup_rate": 0.0
}
}