Going live
Before real users arrive, check each of these.
Secrets and tokens
- Project secrets live only on your servers — never in an app or in a repository. See Authentication.
- Each service or environment has a key of its own, so one can be revoked without stopping the others.
- User tokens last no longer than your app needs (at most a day), and your backend issues a fresh one when a token expires.
- When a user leaves your product, your backend revokes their tokens or disables them.
Retries
- Creating a session, sending a message and starting a generation each carry an
Idempotency-Key, so a retry never does the work twice. -
429 rate_limitedwaits forRetry-After; a5xxbacks off exponentially, with jitter and a cap on attempts. - Requests refused for their input (
4xxother than429) are not retried unchanged.
Streams
- Event streams reconnect with
Last-Event-IDset to the last frame'sid— when the connection ends, after at most 10 minutes, and after 45 seconds with nothing received. See Event streams. - Every way a task can end is handled:
task.completed,task.stoppedandtask.failed.
Errors
- Your code branches on
error.code, never onmessage. - Every error is logged with its
request_id, and you have it at hand when you report a problem. See Errors.
Limits and credits
- Your app expects one task at a time per session (
409 session_busy) and the other rate limits. - Someone watches the project's balance in the console, and your app tells its users
plainly when work is refused with
429 insufficient_credits. See Credits and billing.
Files
- An upload is sent in a message or used in a generation within 30 days — an unused one then expires. See Files.
Versions
- You know how a version changes and how long an old one keeps working. See Versioning and compatibility.