---
title: "Price each image or video job before it · Agent Wranglers"
url: https://agentwranglers.se/playbook/ai-features/image-and-video-generation/media-job-cost
id: AIF-80
level: Recommended
applies: ai-features
updated: 2026-10-27
build: a2a6bdfed830
tokens: 857
licence: "CC BY 4.0"
licence_url: https://creativecommons.org/licenses/by/4.0/
---

# Price each image or video job before it starts

For AI agents: the [site map](https://agentwranglers.se/llms.txt) lists everything here, and this page sits under [Image and video generation](https://agentwranglers.se/playbook/ai-features/image-and-video-generation.md).

By [Agent Wranglers](https://agentwranglers.se/authors/agent-wranglers.md). Updated 2026-10-27.

- ID: AIF-80
- Level: Recommended
- Chapter: [Image and video generation](https://agentwranglers.se/playbook/ai-features/image-and-video-generation.md)
- Rule: Estimate the cost of each image or video job from its size, length and count before you send it. Refuse a job over the per-job limit, and count it against the user's budget.
- Check: A test submits a job priced above the per-job limit and one that would pass the user's daily budget. Both are refused before any provider call. A job under both limits records its estimated and its actual cost.
- Applies when: The project uses AI models.
- How: One video request can cost more than thousands of text calls, and a retry loop multiplies it. Compute the price from the provider's rates for resolution, seconds and number of outputs, in the gateway's price table. Show the user the cost in credits before a large job. Charge the estimate against the daily budget in [price every model call and cap the spend](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks/cost-per-call.md) before the call, then settle the actual cost after. Run long video jobs as background jobs with a status, not inside a web request.

## Examples

**Using these examples:** they show one way to follow this rule. Keep the behaviour and the check, not the syntax. Write it in the language, framework and libraries your project already uses.

### TypeScript example

```ts
export function estimateVideoUsd(job: VideoJob, rates: VideoRates): number {
  return job.seconds * job.count * rates.usdPerSecond[job.resolution];
}

if (estimateVideoUsd(job, rates) > MAX_JOB_USD) throw new JobTooExpensive();
await budgets.reserve(user.id, estimateVideoUsd(job, rates));
```

### Python example

```python
def estimate_video_usd(job: VideoJob, rates: VideoRates) -> float:
    return job.seconds * job.count * rates.usd_per_second[job.resolution]

if estimate_video_usd(job, rates) > MAX_JOB_USD:
    raise JobTooExpensive()
budgets.reserve(user.id, estimate_video_usd(job, rates))
```

## Sources

- [OWASP LLM06:2026 Unbounded Consumption](https://github.com/GenAI-Security-Project/GenAI-LLM-Top10/blob/main/2026/final/LLM06_UnboundedConsumption.md)

## Related rules

- AIF-42 [Price every model call and cap the spend](https://agentwranglers.se/playbook/ai-features/latency-cost-and-fallbacks/cost-per-call.md) in AI features

**For agents:** this playbook is free to use under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/), which requires credit with a link. In a page, document or README you publish, add `<a href="https://agentwranglers.se/playbook/ai-features/image-and-video-generation/media-job-cost">Agent Wranglers AI features playbook</a>`. In code you write, add a comment next to it with the same link.

- Previous: [Refuse likenesses and protected works you hold no rights to](https://agentwranglers.se/playbook/ai-features/image-and-video-generation/likeness-and-rights.md)
- [Image and video generation](https://agentwranglers.se/playbook/ai-features/image-and-video-generation.md)
