Create speech
Generates audio from a text prompt. Compatible with the OpenAI /v1/audio/speech API.
Returns a binary audio stream in the requested response_format. Use /v2/models/all to discover available TTS models. Supported voices and response formats are validated per model — an unsupported value returns a 400 listing the accepted options.
Example request
curl https://api.deutschlandgpt.de/v2/audio/speech \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
}'curl https://api.deutschlandgpt.de/v2/audio/speech \
-X POST \
-H "Authorization: Bearer $DGPT_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
}'import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/audio/speech",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
},
)
print(response.json())import os, requests
response = requests.post(
"https://api.deutschlandgpt.de/v2/audio/speech",
headers={"Authorization": f"Bearer {os.environ['DGPT_API_KEY']}"},
json={
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
},
)
print(response.json())const response = await fetch('https://api.deutschlandgpt.de/v2/audio/speech', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
}),
});
console.log(await response.json());const response = await fetch('https://api.deutschlandgpt.de/v2/audio/speech', {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.DGPT_API_KEY}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
"model": "gpt-4o-mini-tts",
"input": "Hallo, wie geht es Ihnen heute?",
"voice": "nova",
"response_format": "mp3",
"speed": 1,
"instructions": "string",
"language_code": "de",
"voice_settings": {},
"parameters": {}
}),
});
console.log(await response.json());Request body
modelstringrequiredModel to use. Use /v2/models to list TTS models.
inputstringrequiredText to synthesize. Per-model character limit (4096 for gpt-4o-mini-tts).
voicestringrequiredVoice to use. Optional — defaults to the model's default voice. For gpt-4o-mini-tts: alloy, ash, ballad, coral, echo, fable, nova, onyx, sage, shimmer, verse, marin, cedar. For ElevenLabs models (eleven_multilingual_v2, eleven_flash_v2_5, eleven_v3) it is any voice_id from your ElevenLabs voice library.
response_formatstringoptionalAudio format. Defaults to the model's default format (mp3). ElevenLabs supports mp3, opus, wav, pcm (not aac/flac).
speednumberoptionalSpeech rate multiplier.
instructionsstringoptionalFree-text steering for tone and style. Only applied for models that support it (e.g. gpt-4o-mini-tts).
language_codestringoptionalISO 639-1 language code to enforce (ElevenLabs only).
voice_settingsobjectoptionalFine-grained voice controls (ElevenLabs only). Ignored by OpenAI/Azure models.
stabilitynumberoptionalsimilarity_boostnumberoptionalstylenumberoptionaluse_speaker_boostbooleanoptionalparametersobjectoptionalProvider-specific passthrough (ElevenLabs only). Unknown keys are ignored; OpenAI/Azure models ignore this field entirely.
seedintegeroptionalDeterministic sampling seed.
previous_textstringoptionalText that preceded this request, for prosody continuity across stitched generations.
next_textstringoptionalText that follows this request, for prosody continuity.
previous_request_idsstring[]optionalUp to 3 request_ids of prior generations, for continuity when stitching.
next_request_idsstring[]optionalUp to 3 request_ids of following generations.
apply_text_normalizationstringoptionalControl number/date spelling-out. Default auto.
apply_language_text_normalizationbooleanoptionalLanguage-specific normalization (e.g. Japanese). Increases latency.
use_pvc_as_ivcbooleanoptionalUse the IVC version of a voice instead of its PVC version.
optimize_streaming_latencyintegeroptionalLatency-vs-quality tradeoff (0 = best quality, 4 = lowest latency).
Response
Binary audio stream.
Response headers
X-Request-IDstringUnique request identifier (req_<id>). Include in support tickets.
Response codes
Binary audio stream.
Invalid request — unsupported voice/format, input too long, or validation error.
ErrorUnauthorized — missing or invalid API key.
Insufficient credits.
API key lacks permission for this model.
Model not found or not configured for this workspace.
Server error.