Skip to main content

ALLGATE / DEVELOPER WORKFLOW GUIDE

Generate audio with a text-to-speech API.

A text-to-speech (TTS) API converts text into speech audio for narration, accessibility and voice interfaces. Choose a currently available speech model, verify its supported voice and output settings, then handle the response as audio rather than assuming it is JSON.

01 / WORKFLOW

Confirm a speech model and its voice options

Open the current audio catalogue and check which models can actually synthesize speech. The audio category also contains other workflows, so a category label alone is not a voice capability guarantee. Read the selected model and endpoint reference for supported voices, formats, language behavior and input limits. The documented sample voice must be checked against that model before production use.

02 / WORKFLOW

Prepare speakable text and request the output

Clean up text that should not be read aloud, such as interface markup or internal identifiers. Submit the model ID, text input and supported voice options to the speech endpoint. Keep paragraph and sentence boundaries useful when splitting a long narration. If the application synthesizes customer-provided text, validate its length before creating a paid request and keep the API key in your server environment.

03 / WORKFLOW

Save binary audio and provide a playable result

Check the HTTP status before saving the body. A successful speech response is binary audio; an error body may instead describe a failure. Save the result using a content type and filename consistent with the selected format, then stream or serve it through your application. Avoid passing the response through a JSON parser or treating a partial download as a complete audio file.

Request example

This example does not execute automatically. Verify the current model and parameters, then set these environment variables on your server. Replace any YOUR_* placeholders with confirmed supported values.

Server environment
export ALLGATE_BASE_URL='https://api.allgate.ai/v1'
export ALLGATE_API_KEY='YOUR_API_KEY'
HTTP · curl
# text-to-speech: the response body is audio, not JSON
curl --fail-with-body --silent --show-error "$ALLGATE_BASE_URL/audio/speech" \
  -H "Authorization: Bearer $ALLGATE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model":"YOUR_SPEECH_MODEL","input":"Hello, Allgate","voice":"alloy","response_format":"mp3"}' \
  -o speech.mp3

Check models and current availability

These entries come from the public catalogue build snapshot. A listing does not guarantee endpoint capability or continuing supply. For audio, verify synthesis or transcription support separately. Open a model to check its exact ID, settings and billing unit.

Catalogue snapshot:

This catalogue snapshot has no matching model entries for this workflow. Check the live catalogue before integrating and do not guess a model ID.

Compare live models and API pricing →

Costs and workflow limits

Some speech models use a per-1,000-character unit; other audio workflows can use different units. Read the exact published unit and applicable account rate. Estimate the narration text at the model’s rules rather than equating characters, tokens and seconds. A protocol example can remain visible even when live speech supply is unavailable.

Review API pricing and prepaid credits →

COMMON QUESTIONS

Before you integrate

Which endpoint generates speech?
Use /v1/audio/speech with a supported speech model, text and accepted voice settings. The response body is audio on a successful generation.
Why does JSON parsing fail on a successful speech request?
Speech generation returns binary audio. Check the status and save or stream the bytes instead of calling a JSON parser on the successful response.
Is every audio model a text-to-speech model?
No. Audio supply includes distinct capabilities. Confirm synthesis support, voice options and availability for the exact model you plan to call.