78trust / 100

Token Count

by api.strale.io in AI models & inference

x402 APIPassing, checked 1 h ago

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

GET https://api.strale.io/x402/token-count

Last 30 days

All checks passedSome failedAll failedNot checked
Uptime
100%
Response time
130 ms typical, 363 ms slowest 5%
Last check
1 h ago
Next check
any minute now

How to call it

# See the payment challenge (nothing is charged)
curl -i -X GET "https://api.strale.io/x402/token-count"
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.strale.io%2Fx402%2Ftoken-count
const res = await pay("https://api.strale.io/x402/token-count");
console.log(await res.json());

Example input

{
  "model": {
    "description": "gpt-4o, claude-3-haiku, etc.",
    "type": "string"
  },
  "text": {
    "required": true,
    "type": "string"
  }
}

Security scan

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

Recent checks

WhenResultHTTPTimePrice
1 h agoPassed402278 ms$0.022
5 h agoPassed402127 ms$0.022
8 h agoPassed402130 ms$0.022
12 h agoPassed402121 ms$0.022
15 h agoPassed402281 ms$0.022
19 h agoPassed402282 ms$0.022
22 h agoPassed402268 ms$0.022
26 h agoPassed402289 ms$0.022
30 h agoPassed402363 ms$0.022
33 h agoPassed402121 ms$0.022
37 h agoPassed402127 ms$0.022
41 h agoPassed402124 ms$0.022
44 h agoPassed402628 ms$0.022
2 days agoPassed402128 ms$0.022