Skip to main content

Open source AI cost tracking for OpenAI and Anthropic

Project description

TokenBudget

Open source AI cost tracking. One line to start tracking.

Install

pip install tokenbudget

Quick Start

import openai, tokenbudget

client = tokenbudget.wrap(
    openai.Client(),
    api_key="tb_ak_..."  # free at tokenbudget.com
)

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}]
)
# Everything tracked automatically in your dashboard

Anthropic Support

import anthropic, tokenbudget

client = tokenbudget.wrap(
    anthropic.Anthropic(),
    api_key="tb_ak_..."
)

message = client.messages.create(
    model="claude-sonnet-4-20250514",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello!"}]
)

Features

  • One line integration — wrap your existing client, done
  • Zero latency impact — tracking runs in background
  • Feature tagging — know cost per feature, user, project
  • Multi-provider — OpenAI + Anthropic (Gemini coming soon)
  • Privacy first — we never store prompts, responses, or API keys

Tagging

with tokenbudget.tags(feature="chatbot", user_id="user-123"):
    response = client.chat.completions.create(...)

Dashboard

See your costs at tokenbudget.com — broken down by feature, user, model, and project.

Self-Hosting

# Copy or extract the project folder, then:
cd tokenbudget-main
docker compose up -d

License

Apache 2.0 — Free for personal and open source use. Commercial use requires license. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nebeso-0.1.0-py3-none-any.whl (19.3 kB view details)

Uploaded Python 3

File details

Details for the file nebeso-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: nebeso-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 19.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for nebeso-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9b8bf6f215d3473baeb2ec805e81d0b68fad65f42c01a239470c1475837572a8
MD5 78033a1d66fe08cad1197f724e94cd14
BLAKE2b-256 ef0e78158d0902a5f5204ffe2e91fb2f8c91c7f7e7f9560fcb97f8a831bc2f9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page