LL
AI Inference · x402 · early usage

Exact token count for text using OpenAI tokenizers

Exact token count for text using OpenAI tokenizers. Body: {text, encoding?} where encoding is cl100k_base or o200k_base (default). Returns tokens and char_count. Use to budget prompts and context windows.

by x402.shizu.me · discovered, not yet claimed by its owner · updated 2026-10-09

30d calls2
30d payers2
MethodPOST
Outputjson

Mirrored from Coinbase's public x402 Bazaar. The description is the provider's own text and has not been reviewed here; the payment requirements are copied as published.

What it does

Exact token count for text using OpenAI tokenizers. Body: {text, encoding?} where encoding is cl100k_base or o200k_base (default). Returns tokens and char_count. Use to budget prompts and context windows.

Tags: tokens · tokenizer · tiktoken · llm · gpt · bazaar

Call contract

Method
POST
Input
json
Output
json
Last paid call
2026-10-09
Input example from Bazaar metadata
{
  "encoding": "o200k_base",
  "text": "hello world"
}
Output example
{
  "char_count": 11,
  "encoding": "o200k_base",
  "tokens": 2
}

Use with an agent

  1. Discover. Agents find this listing with GET https://bazaar.saylorinnovations.com/discovery/search?query=…, the MCP tool search_resources, or /discovery/resources.
  2. Inspect. Fetch /resources/41631.json for the price and payment options.
  3. Pay. Call GET https://x402.shizu.me/count. The provider answers 402 with its payment requirements. An x402 client signs one of the options below and retries with PAYMENT-SIGNATURE.
  4. Execute. The provider returns 200 with the data. Agent Bazaar is not in the request path and never sees your payment.

For humans

You don't need an account or an API key; you need a wallet holding a small amount of USDC on Base, and an x402-capable client (see the examples below). Call the endpoint unpaid first to see exactly what it asks for.

Pricing & payment

Price
$0.002 / request
Protocol
x402 v2
Auth
No account or API key. Pay per request.
Networks
Base
Demand
2 calls · 2 unique payers in 30d (public x402 Bazaar data)

x402 payment requirements

SchemeNetworkAssetAmountPay toTimeout
exactBase
eip155:8453
USDC$0.0020x217e5Fe265EB78b29067bF8324ef03a7D8e167C4300s
accepts[] (raw JSON)
[
  {
    "scheme": "exact",
    "network": "eip155:8453",
    "payTo": "0x217e5Fe265EB78b29067bF8324ef03a7D8e167C4",
    "asset": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
    "amount": "2000",
    "amountUsd": 0.002,
    "maxTimeoutSeconds": 300
  }
]

Schemas

Output schema (JSON Schema)
{
  "example": {
    "char_count": 11,
    "encoding": "o200k_base",
    "tokens": 2
  },
  "type": "json"
}
Example shape — generated from the schema, not a captured live response
{
  "char_count": 11,
  "encoding": "o200k_base",
  "tokens": 2
}

Examples

curl
curl -X POST 'https://x402.shizu.me/count' -H 'Content-Type: application/json' --data '{"encoding":"o200k_base","text":"hello world"}'
# -> 402 Payment Required; read PAYMENT-REQUIRED
# retry the identical request with PAYMENT-SIGNATURE
JavaScript
const res = await fetch("https://x402.shizu.me/count", {
  "method": "POST",
  "headers": {
    "content-type": "application/json"
  },
  "body": "{\"encoding\":\"o200k_base\",\"text\":\"hello world\"}"
});
if (res.status === 402) {
  const { accepts } = await res.json();
  // pay one of accepts[] via an x402 client, then retry with the payment header
}
Python
import httpx
import json
res = httpx.request("POST", "https://x402.shizu.me/count", json=json.loads("{\"encoding\":\"o200k_base\",\"text\":\"hello world\"}"))
if res.status_code == 402:
    accepts = res.json()["accepts"]
    # pay one of accepts[] via an x402 client, then retry with the payment header

Details

Provider
x402.shizu.me
Endpoint
https://x402.shizu.me/count
Machine-readable
/resources/41631.json