Image Generation API Cost

Last updated: 2026-07-03

Quick Answer

Megapixel billing means the image size helps determine cost. To estimate it, convert dimensions into megapixels, then apply the provider's official unit price or resolution tier. Not every image API uses megapixels, so check the provider page before assuming the same model applies everywhere.

Megapixels, Resolution Tiers and Image Billing

Megapixels are an estimation input, not a universal billing unit. Some providers charge per image, some use resolution tiers, and others convert image inputs or outputs into tokens.

Start by converting pixel dimensions into megapixels:

width * height / 1,000,000 = megapixels

That calculation helps you estimate image size, but it does not by itself define the bill. If a provider uses resolution tiers, map the output size to the correct tier first. If a provider bills per image, megapixels may still affect which tier or quality bucket the request lands in.

Worked example

A 1536 × 1024 output is 1.572864 megapixels.

1536 × 1024 ÷ 1,000,000 = 1.572864 megapixels

That is the useful math for size estimation. It only becomes a cost estimate when the provider publishes a per-megapixel or tier-based rule for that exact model.

Workflow Types

Different workflow types often share the same endpoint family, but they do not always share the same billing unit.

  • text-to-image may bill per generated image, per size, or by tier
  • image-to-image may bill the output image and sometimes the input image handling
  • image editing may use a separate edit unit or a different tier
  • upscale may be priced by resolution increase, output size, or a dedicated action unit

Input Image vs Output Image

Input and output images can be billed differently. Some providers charge only for the generated output, while others separate reference-image processing, editing passes, or upscale steps. That matters when you estimate megapixel spend because the input image may not be free just because it is not the final result.

Google Cloud Example

Google Cloud example, last checked June 14, 2026: Google lists separate input-image and output-image charges for some Gemini image models, with output prices varying by resolution tier. Imagen generation, image editing and upscaling can instead use per-image prices. This illustrates why the exact model and operation matter more than megapixel count alone.

Official source: Google Cloud Agent Platform Pricing

Example interpretation: if a provider lists image sizes or tiers, use the published size or tier rules to map your request before estimating cost. Do not generalize one model's billing unit to every provider.

Missed-Cost Checklist

  • Higher resolution outputs can raise the bill
  • Edits and multiple reference images can add separate charges
  • Retries can create duplicate billed work
  • Input image processing may be billed apart from output generation
  • Different models from the same provider may use different billing units

Estimation checklist

  • Confirm whether the provider bills per image, per megapixel or by resolution tier
  • Calculate megapixels with width * height / 1,000,000
  • Test text-to-image, image-to-image, editing and upscale separately
  • Record request_id, size, tier and actual billed usage
  • Compare expected spend with the dashboard before scaling

Related Guides

AI Summary

Image generation cost can be billed per image, per megapixel or by resolution tier depending on provider and model. Use the official provider page as the source of truth, calculate image area with width * height / 1,000,000, and test text-to-image, image-to-image, editing and upscale flows separately. This page is educational, not official provider documentation.

Frequently Asked Questions

Is image API cost always per image?

No. Some providers bill per image, while others use megapixels, resolution tiers or a different unit entirely.

Do input images always count toward cost?

Not always. Some providers bill only the output, while others charge for reference-image handling or edits too.

Can the same provider use different billing units?

Yes. One model may bill per image while another uses a resolution tier or a separate edit unit.

Start with a small prepaid test

Create an API key with $1 trial credit and compare live model pricing before scaling image work.