x402

Token Count (x402)

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

get/x402/v2/token-count

Request

  • Base URL: https://api.strale.io
  • URL: https://api.strale.io/x402/v2/token-count
  • Auth: none required

Query parameters

textstring required
modelstring

gpt-4o, claude-3-haiku, etc.

Response

Success

token_countinteger
estimated_cost_usdnumber
fits_context_windowboolean
max_context_for_modelinteger

Example response

{
  "model": "gpt-4o",
  "text_length": 24,
  "token_count": 6,
  "model_recognized": true,
  "cost_per_1k_tokens": 0.0025,
  "estimated_cost_usd": 0.000015,
  "fits_context_window": true,
  "chars_per_token_used": 4,
  "max_context_for_model": 128000
}

Changes

No recorded changes to this operation across all 1 revision of this API.