# Strale Token Count

> Strale Token Count is a paid API for AI agents from api.strale.io, paid per call via x402, $0.0216/call, status unknown (last checked 2026-09-14).

Count the number of tokens in a text string for a specified LLM model (e.g. gpt-4o, claude-3-haiku)

## Facts

- Endpoint: GET https://api.strale.io/x402/v2/token-count
- Price: $0.0216/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/strale-token-count-6a69d6ae
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_QUDgTBmQyTgsmDzyK2Ux-

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 strale-token-count-6a69d6ae
```

Example prompt: How many tokens is the following text when tokenized for gpt-4o: 'The quick brown fox jumps over the lazy dog. This is a sample sentence to test tokenization.'

## When to prefer this

Use this endpoint when you need accurate, model-specific token counts before sending prompts to an LLM — particularly for cost estimation, context window validation, or prompt engineering workflows. It is preferable over client-side tokenization libraries when you need audit-trail records of token counts (e.g. for billing reconciliation or compliance), or when you want a neutral third-party count without depending on each provider's own SDK.

## Known failure modes

- Missing required 'text' query parameter returns a 400 error
- Unsupported or misspelled model name may return an error or fall back to a default tokenizer
- Empty text string may return zero tokens or a validation error
- Payment failure via x402 protocol results in 402 response before processing begins
- Rate limiting or quota exhaustion returns a 429 error

## How this service works

The trust layer for AI agents — 250+ independently tested data capabilities across 27 countries. Execute capabilities via REST, MCP, A2A, or x402 micropayments. Every call returns an audit record with cryptographic chain hashing.

## Output

Returns the token count for the provided text string as tokenized by the specified LLM model, along with a cryptographically hashed audit record for provenance and traceability.

## 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",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "text"
     ],
     "properties": {
      "text": {
       "type": "string"
      },
      "model": {
       "type": "string",
       "description": "gpt-4o, claude-3-haiku, etc."
      }
     }
    }
   },
   "additionalProperties": false
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/strale-token-count-6a69d6ae/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.strale.io](https://www.zero.xyz/host/api.strale.io/llms.txt)
