Get startedMarkdown
Go-live checklist
A short list to run through before you send real traffic. Each item is one line, with a link to the page that explains it.
Keys
- Call the API from your server only. A key in a browser or a mobile app can be read by anyone.
- Keep each key in an environment variable or a secret store, never in source code or a committed file.
- Use one key per app or environment, so you can revoke one without touching the rest.
- Narrow each production key: an IP allowlist, the models it may use and a spend limit. See Key controls.
Requests
- Send an
Idempotency-Keywith every submit. A retry with the same key returns the same generation and never charges twice. See Idempotency. - Treat a failed generation as final. To try again, send the request with a new key.
- Quote the request first and pass the quote as
max_cost_usd, so a call never costs more than the listed price. See Price it first. - Send only the fields the model lists. A field the model does not take is refused, never ignored. See Input fields.
Results
- Wait with
GET /v1/generations/{id}?wait=60in a loop, or sendwebhook_url. Reading a generation is free and never rate limited. - A webhook carries the id and the status only. Read the generation with your key before you act on it.
- Never start a second generation while the first is
queuedorrunning. A second one is a second charge. - Download the files as soon as a job succeeds, and copy the ones you want to keep to your own storage. The links in
outputs[].urllast 6 hours and the files are kept for 30 days. See Get the result.
Errors and limits
- On
429 rate_limited, wait for theRetry-Afterand send the request again. Excess requests are not queued. See Rate limits. - On
429 api_wallet_exhausted, the balance has no room for the request: add credit, or wait for running generations to finish. - When a generation fails, read its
error. It is never charged. See Why a generation failed and Errors.
Billing
- Turn on auto-reload, with a monthly cap, so long jobs never stop for an empty balance. See Billing.
- Watch what you can spend with
GET /v1/balance, or readx-wallet-remaining-centson any generation answer.
Status
- Each model carries its status in
GET /v1/models. See Model list. - Check the status page when something looks wrong.