Skip to content
AI GatewayAI Gateway Manual

Model pricing and costs

Where AI Gateway gets the prices it uses for request costs, when a cost cannot be calculated, how to set image prices, and how to check costs in Model Logs.

AI Gateway calculates the cost of each request from the model’s price and the usage the Provider reports, and applies that cost to project Budgets. This guide covers the accounting rules shared by every Provider type. Each type’s built-in prices and overrides are in that type’s guide.

Provider typePriceWhat administrators can do
OpenAI, Anthropic (API key), GeminiBuilt in for major modelsNothing. Only built-in prices are used
AWS Bedrock, AWS Bedrock MantleBuilt in for major modelsOverride per Provider. AWS Bedrock prices
CustomNoneEnter per model. Custom Provider prices
Anthropic (personal Claude subscription)Estimate based on API list pricesNothing. Charged to the user’s subscription, so not deducted from Budgets

A model never inherits another Provider’s price, even with the same model ID. For example, a Custom or AWS Bedrock model whose name matches an OpenAI model does not use the OpenAI price.

On the Models page, click View pricing on a model to see the price that applies. Text and image prices are saved separately and do not overwrite each other.

When the Provider reports no usage or no price applies, the tokens or cost are recorded as Unavailable. Unavailable does not mean free, and it is recorded separately from a measured zero.

  • A model without an applicable price can still be called. Its cost is recorded as Unavailable and adds $0 to project Budgets.
  • Unreported usage is not estimated. Image counts and base64 length are not turned into tokens, and unreported thinking is not set to zero.
  • Changing or clearing a price does not recalculate usage or settled amounts in earlier logs.
  • A request in progress settles with the price version selected before it was sent to the Provider. The exception is the authoring model’s price for SVG output.

Request limits, token limits, and Budgets apply equally to chat, embeddings, and image generation. Open Quota in the project’s Admin navigation to view them.

  • An exhausted Budget blocks a request before it is sent to the Provider. Unpriced image generation requests are blocked too.
  • Only tokens the Provider reported and that were confirmed count toward token quotas.
  • Personal Claude subscription requests are not deducted from Budgets and are not blocked when a Budget runs out. Request and token limits still apply.

Embeddings turn input into numeric vectors, so usage and cost are based on input tokens and output tokens are zero. dimensions, vector length, and batch size do not multiply the cost.

Image generation per-image cost uses the actual image count confirmed in the response, rather than the requested n. Even when token usage is not reported, per-image cost can be calculated once the count and price conditions are confirmed.

For image generation models on Custom and AWS Bedrock Providers, open the model’s price from the Models list and set it under Image pricing on the Pricing tab. There are three pricing modes.

Pricing modeUse it when
Per tokenThe Provider reports image token usage
Per imageThe price per image differs by size and quality
Fixed per imageOne price per image applies regardless of size and quality

Image prices for OpenAI and Gemini models are built in and cannot be changed. See OpenAI and Gemini. Built-in per-image rates for AWS Bedrock and how to override them are in AWS Bedrock.

  1. Select Per token under Image pricing mode. The rate fields use USD per 1M tokens.
  2. Enter the text input, image input, and image output rates. Text output and cached text/image input rates are optional. A blank optional field leaves that rate unset. Enter 0 only when the rate is explicitly free.
  3. Select Save image price. Check the saved version and rates. Save is disabled when the draft is unchanged, invalid, or saving. If saving fails, your draft remains available to edit or retry.

Positive text output usage without a corresponding rate makes token-based cost Unavailable. The same applies to cached usage without a corresponding rate.

  1. Select Per image under Image pricing mode. Fields for size, quality, and USD per image appear.
  2. Enter the exact size and quality values used by the Provider, such as 1024x1024 and low, with a price per image. Use Add image rate for more combinations. Duplicate combinations, auto, and * are not valid price conditions.
  3. Select Save image price. The saved combinations and rates appear.

Size and quality are confirmed only by values the response reports or the request states explicitly. AWS Bedrock uses the values actually sent after conversion. If the request omits quality and the response does not report it, AI Gateway does not fill in a model default. Cost remains Unavailable if a condition cannot be confirmed or no rate matches.

  1. Select Fixed per image under Image pricing mode. A single USD per image field appears.
  2. Enter the model’s rate and select Save image price. Enter 0 only when the rate is explicitly free.
  3. Check the actual image count and cost in Model Logs. Two generated images at 0.04 per image cost 0.08 USD.

Per-image and fixed per-image charges are not added together.

Select Clear image price to remove a saved image price. This removes only image pricing and keeps text pricing and model capabilities. A model with a built-in price returns to that price.

Before rolling back AI Gateway to a version without fixed per-image pricing, keep a separate copy of the saved price settings and clear fixed per-image prices. Do not modify amounts or signed data in earlier logs.

Tokens that other models spend while generating an image are added to the cost as well. If that part cannot be calculated, the cost of the whole request stays Unavailable.

When a request sets output_format to svg, the Provider reports the tokens of the model that authored the SVG separately from image usage. AI Gateway looks up that model’s text price on the same Provider and adds the charge to the image cost.

  • If the authoring model has no text price, or the reported usage is incomplete, the cost is Unavailable. Set a text price for that model if you need the cost.
  • If every reported token count is 0, only the image cost is calculated.
  • The authoring model is known only from the response, so its text price is read right after the response arrives. If a Custom Provider’s text price changes while the request is running, the SVG part uses the new price.

Image generation tool in the Responses API

Section titled “Image generation tool in the Responses API”

When a POST /v1/responses request declares the image_generation tool, the tokens of the tool’s image model are reported separately from the main model usage. AI Gateway prices them at that image model’s image price and adds the charge to the main model cost. Streaming and non-streaming requests follow the same rules.

  • If the tool does not set model, AI Gateway uses OpenAI’s default, gpt-image-2. If two or more tools name different models, no image price is selected.
  • The image price is selected together with the text price, before the request is sent. An OpenAI Provider uses its built-in price, and a Custom Provider uses the price saved for that image model.
  • A missing image price does not block the request. If the tool then generates an image, the cost is Unavailable. The main model tokens are still recorded.
  • If the response contains a generated image but no tool usage report, the cost is Unavailable.
  • If the tool is declared but generates no image, only the main model cost is calculated.
  1. Open Model Logs for the project and find the row at the request time. Action shows Embeddings for embedding requests and Image generation for image generation requests.
  2. Open the details to check usage and cost.
    • Embeddings show input tokens and zero output tokens.
    • Image generation shows the confirmed image count, text/image input and output tokens, condition sources, and price version. Per-image cost can be available while tokens are Unavailable.
    • For SVG output, SVG authoring model and the SVG authoring input and output tokens also appear. A Responses request that used the image generation tool shows the same section, with Image tool model and only the reported tool tokens.
  3. Distinguish a cost of 0 from an Unavailable cost. Historical logs and requests without reported usage leave the corresponding values Unavailable.

Request content is captured automatically within size limits. Viewing it requires payload viewing permission, and older logs may have no request content. The list shows only a short summary of embedding input or the first 160 characters of an image prompt, and never full vectors, token arrays, images, or base64 payloads.