๐Ÿ†“ Free API ยท No Key Required ยท โšก 100 req/hour per IP ยท ๐Ÿ”’ No data stored

Base URL

https://tokenia.live/api/v1

POST  /api/v1/count

Count tokens and estimate costs for a given text across all providers (or a specific one).

Request body

{
  "text": "Your prompt text here",       // required
  "provider": "openai",              // optional: openai|anthropic|google|meta|mistral|deepseek
  "model": "gpt-4o"                   // optional: filter to specific model
}

Response

{
  "tokens": 1250,
  "chars": 5000,
  "words": 820,
  "results": [
    {
      "provider": "openai",
      "model": "gpt-4o",
      "modelId": "gpt-4o",
      "tokens": 1250,
      "inputCostPer1M": 2.50,
      "outputCostPer1M": 10.00,
      "inputCost": 0.000003125,
      "outputCost": 0.00001250,
      "totalCost": 0.00001563,
      "precision": "estimated"
    }
  ],
  "rateLimit": { "remaining": 99, "resetIn": "3600s" }
}

Code Examples

# Basic token count
curl -X POST https://tokenia.live/api/v1/count \
  -H "Content-Type: application/json" \
  -d '{"text": "Hello, world! This is a test prompt."}'

# Filter by provider
curl -X POST https://tokenia.live/api/v1/count \
  -H "Content-Type: application/json" \
  -d '{"text": "Your prompt here", "provider": "anthropic"}'

Rate Limits

TierRequests/hourAuth
Free (public)100None

Rate-limited by IP. Headers: X-RateLimit-Remaining and X-RateLimit-Reset.

Need higher limits? Contact us โ€” we'll work something out.