Quickstart
Get an API key, authenticate, and make your first Sprag request.
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, keep it out of source control, and
never put a production key in frontend code.
Key changes take up to five minutes to take effect, so a rotated or revoked key can keep authenticating for that long. Rotate before the old key has to stop working.
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 preset and cloned speech models;
it works as a model id but does not appear in GET /v1/models, which lists
chorus-voices, chorus-design, and chorus-clone separately.
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
Authenticated requests are counted per organization: 60 requests per minute by default, drawn from one budget by every key and every member. Get in touch if you have a specific burst pattern or capacity need.
The in-browser playground runs without a key and has a small daily allowance per visitor. Authenticate with an API key to remove it.
Rate-limit headers appear on 429 responses only.
| 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 | No payment method or credits available. | Add a payment method or review billing. |
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.