# Coinlight Text Stats & Token Estimator

> Coinlight Text Stats & Token Estimator is a paid API for AI agents from coinlight-app.vercel.app, paid per call via x402, $0.005/call, status unknown (last checked 2026-10-29).

Counts characters, words, lines, and bytes in a text string, and estimates LLM token consumption to help agents budget context windows before making API calls.

## Facts

- Endpoint: GET https://coinlight-app.vercel.app/p/text-stats?utm_source=zero.xyz
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/coinlight-text-stats-token-estimator-0ed9ab74
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_VcS7bUJYwZI6qPU20cieF

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 coinlight-text-stats-token-estimator-0ed9ab74
```

Example prompt: Before I send this article to the LLM, can you check how many characters, words, and estimated tokens it has? Here's the text: 'The global economy showed signs of recovery last quarter, driven primarily by...'

## When to prefer this

Use this endpoint when an AI agent needs to programmatically verify whether a piece of text will fit within an LLM's context window before making a potentially expensive or failing API call. Ideal for pipelines that process variable-length user input, documents, or generated content and need to gate or truncate based on token budget. Prefer this over manual estimation when precision matters or when automating document chunking logic.

## Known failure modes

- Text exceeding 200k characters returns an error
- Empty text input may return zero counts or validation error
- Extremely long inputs may time out
- Token estimates are approximations and may differ slightly from actual tokenizer counts
- Missing required 'text' query parameter returns a 400-style error

## How this service works

Coinlight charges USDC per API call with the x402 protocol on Solana and Base.

## Output

Returns a JSON object with numeric counts for characters, words, lines, and bytes in the input text, along with an estimated LLM token count — enabling agents to make informed decisions about context window usage before dispatching text to a language model.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "examples": [
      {
       "text": "The quick brown fox jumps over the lazy dog."
      }
     ],
     "required": [
      "text"
     ],
     "properties": {
      "text": {
       "type": "string",
       "description": "Text to measure (max 200k chars)."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "endpoint": "Text stats and token estimate"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/coinlight-text-stats-token-estimator-0ed9ab74/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from coinlight-app.vercel.app](https://www.zero.xyz/host/coinlight-app.vercel.app/llms.txt)
