Skip to content
OOpenSpeech

DEVELOPER API

One API. Your choice of voice.

Buy credits and create an API key in the studio. API requests spend the same prepaid balance. There is no free generation allowance.

1. Start a recording

curl https://app.openspeech.dev/api/generate \
  -H "Authorization: Bearer $OPENSPEECH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: <a UUID unique to this recording>" \
  -d '{"model":"kokoro-82m","text":"Every story starts with a voice."}'

Send a supported model ID and text, plus an optional voice ID from the public capability catalog. Omitting voice uses that model’s default. Kokoro supports eight English voices at normal speed; other models use their listed preset. Prices and character limits are listed on the pricing page. Credits are reserved atomically before Replicate is called. Reusing the same UUID and input returns the original job without another charge. Reusing it with a different input returns 409.

For example, add "voice":"bf_emma" to select Emma. Optional catalogVersion must match the catalog when creating a new recording; a stale version returns 409 before spending. Unknown controls, including speed or language overrides, are rejected. Saved requests retain their original voice, provider settings and charge when replayed after a catalog change. Requests created before voice selection must be retried in their original model/text shape.

2. Poll for the result

curl 'https://app.openspeech.dev/api/generate?id=<job-id>' \
  -H "Authorization: Bearer $OPENSPEECH_API_KEY"

POST returns 200 or 202 with id, status, and credits. Poll every 3 seconds while status is processing. Succeeded jobs include an audio URL; failed jobs include an error and return their credits. Signed provider webhooks also settle jobs after the browser closes. Model cold starts can take several minutes.

3. Download your audio

curl -OJ 'https://app.openspeech.dev/api/audio?id=<job-id>' \
  -H "Authorization: Bearer $OPENSPEECH_API_KEY"

The download endpoint checks workspace ownership and provides the correct WAV or MP3 filename. New recordings include an expiresAt timestamp and remain privately downloadable for seven days from delivery. Both playback and download URLs require your workspace cookie or API key. Older recordings use temporary provider links. Download a copy to keep it. Key creation and revocation happen in the studio. Keys expire after 30 days. Rotate before expiry: the previous key remains valid for up to 24 hours, bounded by its original expiry. Update your server and revoke the previous key when the change is complete. The studio shows both expiry times; creating a further replacement ends any older rotation window.

Available model IDs

Errors and limits

One active recording per workspace. Models have 90–180 second provider deadlines. A failed model is temporarily paused after repeated errors. Keep API keys in server environments, never in public browser code.

Get help with an integration →