ATC - Anthropic Tokens Counter
A command-line tool to count tokens for Anthropic's Claude models before sending requests.
Features
- Count tokens for various Claude models (Opus, Sonnet, Haiku)
- Read input from files or stdin
- Model management with short and full names
- Configurable default model
- Cross-platform XDG configuration support
Installation
From Source
git clone <repository-url>
cd claude-count-tokens
pip install .
For Development
git clone <repository-url>
cd claude-count-tokens
pip install -e .
Setup
Before using ATC, you need to set your Anthropic API key:
export ANTHROPIC_API_KEY="your-api-key-here"
Usage
Count Tokens
Count tokens from stdin:
echo "hello world" | atc
Count tokens from a file:
atc CLAUDE.md
atc ./CLAUDE.md
atc ~/.claude/CLAUDE.md
atc /Users/foo/.claude/CLAUDE.md
Count tokens with a specific model:
echo "hello world" | atc --model sonnet
atc CLAUDE.md -m haiku
Model Management
List available models:
atc models
List models with full names:
atc models --verbose
atc models -v
Set default model:
atc models set-default sonnet
Available Models
Short Names
opus- Claude Opus 4.1 (default)opus-4,opus-4.1- Claude Opus 4.1sonnet- Claude Sonnet 4.1sonnet-4,sonnet-4.1- Claude Sonnet 4.1sonnet-3.7- Claude Sonnet 3.7haiku- Claude Haiku 3.5haiku-3.5- Claude Haiku 3.5haiku-3- Claude Haiku 3
Full Names
claude-opus-4-1-20250805claude-sonnet-4-1-20250805claude-sonnet-3-7-20240805claude-haiku-3-5-20241022claude-haiku-3-20240307
Configuration
ATC stores its configuration in $XDG_STATE_HOME/atc/settings.json (or ~/.local/state/atc/settings.json if XDG_STATE_HOME is not set).
The configuration file stores:
- Default model selection
Requirements
- Python 3.8+
anthropicPython library- Valid Anthropic API key
License
MIT License
Metadata
Release files for anthropic-token-counter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| anthropic_token_counter-0.1.0.tar.gz | 5.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| anthropic_token_counter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 12.8 kB
Release files / anthropic_token_counter-0.1.0.tar.gz
| Download URL | anthropic_token_counter-0.1.0.tar.gz |
|---|---|
| Size | 5.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
72db270ff557964dfb83565bdd9ee49a7ff6a8298269daa40f8b63482d805413
|
|
BLAKE2b-256 checksum How to use checksums |
87b221859e3b9f6e4570bbad503aba7cfb8356952f8ef635bceb587d92876028
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency logRelease files / anthropic_token_counter-0.1.0-py3-none-any.whl
| Download URL | anthropic_token_counter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 7.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f20d2707ecccd9dd2f9ff3f997f48c400414cf0e534507914d19582216a7cc64
|
|
BLAKE2b-256 checksum How to use checksums |
366342fb473a4b3b49ebb76dc49522a083748d9f0c568ec3f55ca89ef5c39215
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2025.
Transparency log