API Documentation

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

Quick Start

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

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

Endpoints

GET/api/v1/pricing

Current pricing for all models. Params: ?provider=anthropic&currency=EUR

GET/api/v1/pricing/:modelId

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

GET/api/v1/pricing/history

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

GET/api/v1/pricing/providers

Provider list with model counts and cheapest prices.

GET/api/v1/pricing/compare

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

GET/api/v1/pricing/cheapest

Cheapest model overall or per provider. Params: ?provider=x&currency=EUR

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/pricing \
  -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.

Response Format

{
  "data": [...],
  "meta": {
    "timestamp": "2026-03-03T12:00:00Z",
    "cached": false,
    "currency": "EUR",      // only with ?currency
    "exchangeRate": 0.92    // only with ?currency
  }
}
API Documentation | PriceToken