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
- Sign in to Sprag.
- Open API keys in the app.
- 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_KEYMake 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.mp3That 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=rhythmRate 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.
| Header | Meaning |
|---|---|
Retry-After | Seconds to wait before the window resets. |
X-RateLimit-Limit | Requests permitted per window. |
X-RateLimit-Remaining | Requests left in the window. |
Handle errors
| Status | Meaning | Fix |
|---|---|---|
400 | A field was missing, malformed, or out of range. | error.param names the field and error.message says what was wrong. |
401 | API key is missing or invalid. | Check the Authorization header, rotate the key if it may have leaked. |
402 | Out 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. |
404 | The model id does not exist or is not available to you. | Check it against GET /v1/models. |
429 | Rate 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.