# x402.shizu.me Token Counter

> x402.shizu.me Token Counter is a paid API for AI agents from x402.shizu.me, paid per call via x402, $0.002/call, status unknown (last checked 2026-09-15).

Counts exact tokens and characters in text using OpenAI tokenizers (cl100k_base or o200k_base), paid via USDC on Base.

## Facts

- Endpoint: POST https://x402.shizu.me/count
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/x402-shizu-me-token-counter-7cfd66a5
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_SmIem42rpfyWPUvYYB8Sl

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability x402-shizu-me-token-counter-7cfd66a5 -d '<json body>'
```

Example prompt: How many tokens is this text using the o200k_base encoding: 'The quick brown fox jumps over the lazy dog. This is a test of tokenization for my GPT-4o prompt budget.'

## When to prefer this

Use this endpoint when you need exact OpenAI-compatible token counts (cl100k_base for GPT-3.5/4, o200k_base for GPT-4o) before sending prompts to LLMs, to avoid context window overflows or to budget API costs. Prefer over client-side estimation when precision matters.

## Known failure modes

- Missing or empty text body returns an error
- Invalid encoding value returns an error
- Insufficient USDC payment on Base causes payment failure and request rejection
- Overly large text payloads may be rejected or time out

## How this service works

Exact token count for text using OpenAI tokenizers. Body: {text, encoding?} where encoding is cl100k_base or o200k_base (default). Returns tokens and char_count. Use to budget prompts and context windows.

## Output

Returns the exact token count and character count for the submitted text under the specified OpenAI tokenizer encoding.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {},
  "encoding": {}
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tokens": 2,
  "encoding": "o200k_base",
  "char_count": 11
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/x402-shizu-me-token-counter-7cfd66a5/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402.shizu.me](https://www.zero.xyz/host/x402.shizu.me/llms.txt)
