Public Pricing API and Cost Estimator
Last updated:
How do I fetch or estimate AI model pricing programmatically? Use /api/pricing.json for the full daily dataset, or POST to /api/estimate to price a specific token workload. The dataset covers 220 models across 17 providers, refreshed daily at 04:00 UTC. The AI Pricing Guru dataset is provided for informational use. You may use it for personal, editorial, research, educational, and internal business purposes with appropriate attribution to AI Pricing Guru. Commercial redistribution, resale, republishing at scale, inclusion in a competing public dataset/API, or use as the primary data source for a commercial pricing-comparison product requires prior written permission. Prices can change without notice; always verify directly with the provider before making purchasing or budgeting decisions.
Endpoint at a glance
- URL:
https://www.aipricing.guru/api/pricing.json - Method:
GET(no authentication required) - Response:
application/json, typical size ~25 KB - Update cadence: daily (04:00 UTC), scraped from each provider's official pricing page
- CORS:
Access-Control-Allow-Origin: *— call it from any browser - Cache:
Cache-Control: public, max-age=3600 - OpenAPI spec:
/openapi.json - Dataset terms: The AI Pricing Guru dataset is provided for informational use. You may use it for personal, editorial, research, educational, and internal business purposes with appropriate attribution to AI Pricing Guru. Commercial redistribution, resale, republishing at scale, inclusion in a competing public dataset/API, or use as the primary data source for a commercial pricing-comparison product requires prior written permission. For permission requests, email info@aipricing.guru.
Cost Estimator API
POST a model ID and token counts to calculate input, cached-input, output, per-call, and total cost from the current pricing dataset. Exact token counts are best. If you send words or text, the response labels the result as an estimate. Raw text is never stored in usage logs.
- URL:
https://www.aipricing.guru/api/estimate - Method:
POST(no authentication required) - CORS:
Access-Control-Allow-Origin: * - Privacy: aggregate usage only; raw
textinput is not written to logs
curl -s https://www.aipricing.guru/api/estimate \
-H 'content-type: application/json' \
-d '{
"model": "gpt-5.5",
"inputTokens": 100000,
"outputTokens": 20000,
"cachedInputTokens": 0,
"calls": 1
}' const res = await fetch('https://www.aipricing.guru/api/estimate', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({
model: 'claude-sonnet-5',
inputTokens: 250000,
outputTokens: 50000,
cachedInputPercent: 60,
calls: 100
})
});
const estimate = await res.json();
console.log(estimate.cost.total); The estimator does not call any model provider. It only prices your supplied token counts against the daily AI Pricing Guru dataset. For editor and agent integrations, see the AI Pricing Guru MCP server docs.
Batch scenarios
Send up to 100 scenarios to price a workload mix in one request. Top-level values act as defaults and each scenario can override them. The response returns each estimate and a combined total. Setting batch: true records an asynchronous provider-batch assumption, but the calculator never invents a discount: it uses standard rates unless a provider-specific batch rate exists in the canonical dataset.
curl -s https://www.aipricing.guru/api/estimate \
-H 'content-type: application/json' \
-d '{
"model": "gpt-5.5",
"scenarios": [
{ "id": "summaries", "inputTokens": 100000, "outputTokens": 10000, "calls": 100 },
{ "id": "classification", "inputTokens": 2000, "outputTokens": 200, "calls": 10000 }
]
}' What does the response look like?
A single JSON object with metadata and a models array. Every model has a stable id, a provider slug, and a pricing block with inputPerM, outputPerM, and optional cachedInputPerM, cacheWritePerM, and longContext tier — all rates in USD per 1 million tokens. When a provider publishes a future rate card before it takes effect, the model can also include scheduledPricing with an ISO effective timestamp, billing windows, future rate tiers, and the official source URL; pricing remains the currently payable rate.
{
"lastUpdated": "2026-08-31T10:30:22.071Z",
"modelCount": 220,
"providerCount": 17,
"disclaimer": "Prices are collected from public provider sources and refreshed by AI Pricing Guru's monitoring pipeline. Providers can change prices, tiers, taxes, regions, or billing rules without notice; always verify directly with the provider before making purchasing or budgeting decisions.",
"models": [
{
"id": "alibaba-qwen3.8-flash",
"name": "Qwen3.8-Flash",
"family": "Qwen3.8",
"provider": "alibaba",
"pricing": {
"inputPerM": 0.16,
"outputPerM": 0.47
},
"context": 1000000,
"status": "preview",
"availability": "coming-soon",
"availabilityUpdated": "2026-08-26",
"availabilityReason": "Qwen announced the QwenCloud qwen3.8-flash production SKU and its token rates, but says the managed API is not live yet.",
"sourceUrl": "https://qwen.ai/blog?id=qwen3.8-flash-next",
"availabilitySource": "https://qwen.ai/blog?id=qwen3.8-flash-next"
},
...
]
} How do I call the API from JavaScript?
const res = await fetch('https://www.aipricing.guru/api/pricing.json');
const data = await res.json();
// Find the cheapest current input price
const cheapest = data.models
.filter((m) => m.status !== 'legacy' && m.availability !== 'suspended')
.sort((a, b) => a.pricing.inputPerM - b.pricing.inputPerM)[0];
console.log(`Cheapest: ${cheapest.name} at $${cheapest.pricing.inputPerM}/1M`); How do I call the API from Python?
import requests
data = requests.get('https://www.aipricing.guru/api/pricing.json').json()
openai_models = [m for m in data['models'] if m['provider'] == 'openai']
for m in openai_models:
p = m['pricing']
print(f"{m['name']}: ${p['inputPerM']}/M input, ${p['outputPerM']}/M output") How do I call the API with curl?
curl -s https://www.aipricing.guru/api/pricing.json | jq '.models[] | select(.provider=="anthropic")' Price History API
A second endpoint exposes daily pricing snapshots, so you can track how prices change over time. The response includes every snapshot we've taken, each containing a full model roster with that day's prices.
- URL:
https://www.aipricing.guru/api/price-history.json - Method:
GET(no authentication required) - Response:
application/json - CORS:
Access-Control-Allow-Origin: * - Dataset terms: same as the current pricing dataset; permission requests go to info@aipricing.guru
{
"generatedAt": lastUpdatedISO,
"snapshotCount": 1,
"snapshots": [
{
"date": lastUpdatedISO,
"models": [
{
"id": "gpt-5.6-terra",
"name": "GPT-5.6 Terra",
"provider": "openai",
"inputPerM": 2.5,
"outputPerM": 15,
"cachedInputPerM": 0.25
},
...
]
}
]
} Use this to build price-tracking dashboards, alert on changes, or analyze pricing trends. See the changelog page for a human-readable view.
Can I use this data commercially?
The AI Pricing Guru dataset is provided for informational use. You may use it for personal, editorial, research, educational, and internal business purposes with appropriate attribution to AI Pricing Guru. Commercial redistribution, resale, republishing at scale, inclusion in a competing public dataset/API, or use as the primary data source for a commercial pricing-comparison product requires prior written permission. For permission requests, email info@aipricing.guru. No API key, no rate limit, no registration.
What about rate limits and uptime?
The endpoint is a static JSON file served from AWS Amplify's edge network — effectively unlimited throughput and no per-client rate limit. Responses are cached for 3600 seconds. If you need to poll more than once per hour, set If-None-Match with the ETag; 304 responses are free. For bulk historical data, webhooks on price changes, permissions, corrections, or takedown requests, email info@aipricing.guru.
Which providers are covered?
OpenAI, Anthropic, Google (Gemini), DeepSeek, xAI (Grok), Mistral AI, Meta (Llama, via hosted partners), Groq, Cohere, Together AI, Perplexity, Fireworks. New providers are added on request. The full list is in the response under distinct provider values; see the OpenAPI spec for the schema.
Methodology
Prices are scraped daily from each provider's canonical pricing page (linked on the corresponding provider page on this site). All figures are expressed in USD per 1 million tokens to enable direct comparison. We report input, output, and cached-input rates where the provider publishes them. Provider prices, billing rules, taxes, regional availability, and discounts can change without notice, so the API includes both lastUpdated and disclaimer fields and users should verify directly with the provider before purchase decisions. Source last refreshed .