We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Speech (TTS)

Endpoints

Speech (TTS)

Turn text into audio with POST /audio/speech on api14, choosing voices, models and output formats for narration, assistants and accessibility.

Try it in the playground

Turn text into natural-sounding speech (text-to-speech, TTS). The endpoint follows OpenAI's POST /audio/speech shape and returns raw audio bytes, so client.audio.speech.create(...) works unchanged.

POST https://api14.com/api/v1/audio/speech

Request

ParameterTypeRequiredDescription
modelstringyesA speech model id, e.g. openai/gpt-4o-mini-tts.
inputstringyesThe text to speak.
voicestringyesVoice name, e.g. alloy, nova, verse. Voices vary per model (see the model page).
response_formatstringnomp3 (default), wav, opus, aac, flac, pcm where supported.
speednumbernoPlayback speed, typically 0.25–4.0.
instructionsstringnoStyle guidance for models that accept it ("calm, warm tone").

Example

import { writeFile } from "node:fs/promises";
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const audio = await client.audio.speech.create({
  "model": "openai/gpt-4o-mini-tts",
  "input": "Hello from api14! One API for every model.",
  "voice": "alloy",
  "response_format": "mp3"
});
await writeFile("speech.mp3", Buffer.from(await audio.arrayBuffer()));

Response

The body is the audio file itself, with a matching Content-Type (e.g. audio/mpeg). Save it to disk or stream it to a player:

curl https://api14.com/api/v1/audio/speech \
  -H "Authorization: Bearer sk-api14-..." \
  -H "Content-Type: application/json" \
  -d '{"model":"openai/gpt-4o-mini-tts","input":"Hello from api14!","voice":"alloy"}' \
  --output hello.mp3

Errors are still returned as JSON in the OpenAI error shape, so check the status code before writing the file.

Pricing

Speech is billed per input character at the model's listed price, displayed as "$ / 1M characters". A 1,000-character paragraph on a model priced at $15 / 1M characters costs $0.015.

Listing speech models

curl "https://api14.com/api/v1/models?category=speech"

Errors

StatusCodeWhen
400model_required / invalid_jsonMissing model or malformed body.
402insufficient_balanceYour USD balance is $0.
403model_not_allowed / plan_requiredKey allowlist or plan excludes the model.
404model_not_foundUnknown or disabled model id.
429rate_limitedRequests per minute exceeded.

Unsupported voices or formats are rejected upstream and passed through. See Errors.