Skip to content

SPEV: turn decisions up to 36% sooner. Details →

Quickstart

Get an API key, authenticate, and make your first Sprag request.

Every Sprag request needs an API key and the base URL https://api.sprag.ai/v1. This page gets you a key, shows how to send it, and makes one request in each direction: text to speech, and speech to text.

Get an API key

  1. Sign in to Sprag.
  2. Open API keys in the app.
  3. Generate a key and copy it immediately. The full value is shown once and is not recoverable after you leave the page.

Store it as SPRAG_API_KEY. Treat it like a password: load it from an environment variable or a secret manager, and keep it out of source control and frontend code.

Authenticate

Send the key as a bearer token on every request.

Authorization: Bearer $SPRAG_API_KEY

Make your first request

curl https://api.sprag.ai/v1/audio/speech \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $SPRAG_API_KEY" \
  -d '{
    "model": "chorus",
    "input": "Hello from Sprag.",
    "response_format": "mp3"
  }' \
  --output hello.mp3

That writes an MP3 to disk. chorus covers the Chorus models; text-to-speech models describes each one.

To go the other direction, post an audio file to the transcriptions endpoint:

curl https://api.sprag.ai/v1/audio/transcriptions \
  -H "Authorization: Bearer $SPRAG_API_KEY" \
  -F [email protected] \
  -F model=rhythm

Rate limits

Rate limits apply per organization, so every key and every member draws on one budget. Get in touch if you have a specific burst pattern or capacity need.

A 429 response carries the headers below. Back off for Retry-After seconds before retrying.

HeaderMeaning
Retry-AfterSeconds to wait before the window resets.
X-RateLimit-LimitRequests permitted per window.
X-RateLimit-RemainingRequests left in the window.

Handle errors

StatusMeaningFix
400A field was missing, malformed, or out of range.error.param names the field and error.message says what was wrong.
401API key is missing or invalid.Check the Authorization header, rotate the key if it may have leaked.
402Out of credit. Also sent when a plan invoice is unpaid. Also sent while billing for a new account is being set up.Add credit or pay the plan invoice in Billing. While billing for a new account is being set up, retry after a moment.
404The model id does not exist or is not available to you.Check it against GET /v1/models.
429Rate limited.Back off for Retry-After seconds.

See the errors reference for the full error shape and retry guidance.

Next

Pick the guide for what you are building: speech to text, text to speech, or voices. For a spoken conversation with one model on both ends, see realtime speech.