Skip to content
Compresr docs

API reference

POST /pricing/estimate-cost

Estimate the processing cost of compressing a given input-token volume at a target ratio.

POST/api/pricing/estimate-costPublic

Estimate processing cost for a given input-token volume and target compression ratio.

Public, unauthenticated endpoint used by the pricing calculator. Given a compression model, a number of input tokens, and a target ratio, it returns the estimated processing cost and how many tokens would survive compression. For your account's actual quotas and per-tier limits, see Rate limits & tiers and GET /billing/tiers.

Request body

compression_modelstringOptional
Default: "latte_v1"
Compression model to estimate against (e.g. "latte_v2").
input_tokensintegerRequired
Number of input tokens to compress. Must be greater than 0.
compression_rationumberOptional
Default: 0.5
Fraction of tokens removed, between 0 and 1 (exclusive). 0.3 means remove ~30% of tokens (keep ~70%). Note this differs from the compression endpoints, where values above 1 are also accepted as an Nx factor.

Response

Response
  • successboolean
  • dataobject
    • input_tokensinteger

      Echoed input volume.

    • compressed_tokensinteger

      Estimated token count after compression.

    • tokens_savedinteger

      input_tokens − compressed_tokens.

    • compression_rationumber

      Echoed removal fraction (0 to 1).

    • processing_cost_usdnumber

      Estimated cost in USD for the compression step alone.

    • modelstring

      Model used for the estimate.

    • input_price_per_1mnumber

      Input price per 1M tokens at the time of the estimate.

Status codes

Status codes
  • 200
    Estimate returned.
  • 422
    Field validation failure: input_tokens <= 0, ratio outside 0 to 1, or unknown compression_model (the field property names the offender).
  • 429
    Per-IP rate limit on this public endpoint.
  • 500
    Internal pricing-service failure.
Request
python
Response
json