Skip to main content

Count tokens across any code repository — fast, local, no API calls

Project description

repotoken

Count tokens across any code repository — fast, local, no API calls.

$ repotoken .

scanning /your/project ...

  src/parser.py          3.1K tokens
  src/main.py            2.8K tokens
  src/utils.py           1.2K tokens
  tests/test_parser.py     890 tokens
  README.md                430 tokens

  ──────────────────────────────────
  TOTAL                    8.4K tokens
  files scanned                   5
  skipped (binary)                3

Why?

LLMs have context limits — GPT-4o tops out at 128K tokens, most Claude models at 200K. If you're working with AI tooling on a codebase, you need to know how big your repo actually is in token terms — not lines, not bytes, but tokens.

repotoken tells you exactly that, per file and in total, so you can make informed decisions about chunking, batching, or summarisation.

Install

pip install repotoken

Usage

# scan current directory
repotoken .

# scan any repo
repotoken /path/to/any/repo

Notes

  • Uses cl100k_base encoding (GPT-4 / GPT-4o tokenizer) — accurate for most modern LLMs within ~10-15%
  • Detects binaries using null-byte scanning (same method as git) — no hardcoded extension lists
  • Automatically skips .git, node_modules, __pycache__, .venv, and other noise
  • Sorts output by token count so the heaviest files are at the top
  • No API calls, no network requests, runs entirely locally

License

MIT

Project details


Download files

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

Source Distribution

repotoken-0.1.0.tar.gz (3.0 kB view details)

Uploaded Source

Built Distribution

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

repotoken-0.1.0-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

Details for the file repotoken-0.1.0.tar.gz.

File metadata

  • Download URL: repotoken-0.1.0.tar.gz
  • Upload date:
  • Size: 3.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for repotoken-0.1.0.tar.gz
Algorithm Hash digest
SHA256 abe5e94e7c78628ebcff0289fad9d3b7c6d2c6acefbb1fafc69fa57c7429c61f
MD5 390d73e07f15717fd6fb3f4590c947d5
BLAKE2b-256 3115aa79a230fbe96440738eecb51f12648e3ffa97fe748fc5f200d170969b64

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for repotoken-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2481c005e76d734d00b0dd959386ec5fd58f76f3e5fcfbedbb666f9fefc09d4e
MD5 9e1fa9e3df8c188305624f4ae07df892
BLAKE2b-256 b2d14a987e22de9e88f986bf03fc1261df1a54e83a64d12c1821eea54926bd44

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