Credits
The API spends the same credit balance as the web app. Check it, and know when it moves.
GET /v1/credits returns the balance the API will draw from. Subscription credits are spent before one-time credits, exactly as in the app.
curl https://flux1.ai/api/v1/credits -H "Authorization: Bearer $FLUX1_API_KEY"{ "credits": 1830, "subscription_credits": 1500, "one_time_credits": 330 }When the balance changes
| Event | Effect on balance |
|---|---|
| Generation reserved | No debit yet; concurrent retries may briefly see queued and credits: 0. |
| Submission starts | Balance and the request's actual credits are updated together, before the provider call. |
| Request rejected before debit | Nothing charged by this attempt. A conflicting idempotency key does not undo the original request. |
| Provider explicitly rejects the submission | Refund attempted automatically. If it is delayed, the generation stays queued with the actual debit and credits_refunded: false. Polling and background recovery retry it. |
| Refund completes | Balance and the refund marker commit together. The generation becomes failed with credits_refunded: true; credits still shows the original debit. |
| Image task fails later | The existing task settlement process refunds once and updates credits_refunded. |
| Provider acceptance is uncertain | No speculative refund or duplicate submission. Keep the same idempotency key and query the original generation; an unresolved request may require support. |
An HTTP error alone does not prove that no credits were spent or that a refund completed. Check the original generation's credits and credits_refunded, and use the same Idempotency-Key when retrying. For example, credits: 6, credits_refunded: false means a six-credit debit is still outstanding; after refund, the same record shows credits: 6, credits_refunded: true.
Each generation records its actual debit, so GET /v1/generations doubles as a usage statement. Top up or change plans on the pricing page; new credits are usable by the API the moment the payment settles.