TC
TokenCost

Free Pricing API

JSON endpoint for LLM pricing data. No auth, no rate limits, CORS enabled. Use it in your apps, agents, and scripts.

Get All Models

GEThttps://tokencost.app/api/models

Returns all 35+ models with pricing, context windows, and output limits.

{
  "updated": "2026-03-05",
  "total": 35,
  "source": "https://tokencost.app",
  "models": [
    {
      "id": "gpt-5.4",
      "name": "GPT-5.4",
      "provider": "OpenAI",
      "pricing": {
        "input_per_1m_tokens": 2.5,
        "output_per_1m_tokens": 15,
        "currency": "USD"
      },
      "context_window": 1050000,
      "max_output_tokens": 128000,
      "tokenizer": "o200k_base",
      "notes": "Most capable OpenAI model. 2x input / 1.5x output pricing above 272K context."
    },
    ...
  ]
}

Filter by Provider

GEThttps://tokencost.app/api/models?provider=anthropic

Available providers: openai, anthropic, google, xai, meta, mistral, deepseek

Get Specific Model

GEThttps://tokencost.app/api/models?id=claude-opus-4.6

CSV Export

GEThttps://tokencost.app/api/models?format=csv

Returns data as CSV for spreadsheets and data pipelines.

Usage Examples

Python
import requests

data = requests.get("https://tokencost.app/api/models").json()

for model in data["models"]:
    print(f"{model['name']}: {model["pricing"]["input_per_1m_tokens"]}/M in")
JavaScript / Node.js
const res = await fetch("https://tokencost.app/api/models?provider=openai");
const { models } = await res.json();

models.forEach(m =>
  console.log(`${m.name}: $${m.pricing.input_per_1m_tokens}/M input`)
);
cURL
curl "https://tokencost.app/api/models?provider=anthropic" | jq '.models[].name'
Notes
  • No authentication required
  • CORS enabled for all origins
  • Cached for 24 hours (CDN-friendly)
  • Pricing data updated regularly
  • Built by Ankit Aglawe