# AgentOps-AI/tokencost

Easy token price estimates for 400+ LLMs. TokenOps.

Repository: https://github.com/AgentOps-AI/tokencost
Canonical: https://ross.abutalabs.com/products/tokencost
Homepage: https://agentops.ai
Language: Python
License: MIT
License Family: permissive
Topics: analytics, claude, large-language-models, llm, observability, openai, price, price-tracker, token, tokenization
Last push: 2025-09-05T08:10:10+00:00

## Health v2 (maintenance only)
Score: 47/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 40, release rhythm 42, longevity 71
- inputs: {"age_days": 1004, "days_push": 362, "days_rel": 385, "gap_med": 16.5, "n_releases_24m": 13}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2004, forks 106 (observed 2026-08-28T04:06:04.606647+00:00)

## What it is
A Python library that estimates the USD cost of LLM API calls by counting tokens for prompts and completions across 400+ models. It maintains up-to-date pricing data for major providers like OpenAI and Anthropic.

## Use cases
- estimate the cost of an OpenAI API call before sending it
- count tokens in a prompt for gpt-3.5-turbo
- track LLM pricing across 400+ models
- calculate USD cost of prompts and completions in an AI agent
- budget monitoring for LLM applications

## When to choose
- you need clientside token counting and cost estimation without API round-trips
- you want a lightweight single-function API for cost calculation
- you build AI agents and need to track spend per model

## When to avoid
- you need full LLM observability, tracing, and debugging rather than just cost math
- you need exact billing figures from the provider rather than estimates
- your stack is not Python

## Facets
- artifact type: library
- maturity: active
- function: analytics, monitoring, sdk
- domain: large-language-models, artificial-intelligence, analytics
- platform: python, cli
- tags: token-counting, cost-estimation, llm-pricing, openai, anthropic, ai-agents

## Member repositories
- AgentOps-AI/tokencost (main) score 47

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:04.606647+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:01:35.437000+00:00, confidence not recorded.
  - readme: https://github.com/AgentOps-AI/tokencost (fetched 2026-08-28T04:06:04.606647+00:00, sha 51a930ebd109)
  - homepage: https://agentops.ai (fetched 2026-08-29T10:41:30.505831+00:00, sha cf2bd381c35b)
  - site_page: https://docs.agentops.ai (fetched 2026-08-29T10:41:30.515498+00:00, sha 1caf236089e3)
  - registry_pypi: https://pypi.org/pypi/tokencost/json (fetched 2026-08-29T10:41:30.517671+00:00, sha 480d0241314f)
- Data as of 2026-08-30T08:39:29.467469+00:00.
