Skip to main content

How do I fetch a model's pricing tiers and change history via the API?

Last updated 7 min read

Send a GET request to `/api/v2/inference_apis/{slug}` using the model's catalog slug to retrieve its complete pricing and audit record. The response includes conditional pricing tiers for input-token thresholds and recurring UTC time windows, past pricing and status change history with before-and-after values, batch and reasoning rates, and curated comparison models.

Send a GET request to Coolhand's single-model inference endpoint to retrieve complete pricing parameters, conditional rate tiers, and historical price changes for any supported model:

GET /api/v2/inference_apis/{slug}

Where {slug} is the model's URL identifier (such as openai-gpt-4o, deepseek-chat, or anthropic-claude-3-5-sonnet-20241022), matching the model's page path in the public model catalog.

To fetch and inspect a model's pricing tiers and change history via the API, follow these steps:

  1. Query the single-model endpoint.
  2. Compare summary catalog fields with the single-model payload.
  3. Evaluate conditional pricing tiers.
  4. Audit price and status history.
  5. Review specialized rates and comparison models.

Step 1: Query the single-model endpoint

The single-model endpoint is publicly accessible:

  • Unauthenticated requests: Allowed without credentials, rate-limited to 1 request per minute per IP address. Exceeding this limit returns an HTTP 429 Too Many Requests status code.
  • Authenticated requests: Pass an API key in the X-API-Key header or as a Bearer token in the Authorization header. Requests authenticated with a private API key bypass the rate limit entirely (see How do I create and manage multiple public API keys for different environments?).
  • Identifier format: Requests must use the model's hyphenated string slug. Internal database integer IDs are not accepted and return an HTTP 404 Not Found response.
curl -X GET "https://api.coolhandlabs.com/api/v2/inference_apis/openai-gpt-4o" \
  -H "X-API-Key: your_coolhand_api_key"

Step 2: Compare summary catalog fields with the single-model payload

The model catalog list endpoint (GET /api/v2/inference_apis) returns summary pricing and technical specifications suited for search and multi-model filtering. The single-model endpoint (GET /api/v2/inference_apis/{slug}) returns all standard fields plus deeper pricing and audit properties omitted from the list:

Attribute List endpoint (/api/v2/inference_apis) Single-model endpoint (/api/v2/inference_apis/{slug}) Description
pricing_tiers Omitted Included Conditional pricing overrides (token thresholds or UTC time windows).
history Omitted Included Complete audit trail of detected pricing and metadata changes over time.
last_change_detected_at Omitted Included Timestamp when Coolhand most recently detected a pricing or status update.
per_input_cost_batch_per_token Omitted Included Token rate for asynchronous batch processing input.
per_output_cost_batch_per_token Omitted Included Token rate for asynchronous batch processing output.
per_reasoning_output_cost_per_token Omitted Included Token rate for generated reasoning or thinking tokens.
edge_model Omitted Included Curated recommendation for a newer, same-tier replacement model.
downstep_model Omitted Included Curated recommendation for a cheaper alternative model.
slug Omitted (filterable) Included The model's canonical catalog slug.

Both endpoints share standard fields, including base token rates (per_input_cost_per_token, per_output_cost_per_token), cache rates, context limits, capabilities, and open-weights licensing (weights_access, weights_license — see How do open-weights labels and license filters work in the model catalog?).

Step 3: Evaluate conditional pricing tiers

The pricing_tiers array details conditional pricing rules that replace base token rates when specific triggers are met. When no tiers apply to a model, the field returns an empty array ([]). At most one tier configuration applies per model.

Coolhand models support two types of conditional tiers:

1. Input-token threshold tiers (input_token_threshold)

Applies when a request's prompt size exceeds a specific token count.

  • Cliff pricing: Unlike marginal bracket pricing, exceeding the threshold bills the entire request at the tier's overridden flat rate.
  • Prompt evaluation: Evaluated against total prompt tokens, which includes standard input tokens plus any cached input tokens.
  • Trigger field: condition_trigger defines the integer token threshold that prompt tokens must strictly exceed.

Example tier object:

