Audio (Speech & Transcription)
Provides text-to-speech (TTS) and speech-to-text (STT). Compatible with the OpenAI Audio API.
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 | Optional | TTS model ID. Default tts-1. |
| input | string | Required | Text to convert. Up to 8,000 characters. |
| voice | string | Optional | Voice to use. Default alloy. |
| response_format | string | Optional | Audio format (e.g. mp3). |
curl
curl https://apirouter.pleum.ai/v1/audio/speech \
-H "Authorization: Bearer $PLEUM_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "Hello from PleumRouter.",
"voice": "alloy",
"response_format": "mp3"
}' \
--output out.mp3OpenAI SDK (Python)
from openai import OpenAI
client = OpenAI(api_key="plm_...", base_url="https://apirouter.pleum.ai/v1")
response = client.audio.speech.create(
model="tts-1",
input="Hello from PleumRouter.",
voice="alloy",
response_format="mp3",
)
response.write_to_file("out.mp3")OpenAI SDK (TypeScript)
import OpenAI from "openai";
import fs from "node:fs";
const client = new OpenAI({ apiKey: "plm_...", baseURL: "https://apirouter.pleum.ai/v1" });
const response = await client.audio.speech.generate({
model: "tts-1",
input: "Hello from PleumRouter.",
voice: "alloy",
response_format: "mp3",
});
fs.writeFileSync("out.mp3", 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/mpeg (mp3). Cost is returned in the response headers X-Cost-Krw and X-Cost-Usd, not in the body. Billing is per input character.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. |
| 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 \
-F model=whisper-1OpenAI SDK (Python)
from openai import OpenAI
client = OpenAI(api_key="plm_...", 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 from "openai";
import fs from "node:fs";
const client = new OpenAI({ apiKey: "plm_...", baseURL: "https://apirouter.pleum.ai/v1" });
const response = await client.audio.transcriptions.create({
model: "whisper-1",
file: fs.createReadStream("speech.mp3"),
});
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,
"fx_rate": 1525.0,
"markup_rate": 0.0
}
}