Skip to main content
Glama

estimate_cost

Estimate the price of an operation

Returns the exact USD price this API would charge for an operation on an input of the given size, without fetching or processing anything. Free. Use it before paying: send X-Max-Cost-USD on the real request to have the API refuse (412) instead of charging more than you allowed. The list price is returned even when the request could end up free (free tier, or a compress that does not shrink the file).

Responses:

200: Successful Response (Success Response) Content-Type: application/json

Example Response:

{
  "operation": "Operation",
  "price_usd": 1.0,
  "base_usd": 1.0,
  "surcharges_usd": {},
  "size_multiplier": 1.0,
  "within_free_tier": true,
  "free_tier_remaining": 1,
  "currency": "Currency",
  "network": "Network"
}

Input Schema

NameRequiredDescriptionDefault
formatNoRequested output format; only avif changes the price.
operationYesOperation to price. One of resize, compress, convert, crop, optimize_for_vision, optimize_generated, remove_background, pipeline. analyze is always free.
operationsNoFor pipeline only: the ordered operations, each {type, format?}. Volume discount applies at 3+ operations.
input_bytesYesSize of the input image in bytes. Get it from analyze_image (free) if you do not know it.
quality_targetNoWhether the request will use quality_target (SSIM search surcharge).

Schema Changelog

Changes observed during successful MCP inspections.

  1. Changed1 schema field changed
    • changedInput schema / properties / operation / description
      Previous value: -"Operation to price. One of resize, compress, convert, crop, optimize_for_vision, optimize_generated, pipeline. analyze is always free."New value: +"Operation to price. One of resize, compress, convert, crop, optimize_for_vision, optimize_generated, remove_background, pipeline. analyze is always free."
  2. Added

TDQS

A4.6/5.0
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does so well. It discloses that the tool is free, does not fetch or process anything, returns an exact USD price, may return list price even when the operation could be free, and explains the X-Max-Cost-USD refusal behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The key purpose and usage guidance are front-loaded in the first few sentences. The included response example is useful because no output schema exists, though it makes the definition somewhat longer than strictly necessary.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The definition is complete for a cost-estimation tool: it covers the purpose, when to use it, pricing caveats, the relevant request header behavior, and an example response. Since no output schema is provided, the response example fills an important gap.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 100%, so the parameters are already fully documented. The description adds context about input size and pricing behavior, but it does not add much parameter-level detail beyond what the schema already provides.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states a specific verb and resource: estimate the USD price of an operation. It also distinguishes this from the sibling image-operation tools by explaining that it fetches/processes nothing and is free, so an agent can tell it is a pricing check rather than the actual operation.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

It gives explicit usage guidance: use it before paying, and send X-Max-Cost-USD on the real request so the API refuses with 412 instead of overcharging. It also points to analyze_image for obtaining input_bytes when unknown.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Try in Browser

Glama MCP Gateway

Add one secure layer between your agents and this server.

Resources