# Agentshelf Heuristic Token Counter

> Agentshelf Heuristic Token Counter is a paid API for AI agents from agentshelf.syntexa.ch, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-01).

Estimates token count for text using heuristic methods (chars/4, word count, or regex) without invoking any LLM or tokenizer

## Facts

- Endpoint: POST https://agentshelf.syntexa.ch/v1/token-count?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-01
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/agentshelf-heuristic-token-counter-f685cb57
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_s-OgTdb9wMcSznRs8whQH

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 agentshelf-heuristic-token-counter-f685cb57 -d '<json body>'
```

Example prompt: Roughly how many tokens is this text using the chars4 heuristic: 'The quick brown fox jumps over the lazy dog and then sat down for a rest'?

## When to prefer this

Choose this endpoint when you need a fast, cheap, model-agnostic token estimate without invoking an actual LLM tokenizer. Ideal for pre-flight checks before sending prompts to paid LLM APIs, or for lightweight agents that need rough token budgeting. Try the free POST /v1/sandbox/token-count endpoint first; only call this paid endpoint if the sandbox is unavailable or rate-limited.

## Known failure modes

- Text exceeds 100,000 character limit — request rejected
- Text field is empty or missing — validation error
- Invalid method enum value supplied — request rejected
- Payment of $0.001 USDC not completed — 402 Payment Required response

## How this service works

Call when an agent needs a heuristic token count for text (not a model tokenizer). No LLM. Exact $0.001 USDC. Prefer unpaid POST /v1/sandbox/token-count first.

## Output

Returns a numeric token count estimate based on the selected heuristic method (chars4 divides character count by 4, words counts whitespace-delimited tokens, regex applies a pattern-based split). No LLM or external model is invoked.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "text": {
   "type": "string",
   "examples": [
    "hello world"
   ],
   "maxLength": 100000,
   "minLength": 1,
   "description": "Text to count. This is not a model tokenizer."
  },
  "method": {
   "enum": [
    "chars4",
    "words",
    "regex"
   ],
   "type": "string",
   "examples": [
    "words"
   ],
   "description": "Count method: chars4 (ceil of characters/4), words (whitespace), or regex. Default chars4."
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/agentshelf-heuristic-token-counter-f685cb57/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from agentshelf.syntexa.ch](https://www.zero.xyz/host/agentshelf.syntexa.ch/llms.txt)
