Troubleshooting

Generation failed: did I lose my credits?

When a generation fails after credits were deducted, Apiway automatically calls try_refund_credits with the same amount and the same source (plan or marketplace) within seconds. Here is what to check, and what to do if you still see the wrong balance.

Last updated

When a generation fails after credits were deducted, Apiway automatically calls try_refund_credits with the same amount and the same source (plan or marketplace) within seconds. You should not need to ask for a refund — the system does it for you.

How automatic refund works

  1. Apiway deducts credits via try_deduct_credits before the model runs (so we can't over-allocate capacity).
  2. If the model fails or the post-processing throws, the API handler catches the error and calls try_refund_credits with amount: totalCost, from_plan and from_market set to match the original deduction.
  3. The failure response returns to the client; the credits counter in the header refreshes within a few seconds.

If the balance still looks wrong

  1. Refresh the page. The header balance is cached briefly; a hard refresh re-reads the live counter.
  2. Check the gallery at /app/gallery. If the image is there, the generation succeeded and the deduction is correct.
  3. Wait 30 seconds and re-check. Most failures are refunded inside that window.
  4. Email support with the failed request timestamp and your account email if the balance is still wrong after a minute.

Why generations fail

  • Heavy queue busy → 503 with retry hint. See heavy queue busy.
  • Upload too large → 413. See upload too large.
  • Underlying model refused (rare) — Gemini can refuse certain content categories. Try a different phrasing or a different model option.
  • Network or timeout — generally retries succeed.

Related docs