Browse all docs & guides
On this page
OPERATION & PLATFORM GUIDE

Synthesize speech from text prompts

OpenGen models speech synthesis under the text-to-speech operation with typed voice, speed, audio outputFormat, and optional style systemPrompt controls. Inspect exact character limits and published character or token pricing for minimax/speech-02-hd and openai/gpt-4o-mini-tts via GET /v1/models/{provider}/{model}?operation=text-to-speech, run POST /v1/pricing/estimate to verify route eligibility, and submit once with a persisted Idempotency-Key when an executable route is configured.

operation: text-to-speechReviewed 2026-12-02
AGENT PROMPT · PASTE INTO YOUR AGENT OR AUTO-READ
Walk me through a text-to-speech synthesis request on OpenGen (https://opengen.dev):
1. Discover speech models via GET https://opengen.dev/v1/models?operation=text-to-speech (or MCP find_models with operation="text-to-speech").
2. Inspect minimax/speech-02-hd or openai/gpt-4o-mini-tts via GET https://opengen.dev/v1/models/{provider}/{model}?operation=text-to-speech (or MCP get_model) to verify prompt length limits, speed range, outputFormat ("mp3" or "wav"), voice, and optional systemPrompt support.
3. Run POST https://opengen.dev/v1/pricing/estimate (or MCP estimate_cost) to inspect workspaceEligibility and character or token pricing disclosures. Stop and report if routes are documented/comparison-only on the current gateway.
4. Only when an executable route is eligible and I confirm the spend cap, submit once with a persisted Idempotency-Key via POST https://opengen.dev/v1/generations or MCP generate, then retrieve the private audio output via job_get.
View raw .md ↗

OpenGen text-to-speech uses the same canonical generation envelope (modelId, operation: "text-to-speech", input) and workspace-private delivery pipeline as image and video models, returning short-lived first-party /media/... links for MP3 or WAV audio files.

1. Compare the catalog speech models

ModelPrompt limitSpeed boundsExtra controlsPublished tariff
MiniMax Speech-02 HD (minimax/speech-02-hd)10,000 chars0.5–2voice, speed, outputFormat (mp3/wav)$0.10 per 1,000 characters ($100.00 / 1M characters) across MiniMax and fal.
GPT-4o mini TTS (openai/gpt-4o-mini-tts)4,096 chars0.25–4voice, speed, systemPrompt (tone/pacing instructions), outputFormat (mp3/wav)$0.60 / 1M text input tokens + $12.00 / 1M audio output tokens (estimated ~$0.015 / minute).

text-to-speech rejects image/video fields (references, firstFrame, lastFrame, sourceVideo, mask, resolution, aspectRatio) and rejects non-audio outputFormat values (png, jpeg, webp, mp4) with 400 invalid_generation.

curl --fail-with-body \
  "https://opengen.dev/v1/models?operation=text-to-speech"

curl --fail-with-body \
  "https://opengen.dev/v1/models/minimax/speech-02-hd?operation=text-to-speech"

curl --fail-with-body \
  "https://opengen.dev/v1/models/openai/gpt-4o-mini-tts?operation=text-to-speech"

2. Estimate cost and route eligibility with MiniMax Speech-02 HD

Use POST /v1/pricing/estimate first to check route eligibility and character-based pricing ($0.10 / 1,000 characters).

set -eu
umask 077
if [ -e tts-submission.key ]; then
  echo "Existing tts-submission.key found; recover read-only via GET /v1/generations/lookup before replacing tts-request.json." >&2
  exit 1
fi
rm -f tts-request.json
cat <<'JSON' > tts-request.json
{
  "modelId": "minimax/speech-02-hd",
  "operation": "text-to-speech",
  "input": {
    "prompt": "Welcome to OpenGen. Your private media generation job has finished and is ready to download.",
    "voice": "English_CalmWoman",
    "speed": 1,
    "outputFormat": "mp3"
  },
  "routeId": "minimax-undisclosed/minimax-speech-02-hd",
  "billing": "managed",
  "maxCostMicros": 150000
}
JSON
chmod 600 tts-request.json

# Dry-run estimate only (review selectedRouteId, recommendedMaxCostMicros, and workspaceEligibility)
curl --fail-with-body \
  -X POST "https://opengen.dev/v1/pricing/estimate" \
  -H "Authorization: Bearer $OPENGEN_API_KEY" \
  -H "Content-Type: application/json" \
  --data @tts-request.json

Submit once after reviewing the estimate

Run this step only after reviewing the estimate output above and confirming an executable route is eligible (selectedRouteId != null, executableCandidateCount > 0, blockers: []) and confirming maxCostMicros.

set -eu
umask 077
if [ -e tts-submission.key ]; then
  echo "Existing tts-submission.key found; recover read-only via GET /v1/generations/lookup before creating a new submission." >&2
  exit 1
fi
RAW_UUID="$(uuidgen)"
[ -n "$RAW_UUID" ] || { echo "uuidgen failed" >&2; exit 1; }
IDEMPOTENCY_KEY="tts-$(printf '%s' "$RAW_UUID" | tr '[:upper:]' '[:lower:]')"
(set -C; printf '%s\n' "$IDEMPOTENCY_KEY" > tts-submission.key)

curl --fail-with-body \
  -X POST "https://opengen.dev/v1/generations" \
  -H "Authorization: Bearer $OPENGEN_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $IDEMPOTENCY_KEY" \
  -H "Prefer: wait=20" \
  --data @tts-request.json > tts-receipt.json

3. Steerable delivery instructions with GPT-4o mini TTS

GPT-4o mini TTS (openai/gpt-4o-mini-tts) adds input.systemPrompt to steer speaking tone, pacing, and emphasis (up to 4,096 prompt characters and speed 0.25–4). Because audio-token output length varies dynamically, managed quotes are currently comparison-only (selectedRouteId: null); once an execution adapter is enabled, use "billing": "byok" (omitting maxCostMicros):

JSON
{
  "modelId": "openai/gpt-4o-mini-tts",
  "operation": "text-to-speech",
  "input": {
    "prompt": "Your build pipeline succeeded with zero warnings.",
    "voice": "coral",
    "speed": 1,
    "systemPrompt": "Speak in a calm, clear technical narration style with brief pauses between clauses.",
    "outputFormat": "mp3"
  },
  "routeId": "openai-undisclosed/openai-gpt-4o-mini-tts",
  "billing": "byok"
}

4. Download audio privately or feed it into video

Delivered MP3 (audio/mpeg) and WAV (audio/wav) outputs download over short-lived first-party /media/... URLs and can also be promoted into private workspace inputs with POST /v1/assets ({ "source": "job_output", "sourceJobId": "<audio-job-uuid>", "outputIndex": 0 }) for audio-conditioned Reference to Video workflows.

Next steps

Supported Models

Live catalog inventory for text-to-speech (2 documented variants). Click any model to compare exact regional routes, privacy disclosures, and source-linked tariffs, or inspect its canonical schema directly via the single-call model endpoint.

ModelCreatorRoutesLowest published priceSingle-call API
minimax/speech-02-hd
MiniMax2 routes$0.10 / 1k charsGET /v1/models/minimax/speech-02-hd?operation=text-to-speech
openai/gpt-4o-mini-tts
OpenAI1 route≈$0.00025 / secGET /v1/models/openai/gpt-4o-mini-tts?operation=text-to-speech