Skip to content

Atena-IT/tokenpricing

Repository files navigation

tokenpricing

API pricing math for 1k+ AI models from LLMTracker with multi-currency support.

Libraries

Library Language Package Status
Python SDK Python 3.12+ tokenpricing Stable
TypeScript SDK TypeScript / Node 18+ tokenpricing Stable

Services

Service Language Path Status
Notifier Python 3.12+ services/notifier/ Experimental

Quick Start

Python

pip install tokenpricing
from tokenpricing import get_pricing_sync, compute_cost_sync

pricing = get_pricing_sync("openai/gpt-5.2", currency="EUR")
print(f"Input: €{pricing.input_per_million:.2f}/1M tokens")

cost = compute_cost_sync("openai/gpt-5.2", input_tokens=1000, output_tokens=500)
print(f"Total: ${cost:.6f}")

TypeScript

npm install tokenpricing
import { getPricing, computeCost } from "tokenpricing";

const pricing = await getPricing("openai/gpt-5.2", "EUR");
console.log(`Input: €${pricing.inputPerMillion.toFixed(2)}/1M tokens`);

const cost = await computeCost("openai/gpt-5.2", 1000, 500);
console.log(`Total: $${cost.toFixed(6)}`);

CLI (Python)

Install via pip, then use the tokenpricing command.

# Show price per 1M tokens (USD default)
tokenpricing pricing openai/gpt-5.2

# Convert to another currency (uses cached FX rates)
tokenpricing pricing openai/gpt-5.2 --currency EUR

# JSON output for scripting
tokenpricing pricing openai/gpt-5.2 --json

# Compute total cost for a usage
tokenpricing cost openai/gpt-5.2 --in 1000 --out 500 --currency EUR

Claude Code skill

This repository ships a Claude Code marketplace manifest at .claude-plugin/marketplace.json and the canonical hidden skill at skills/tokenpricing/SKILL.md.

When the plugin is installed, Claude Code can pick up the skill automatically and shell out to the existing tokenpricing CLI for pricing lookups and workload cost calculations.

The canonical skill source in this repository is skills/tokenpricing/SKILL.md.

Data Source

Pricing data is sourced from LLMTracker, which aggregates and updates pricing information from various LLM providers every six hours.

Repository Structure

tokenpricing/
├── .claude-plugin/      Claude Code marketplace manifest
├── skills/              Canonical coding-agent skill
├── services/
│   └── notifier/        Webhook notification service
├── libraries/
│   ├── python/          Python SDK + CLI (PyPI)
│   └── typescript/      TypeScript SDK (npm)
├── .github/workflows/   CI/CD (path-filtered per library)
└── LICENSE

Development

Each library is self-contained. See the individual READMEs for setup and development instructions:

Credits

License

See LICENSE file for details.

About

API pricing math for 1k+ AI models

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors