{"uid":"cap_udwCekux8JTgZD4NiDb42","slug":"api-strale-io-62514ac3","name":"LLM Token Count & Cost Estimator","description":"Estimate token count and cost for text across LLM models (GPT-4o, Claude, Gemini, Mistral, Llama). Algorithmic — no API calls.","url":"https://api.strale.io/x402/token-count?utm_source=zero.xyz","method":"GET","headers":{},"bodySchema":{"type":"object","required":["text"],"properties":{"text":{"type":"string"},"model":{"type":"string","description":"gpt-4o, claude-3-haiku, etc."}}},"responseSchema":{"token_count":{"type":"integer"},"estimated_cost_usd":{"type":"number"},"fits_context_window":{"type":"boolean"},"max_context_for_model":{"type":"integer"}},"example":{"request":{"input":{"type":"http","method":"GET","queryParams":{"text":"The quick brown fox jumps over the lazy dog. This is a sample prompt I want to send repeatedly to an LLM.","model":"gpt-4o"}}},"response":{"_meta":{"payment":{"method":"x402","price_usd":0.0216,"settlement_id":"0xcc037fbff5d6d6eae0d9c0dbf3d7dffab2f1be4ed1e4e6d02e3b2910d0f06796"},"capability":"token-count","latency_ms":0,"provenance":{"source":"algorithmic","fetched_at":"2026-06-03T22:52:08.836Z"}},"model":"gpt-4o","text_length":105,"token_count":27,"model_recognized":true,"cost_per_1k_tokens":0.0025,"estimated_cost_usd":0.000068,"fits_context_window":true,"chars_per_token_used":4,"max_context_for_model":128000}},"exampleRequest":{"text":"The quick brown fox jumps over the lazy dog. This is a sample prompt I want to send repeatedly to an LLM.","model":"gpt-4o"},"tags":["x402"],"displayCostAmount":"0.0216","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"settled","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.0216/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.0216","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_fA-GBdMbD6VM0bixKKcBN","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.0216","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Estimates token count and cost for a given text across popular LLM models (GPT-4o, Claude, Gemini, Mistral, Llama) using local algorithms — no external API calls.","exampleAgentPrompt":"How many tokens is this text for GPT-4o, and what would it cost: 'The quick brown fox jumps over the lazy dog. This is a sample prompt I want to send repeatedly to an LLM.'?","exampleUseCases":null,"resultDescription":"Returns the token count and estimated cost for the provided text, attributed to the specified LLM model (e.g. gpt-4o, claude-3-haiku). Computed algorithmically without making any external LLM API calls.","failureModes":["Missing required 'text' query parameter returns an error","Unknown or unsupported model name may return a default or error","Very large text inputs may hit request size limits","Network errors or service unavailability return 5xx responses"],"whenToPreferThis":"Use this endpoint when you need a fast, cheap, offline-style token count and cost estimate before actually calling an LLM API — ideal for budget checks, context window validation, or cost forecasting without incurring LLM API charges. Prefer over manual tokenizer libraries when you need cross-model comparison in a single call.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-10-10T00:56:35.114Z","isFirstParty":false,"canonicalSlug":"api-strale-io-62514ac3"}