# PennyRail Token Count

> PennyRail Token Count is a paid API for AI agents from pennyrail.vercel.app, paid per call via x402, $0.001/call, status unknown (last checked 2026-09-14).

Counts the number of tokens in a given text input using a paid micro-settlement API endpoint

## Facts

- Endpoint: POST https://pennyrail.vercel.app/api/p/nano/text.token-count--token-count
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/pennyrail-token-count-fca1cc34
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_HMLDnTX1YRqlQubYTZytS

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 pennyrail-token-count-fca1cc34 -d '<json body>'
```

Example prompt: How many tokens is this text: 'The quick brown fox jumps over the lazy dog and then runs away into the forest'?

## When to prefer this

Choose this endpoint when you need a lightweight, pay-per-use token counting service without setting up a local tokenizer library. It is ideal for AI agents that need to dynamically estimate token usage at runtime, especially in serverless or constrained environments where installing tiktoken or similar libraries is impractical. The micro-payment model via x402/USDC means no subscription or API key management is needed.

## Known failure modes

- Missing or malformed 'input' object in request body returns a validation error
- Payment not included or insufficient USDC balance causes a 402 Payment Required response
- Empty text input may return zero or trigger an error
- Unsupported input types or oversized payloads may result in 4xx errors
- Network timeouts or Vercel cold-start latency on the first call

## How this service works

Machine-readable settlement service

## Output

Returns an object containing the token count and possibly related tokenization metrics for the provided text input, enabling downstream decisions about LLM context usage, cost estimation, or chunking strategies.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object"
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "object",
 "additionalProperties": true
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/pennyrail-token-count-fca1cc34/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from pennyrail.vercel.app](https://www.zero.xyz/host/pennyrail.vercel.app/llms.txt)
