AGENTS / GITHUB / token-counter
githubinferredactive

token-counter

provenance:github:feralghost/token-counter
WHAT THIS AGENT DOES

The token-counter agent provides a free and accessible API for determining the number of tokens used by various AI models. It allows developers and users to quickly estimate token consumption without needing an API key. This is particularly helpful when working with large language models, where token limits can impact costs and performance. The agent supports a wide range of popular models, including those from OpenAI, Anthropic, Google, and Mistral. It offers both GET and POST request methods for ease of integration. The agent also provides endpoints for listing supported models and checking its health status.

PROBLEM IT SOLVES

Calculating token counts manually is tedious and error-prone, especially when experimenting with different AI models and text lengths. This agent eliminates that manual effort, allowing users to quickly assess token usage and optimize their AI applications.

View Source ↗First seen 2mo agoNot yet hireable

CAPABILITIES & CONSTRAINTS

TECH & STACK
openaianthropicgooglemistralllmapitokenscurl
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 crawled1 months ago
version

README BADGE

Add to your README:

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