Generative credits are deducted as soon as you click Generate. However, if the generation fails with an error like the one you experienced, those credits are automatically returned to your balance.
If you’ve checked your credit balance and are still certain they weren’t restored afterward, we can look into it for you by reviewing your credit usage on our side.