{
  "condition_type": "input_token_threshold",
  "condition_trigger": 200000,
  "condition_description": "Above 200,000 input tokens",
  "per_input_cost_per_token": 0.0000025,
  "per_output_cost_per_token": 0.00001,
  "per_cached_input_cost_per_token": 0.000000625,
  "per_cache_creation_input_cost_per_token": null,
  "per_cache_creation_5m_input_cost_per_token": null,
  "per_cache_creation_1h_input_cost_per_token": null,
  "per_reasoning_output_cost_per_token": null,
  "active_utc_weekdays": null,
  "active_utc_hours": null,
  "notes": "Large prompt threshold pricing cliff"
}

2. UTC time window tiers (utc_time_window)

Applies to requests initiated during recurring scheduled time windows, such as peak or off-peak provider pricing schedules:

  • active_utc_weekdays: An array of ISO weekdays (where 1 is Monday and 7 is Sunday).
  • active_utc_hours: An array of integer hours in UTC (0 through 23).
  • condition_description: A human-readable summary of the window schedule (e.g. Mon–Fri 00:00–09:00 UTC).

Example tier object:

{
  "condition_type": "utc_time_window",
  "condition_trigger": null,
  "condition_description": "Mon–Fri 00:00–09:00 UTC",
  "active_utc_weekdays": [1, 2, 3, 4, 5],
  "active_utc_hours": [0, 1, 2, 3, 4, 5, 6, 7, 8],
  "per_input_cost_per_token": 0.00000028,
  "per_output_cost_per_token": 0.00000056,
  "per_cached_input_cost_per_token": 0.000000028,
  "per_cache_creation_input_cost_per_token": null,
  "per_cache_creation_5m_input_cost_per_token": null,
  "per_cache_creation_1h_input_cost_per_token": null,
  "per_reasoning_output_cost_per_token": null,
  "notes": "Scheduled peak hours rate"
}

Pricing tiers define standard and cached input/output overrides. If you utilize batch processing on a tier-eligible request, dedicated batch rates do not nest inside the tier; for supported providers like Anthropic, a flat 50% batch discount is applied to the active tier rate (see When should I use batch requests?).

Step 4: Audit price and status history

The history field provides an audit log of detected changes across the model's lifecycle, ordered from newest to oldest.

Each entry contains:

  • changed_at: An ISO 8601 timestamp marking when the update occurred.
  • initial: A boolean that is true for the record's initial creation and false for subsequent revisions.
  • changes: A dictionary keyed by the modified attribute name. Each entry includes:
    • before: The previous attribute value.
    • after: The newly applied attribute value.
    • description: A human-readable description of what changed.
{
  "changed_at": "2025-01-15T10:00:00Z",
  "initial": false,
  "changes": {
    "per_input_cost_per_token": {
      "before": 0.0000025,
      "after": 0.000002,
      "description": "Input cost per token changed from 0.0000025 to 0.000002"
    }
  }
}

Last detected change timestamp

The last_change_detected_at attribute displays the timestamp of the most recent pricing or status change recorded in history.

Because automated catalog scans only log an entry when an actual change is detected, this field reflects the date of the latest modification, not the latest routine check. For models whose pricing has remained stable, last_change_detected_at will remain pinned to their last recorded price update.

Step 5: Review specialized rates and comparison models

The single-model payload exposes specialized pricing and model migration paths:

  • Batch processing rates: per_input_cost_batch_per_token and per_output_cost_batch_per_token report discounted asynchronous batch costs (typically 50% lower than synchronous rates).
  • Reasoning token rates: per_reasoning_output_cost_per_token details costs for models that emit hidden or explicit reasoning tokens (e.g. OpenAI o-series, DeepSeek-R1). Reasoning tokens are generated outputs and count toward the model's max_output_tokens limit.
  • Comparison references:
    • edge_model: A curated pointer to a newer generation model within the same performance tier, returned as { "slug": "...", "display_name": "..." } or null.
    • downstep_model: A curated pointer to a cheaper, lower-latency alternative suitable for simpler workloads, returned as { "slug": "...", "display_name": "..." } or null.

For guidance on comparing LLMs against classification and routing models, see LLMs and System One models: what's different, and when to use which. For explanations of all telemetry fields recorded during request logging, see What every field on an LLM request log means.

Related articles