Short answer: estimate the exact image job before generation, then allow the call only when its model, resolution, and quantity fit the media workflow's credit limit.
In a media backend, the expensive mistake is not choosing a slightly slower image model. It is sending a generation request before the system knows what the request will cost. A reviewer then has to judge a code change that may be correct at the HTTP level but unsafe for a credit budget.
The reliable design is a two-step decision: discover a currently available image model, submit the intended model, resolution, and quantity to a cost-estimation endpoint, then call image generation only if the returned estimate passes the product's limit. Infrai fits this boundary when a team wants that estimate behind a plain REST API, without installing an SDK or maintaining another client-library version.…