16trust / 100

Llm Token Count

by Vextorium in AI models & inference

x402 APIFailing, checked 57 min ago

Count the tokens of a text with OpenAI tokenizers (o200k for GPT-4o/4.1/5, cl100k for GPT-4/3.5) plus estimates for Claude, Llama and Gemini, with characters per token. Budget LLM calls and split contexts.

POST https://api.vextorium.com/v1/llm-token-count

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
0.0%
Response time
- typical, - slowest 5%
Last check
57 min ago: Amount "0.003" is not in atomic token units
Next check
in 6 min

How to call it

# bash or zsh: see the payment challenge (nothing is charged)
curl -g -i -X POST 'https://api.vextorium.com/v1/llm-token-count' \
  -H 'content-type: application/json' \
  --data-raw '{"text":"Artificial intelligence agents are transforming the digital economy. AI agents pay for data with micropayments. The x402 protocol lets agents pay per call without accounts. Many companies already offer pay-per-use APIs for agents. USDC micropayments make this business model viable."}'
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client().register(
  "eip155:8453",
  new ExactEvmScheme(privateKeyToAccount(process.env.AGENT_KEY)),
);
const pay = wrapFetchWithPayment(fetch, client);

// Not sure it's safe to pay? Preflight it first for $0.005:
// GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.vextorium.com%2Fv1%2Fllm-token-count
const res = await pay("https://api.vextorium.com/v1/llm-token-count", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: "{\"text\":\"Artificial intelligence agents are transforming the digital economy. AI agents pay for data with micropayments. The x402 protocol lets agents pay per call without accounts. Many companies already offer pay-per-use APIs for agents. USDC micropayments make this business model viable.\"}",
});
console.log(await res.json());

Example input

{
  "text": "Artificial intelligence agents are transforming the digital economy. AI agents pay for data with micropayments. The x402 protocol lets agents pay per call without accounts. Many companies already offer pay-per-use APIs for agents. USDC micropayments make this business model viable."
}

Example output

{
  "characters": 282,
  "characters_per_token": 5.32,
  "encoding": "o200k_base",
  "estimates": {
    "claude_approx": 58,
    "gemini_approx": 50,
    "llama3_approx": 54
  },
  "note": "Exact count for OpenAI encodings; the rest are estimates (each model tokenizes differently).",
  "tokens": 53,
  "tokens_other_encoding": {
    "cl100k_base": 56
  },
  "words": 40
}

Security scan

  • No findings. We scan names, descriptions and tool definitions for hidden instructions and other prompt-injection patterns.

Recent checks

WhenResultHTTPTimePrice
57 min agoAmount "0.003" is not in atomic token units402137 ms$0.003
5 h agoAmount "0.003" is not in atomic token units40281 ms$0.003
10 h agoAmount "0.003" is not in atomic token units402134 ms$0.003
14 h agoAmount "0.003" is not in atomic token units40286 ms$0.003
19 h agoAmount "0.003" is not in atomic token units402122 ms$0.003
23 h agoAmount "0.003" is not in atomic token units402379 ms$0.003
27 h agoAmount "0.003" is not in atomic token units40280 ms$0.003
31 h agoAmount "0.003" is not in atomic token units40286 ms$0.003
35 h agoAmount "0.003" is not in atomic token units40274 ms$0.003
39 h agoAmount "0.003" is not in atomic token units402296 ms$0.003
43 h agoAmount "0.003" is not in atomic token units402106 ms$0.003
47 h agoAmount "0.003" is not in atomic token units402155 ms$0.003
2 days agoAmount "0.003" is not in atomic token units402192 ms$0.003
2 days agoAmount "0.003" is not in atomic token units402126 ms$0.003
2 days agoAmount "0.003" is not in atomic token units402129 ms$0.003