# LLM Token Count & Cost Estimator

> LLM Token Count & Cost Estimator is a paid API for AI agents from api.strale.io, paid per call via x402, $0.0216/call, status unknown (last checked 2026-10-10).

Estimates token count and cost for a given text across popular LLM models (GPT-4o, Claude, Gemini, Mistral, Llama) using local algorithms — no external API calls.

## Facts

- Endpoint: GET https://api.strale.io/x402/token-count?utm_source=zero.xyz
- Price: $0.0216/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-10
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/api-strale-io-62514ac3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_udwCekux8JTgZD4NiDb42

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 api-strale-io-62514ac3
```

Example prompt: How many tokens is this text for GPT-4o, and what would it cost: 'The quick brown fox jumps over the lazy dog. This is a sample prompt I want to send repeatedly to an LLM.'?

## When to prefer this

Use this endpoint when you need a fast, cheap, offline-style token count and cost estimate before actually calling an LLM API — ideal for budget checks, context window validation, or cost forecasting without incurring LLM API charges. Prefer over manual tokenizer libraries when you need cross-model comparison in a single call.

## Known failure modes

- Missing required 'text' query parameter returns an error
- Unknown or unsupported model name may return a default or error
- Very large text inputs may hit request size limits
- Network errors or service unavailability return 5xx responses

## How this service works

Estimate token count and cost for text across LLM models (GPT-4o, Claude, Gemini, Mistral, Llama). Algorithmic — no API calls.

## Output

Returns the token count and estimated cost for the provided text, attributed to the specified LLM model (e.g. gpt-4o, claude-3-haiku). Computed algorithmically without making any external LLM API calls.

## Example request

```json
{
 "input": {
  "type": "http",
  "method": "GET",
  "queryParams": {
   "text": "The quick brown fox jumps over the lazy dog. This is a sample prompt I want to send repeatedly to an LLM.",
   "model": "gpt-4o"
  }
 }
}
```

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "required": [
  "text"
 ],
 "properties": {
  "text": {
   "type": "string"
  },
  "model": {
   "type": "string",
   "description": "gpt-4o, claude-3-haiku, etc."
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "token_count": {
  "type": "integer"
 },
 "estimated_cost_usd": {
  "type": "number"
 },
 "fits_context_window": {
  "type": "boolean"
 },
 "max_context_for_model": {
  "type": "integer"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/api-strale-io-62514ac3/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)
