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.1.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.1-py3-none-any.whl (3.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: repotoken-0.1.1.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.1.tar.gz
Algorithm Hash digest
SHA256 b72dd688a7c66b5f4f00aee046ab9d5c119f900c7d9bc071c01c8c821f5c31c1
MD5 7ef7410d2f752ae72ad90fcb5a12ab42
BLAKE2b-256 7417cf7047b30774cbcbc4a9165fa87ddb4612681c56d11dc2f23d0a842aa152

See more details on using hashes here.

File details

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

File metadata

  • Download URL: repotoken-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 64ff0d8140127fe6d7cc4443b8fb8d1447241f07c93986f623db5319a46c26cc
MD5 5ef12bfdfdd145a0891ef572d944300e
BLAKE2b-256 a3e1c15f7fd8fd4c229d01ae5975bc6bf8975e7df4e76d8b72baa172956c2399

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