Skip to main content

Module pricing

Module pricing 

Source

Structs§

Schedule
Base rates plus any context-size tiers, so a request can be priced by how large it actually was.

Enums§

Resolution
What is known about a model’s prices. Ambiguity is reported rather than resolved by guessing: mirrors of the same model id charge different rates, so picking one would produce a plausible but wrong number.

Constants§

CACHE_TTL
SOURCE_URL

Functions§

fetch_catalog
format_cost
has_measured_usage
Whether the provider reported any tokens for this session. Without that, there is nothing to price, and a dollar figure would claim a measurement that was never made.
likely_provider
The candidate most likely to be the model’s own vendor, used only to make the suggested pricing line useful. A provider whose id prefixes the model id, such as deepseek for deepseek-v4-flash, beats an alphabetical first pick.
request_cost
Cost in USD of one request.
resolve_from_catalog
Looks up model in a models.dev catalog. key is an explicit provider/model selector; without one the model id must be unique.
session_cost
Cost of a whole session. Each request is priced on its own, because a tiered schedule charges by how large that individual request was.
source_url
The catalog endpoint, overridable with A_PRICING_URL for mirrors, proxies, and tests that must not reach a third-party service.