# CoCo Token Estimator

> CoCo Token Estimator is a paid API for AI agents from cocoeatsai.com, paid per call via x402, $0.001/call, status unknown (last checked 2026-10-19).

Estimates token count and optional cost for a given text string using a heuristic (~4 chars/token) approximation

## Facts

- Endpoint: GET https://cocoeatsai.com/area4/agent/tools/token-estimate?utm_source=zero.xyz
- Price: $0.001/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-19
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/coco-token-estimator-97b2324e
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_0NZmjQUr79JgqMhN07vbq

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 coco-token-estimator-97b2324e
```

Example prompt: How many tokens is this text roughly: 'The quick brown fox jumps over the lazy dog near the riverbank at dusk'? And what would it cost at $2.00 per million tokens?

## When to prefer this

Choose this endpoint when you need a quick, cheap heuristic token estimate without calling a full tokenizer library or LLM API. Ideal for pre-flight checks, cost budgeting, or validating prompt length before submitting to a model. Not suitable when exact token counts are required (e.g., when operating near a hard context-window limit) — in those cases prefer model-native tokenizer APIs like tiktoken.

## Known failure modes

- Missing required 'text' query parameter results in incomplete or null estimates
- Very non-English or code-heavy text will produce inaccurate estimates due to the fixed 4-chars/token heuristic
- cost_estimate_usd returns null if price_per_million is not supplied
- Extremely long text strings may hit query parameter length limits
- Non-numeric price_per_million values may cause cost_estimate_usd to be null or error

## How this service works

Zach Riehn's lab: an about-me and portfolio, a news desk, The Atelier for AI experiments, Launch Lab for XRP research, and Fracture for games.

## Output

Returns a JSON object with the character count, word count, heuristic token estimate (~4 chars/token for English), and optionally a cost estimate in USD if price_per_million is provided. Includes a note clarifying the heuristic nature of the estimate and that exact counts vary by model tokenizer.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input",
  "output"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method",
    "queryParams"
   ],
   "properties": {
    "type": {
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ]
    },
    "queryParams": {
     "type": "object",
     "properties": {
      "text": {
       "type": "string"
      },
      "price_per_million": {
       "type": "string"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type",
    "example"
   ],
   "properties": {
    "type": {
     "const": "json"
    },
    "example": {
     "type": "object",
     "required": [
      "chars"
     ],
     "properties": {
      "chars": {
       "type": "number"
      }
     }
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "note": "Heuristic (~4 chars/token English); exact counts depend on the model tokenizer.",
  "chars": 51,
  "words": 11,
  "tokens_estimate": 15,
  "cost_estimate_usd": null
 },
 "exampleNote": "Computed offline with demonstration inputs; time/random values are illustrative."
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/coco-token-estimator-97b2324e/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from cocoeatsai.com](https://www.zero.xyz/host/cocoeatsai.com/llms.txt)
