16trust / 100

Contar Tokens Pago

by Vextorium in AI models & inference

x402 APIFailing, checked 2 h 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/contar-tokens-pago

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
0.0%
Response time
- typical, - slowest 5%
Last check
2 h ago: Amount "0.003" is not in atomic token units
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X POST "https://api.vextorium.com/contar-tokens-pago" \
  -H "content-type: application/json" \
  -d '{"texto":"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%2Fcontar-tokens-pago
const res = await pay("https://api.vextorium.com/contar-tokens-pago", {
  method: "POST",
  headers: { "content-type": "application/json" },
  body: JSON.stringify({"texto":"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

{
  "texto": "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

{
  "caracteres": 282,
  "caracteres_por_token": 5.32,
  "codificacion": "o200k_base",
  "estimaciones": {
    "claude_aprox": 58,
    "gemini_aprox": 50,
    "llama3_aprox": 54
  },
  "nota": "Recuento exacto para las codificaciones de OpenAI; el resto son estimaciones (cada modelo tokeniza distinto).",
  "palabras": 40,
  "tokens": 53,
  "tokens_otra_codificacion": {
    "cl100k_base": 56
  }
}

Security scan

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

Recent checks

WhenResultHTTPTimePrice
2 h agoAmount "0.003" is not in atomic token units40277 ms$0.003
6 h agoAmount "0.003" is not in atomic token units40280 ms$0.003
11 h agoAmount "0.003" is not in atomic token units40291 ms$0.003
15 h agoAmount "0.003" is not in atomic token units402108 ms$0.003
19 h agoAmount "0.003" is not in atomic token units40289 ms$0.003
23 h agoAmount "0.003" is not in atomic token units40288 ms$0.003
27 h agoAmount "0.003" is not in atomic token units40274 ms$0.003
31 h agoAmount "0.003" is not in atomic token units40282 ms$0.003
35 h agoAmount "0.003" is not in atomic token units402226 ms$0.003
39 h agoAmount "0.003" is not in atomic token units402203 ms$0.003
43 h agoAmount "0.003" is not in atomic token units40285 ms$0.003
47 h agoAmount "0.003" is not in atomic token units402178 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40280 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40278 ms$0.003
2 days agoAmount "0.003" is not in atomic token units40284 ms$0.003