Search by model name
Start with a partial name when you do not know the catalog identifier. Theq parameter searches model IDs, so a query such as gpt-4o can return dated versions, smaller variants, and provider-specific names. Use URL encoding so slashes and other characters survive the request.
data array before choosing a row. A model_id identifies a catalog entry, while provider_id identifies the service selling it. A model’s developer and the provider serving your request may differ. Keep both IDs together: a price from a gateway is not necessarily the price you pay the model developer directly.
Once you identify the intended entry, request that pair explicitly. This avoids accidentally selecting a similarly named variant from a broad search.
Read the rates
For text generation,pricing.prompt is USD per input token and pricing.completion is USD per output token. Multiply either by one million to compare it with a provider’s per-million-token price. For example, an illustrative rate of 0.000002 USD per token equals 0.000002 per million.
Cached input and other usage dimensions can have separate rates. Read input_cache_read and input_cache_write when evaluating caching, and use the request cost guide to apply the appropriate usage breakdown. Do not interpret every pricing field as a token rate: a request or search charge has a different unit.
A row with pricing: null does not mean the model is free. Read its message and exclude it from numeric comparisons until you have a usable price. Likewise, a missing rate should not silently become zero in your application. The search reference describes the response fields.
Paginate large result sets
Readmeta.page and meta.total_pages alongside data. If more pages remain, repeat the same filters with page=2, then increment the page until you reach the last one. page_size defaults to 100 and supports values up to 1,000. A partial first page cannot establish which provider is cheapest across the catalog.
If a search returns no rows, broaden q and check the provider’s spelling in the provider catalog. Do not remove prefixes from an ID simply because another provider uses a shorter name. Save the selected pair, rates, and retrieval time with your estimate so you can explain which prices you used later.