Estimate token-based calls
The following Python example estimates token-based request cost from configured pricing values:Set a maximum output budget
The following request caps generated output so the estimate has an upper bound:Estimate task-based calls
The following JavaScript example estimates a task-based workflow such as image or video generation:Common errors
| Error | Fix |
|---|---|
| Using a price from the wrong model | Copy pricing from the same model ID in the model directory. |
| Ignoring output tokens | Set max_completion_tokens or the endpoint-specific output limit. |
| Treating estimates as invoices | Compare estimates with actual usage after the call. |
| Missing task multipliers | For image, audio, and video, check whether billing is per task, per second, or per generated asset. |