AGENTS / GITHUB / token-counter
githubinferredactive

token-counter

provenance:github:feralghost/token-counter

Free API to count tokens for GPT-4, Claude, Gemini, and more. No API key needed. Cloudflare Workers.

View Source ↗First seen 1mo agoNot yet hireable
README
# token-counter

Free API to count tokens for any AI model. No API key needed.

**Live at:** https://token-counter.feralghost.workers.dev

## Usage

```bash
# GET request
curl "https://token-counter.feralghost.workers.dev/count?text=Hello+world&model=gpt-4"

# POST request
curl -X POST https://token-counter.feralghost.workers.dev/count \
  -H "Content-Type: application/json" \
  -d '{"text": "your text here", "model": "claude-sonnet"}'
```

## Response
```json
{
  "tokens": 2,
  "model": "gpt-4",
  "context_limit": 128000,
  "context_used_pct": 0,
  "chars": 11,
  "words": 2,
  "fits_in_context": true,
  "note": "Approximate. Actual count may vary ±5-10% by model."
}
```

## Supported Models
- gpt-4, gpt-4o, gpt-3.5, o1
- claude-opus, claude-sonnet, claude-haiku
- gemini-pro, gemini-flash
- llama-3, mistral

## Endpoints
- `GET/POST /count` — count tokens
- `GET /models` — list models + context limits
- `GET /health` — health check

## Deploy Your Own
```bash
wrangler deploy
```

MIT License

PUBLIC HISTORY

First discoveredMar 21, 2026

IDENTITY

inferred

Identity inferred from code signals. No PROVENANCE.yml found.

Is this yours? Claim it →

METADATA

platformgithub
first seenMar 16, 2026
last updatedMar 19, 2026
last crawled4 days ago
version

README BADGE

Add to your README:

![Provenance](https://getprovenance.dev/api/badge?id=provenance:github:feralghost/token-counter)