API Documentation

Free REST API for LLM pricing data. No signup required for 30 requests/hour.

Quick Start

curl https://pricetoken.ai/api/v1/text

Offline Cost Calculator

Calculate costs without any API call — works in browsers, Node.js, and edge runtimes.

import { calculateModelCost } from 'pricetoken';

const cost = calculateModelCost(
  'claude-sonnet-4-6',
  1_000_000,  // 1M input tokens
  100_000     // 100K output tokens
);

console.log(cost.totalCost); // $4.50

Filter by Launch Date

Every model includes a launchDate field (API GA date). Use the after and before query params on /text and /text/cheapest to filter by date range.

# Models launched in 2025 or later
curl "https://pricetoken.ai/api/v1/text?after=2025-01-01"

# Models launched before 2025
curl "https://pricetoken.ai/api/v1/text?before=2025-01-01"

# Models launched in H1 2025
curl "https://pricetoken.ai/api/v1/text?after=2025-01-01&before=2025-07-01"

# Cheapest model launched since October 2025
curl "https://pricetoken.ai/api/v1/text/cheapest?after=2025-10-01"

Endpoints

Token-based pricing for LLMs. Uses inputPerMTok and outputPerMTok (cost per million tokens).

GET/api/v1/text

Current pricing for all models. Params: ?provider=anthropic&currency=EUR&after=2025-01-01&before=2025-12-31

GET/api/v1/text/:modelId

Single model pricing and metadata. Param: ?currency=EUR

GET/api/v1/text/history

Historical pricing data. Params: ?days=30&modelId=x&provider=y

GET/api/v1/text/providers

Provider list with model counts and cheapest prices.

GET/api/v1/text/compare

Side-by-side comparison. Params: ?models=a,b,c (max 10)&currency=EUR

GET/api/v1/text/cheapest

Cheapest model overall or per provider. Params: ?provider=x&currency=EUR&after=2025-01-01&before=2025-12-31

GET/api/v1/pricing/currencies

Supported currencies with exchange rates.

Rate Limits

Without API key30 requests / hour
With API key500 requests / hour

API keys are free — no charges, ever. Key holders get higher rate limits.

Rate limit headers are included in every response: X-RateLimit-Limit, X-RateLimit-Remaining, X-RateLimit-Reset.

API Keys

API keys are completely free — there are no charges, no credit card required, and no usage fees. Keys simply unlock higher rate limits (500 requests/hour instead of 30).

Key Format

All keys use the pt_ prefix:

pt_live_abc123def456...

Authentication

Pass your API key via the Authorization header using Bearer token format:

curl https://pricetoken.ai/api/v1/text \
  -H "Authorization: Bearer pt_live_YOUR_KEY"

Get an API Key

Self-service signup coming soon

In the meantime, you can request a free API key by opening a GitHub issue or emailing [email protected].

Keys are free — no credit card, no trial period, no catches.

Confidence Scoring

Every model includes a Bayesian confidence score (0–100) that reflects how much you can trust the pricing data. The score is computed at query time so it naturally decays as data ages.

How it works

We use log-odds Bayesian updating: start with a prior based on data source, then update with evidence from agent consensus, data age, and price stability.

P(correct) = sigmoid(log_prior + LLR_agents + LLR_age + LLR_stability)

Source priorverified=0.90, admin=0.85, seed=0.55, fetched=0.40, carried=0.25
Agent consensus3/3 approve: +1.5 LLR, 1/3: -0.7 LLR
Age decay+1.0 at 0 days, 0.0 at 7 days, -1.5 at 14+ days
Price stabilityUnchanged: +0.3, changed: -0.3

Response fields

confidenceScore0–100 numeric score
confidenceLevel"high" (≥80), "medium" (50–79), "low" (<50)
freshness.lastVerifiedISO 8601 timestamp of last verification
freshness.ageHoursHours since last verification
freshness.staletrue if data is older than 48 hours

Response Format

{
  "data": [
    {
      "modelId": "claude-sonnet-4-6",
      "provider": "anthropic",
      "displayName": "Claude Sonnet 4.6",
      "inputPerMTok": 3,
      "outputPerMTok": 15,
      "contextWindow": 200000,
      "confidenceScore": 97,
      "confidenceLevel": "high",
      "freshness": {
        "lastVerified": "2026-03-05T08:00:00Z",
        "ageHours": 4,
        "stale": false
      },
      "launchDate": "2026-02-17",
      ...
    }
  ],
  "meta": {
    "timestamp": "2026-03-05T12:00:00Z",
    "cached": false,
    "currency": "EUR",      // only with ?currency
    "exchangeRate": 0.92    // only with ?currency
  }
}
API Documentation | PriceToken