Skip to content
Eden Engine

Text Token Count & Cost Estimate (by LLM Model)

omnial/x402-token-count

Given a block of text and an optional model name (e.g. gpt-4o, claude-3-haiku, gemini, mistral, llama), returns an estimated token count for that text, an estimated dollar cost at that model's per-1,000-token rate, whether the text fits inside the model's context window, and the model's maximum context size -- computed with an algorithmic estimator, not a live call to any model provider.

activeper callv2

Price

Up to $0.0325 per call; you pay what the call used

You pay the price shown. If a call turns out to cost more than its quote, you pay the actual price, capped at twice the quote. No monthly minimum. Top-ups start at $5.00.

Data source

Eden Engine

Computed by Eden Engine from the inputs you provide.

Use it

Your AI assistant does the work: it finds this tool, shows you the price first, runs it, and you are charged when the run finishes. There is nothing to set up for this tool in particular.

Connect once and your AI can find and run this tool, and any other it needs.

For developers: the calls your assistant makes
agent
// 1. search: find the tool
omnial_search({ query: "what you need" })

// 2. inspect: price and input schema
omnial_inspect({ tool: "omnial/x402-token-count" })

// 3. learn: read the usage guide at runtime
omnial_learn({ tool: "omnial/x402-token-count" })

// 4. run: price the exact call first, then run it
omnial_execute({ tool: "omnial/x402-token-count", input: { /* see input_schema */ }, dry_run: true })
omnial_execute({ tool: "omnial/x402-token-count", input: { /* ... */ } })

// 5. settle: the call is charged when it finishes, nothing to do

Not connected yet? Point your MCP client at https://mcp.eden-engine.com/mcp, then copy a config for your client.

Pricing

Every charge this tool can incur.

ChargePrice
Per call
$0.0325
Updated
Oct 27, 2026

Input and output schemas

Input schema
input_schema.json
{
  "type": "object",
  "required": [
    "text"
  ],
  "properties": {
    "text": {
      "type": "string",
      "description": "The text to estimate a token count and cost for."
    },
    "model": {
      "type": "string",
      "description": "Model to estimate against, e.g. 'gpt-4o', 'claude-3-haiku' (optional). An unrecognized model name is not an error -- see outputSchema's `model_recognized`."
    }
  },
  "additionalProperties": false
}
Output schema
output_schema.json
{
  "type": "object",
  "properties": {
    "model": {
      "type": "string",
      "description": "The model name the estimate was computed for, echoed back as submitted."
    },
    "text_length": {
      "type": "number",
      "description": "Length, in characters, of the submitted text."
    },
    "token_count": {
      "type": "number",
      "description": "Estimated token count for the submitted text, for the given model."
    },
    "model_recognized": {
      "type": "boolean",
      "description": "Whether the submitted `model` matched one of the estimator's known model profiles. Observed `false` on an unrecognized model name -- that call still returns a normal estimate (using a fallback chars-per-token profile), not an error."
    },
    "cost_per_1k_tokens": {
      "type": "number",
      "description": "The per-1,000-token input rate used to derive `estimated_cost_usd` for this model."
    },
    "estimated_cost_usd": {
      "type": "number",
      "description": "Estimated dollar cost of sending this text as input to the given model, derived from `cost_per_1k_tokens`."
    },
    "fits_context_window": {
      "type": "boolean",
      "description": "Whether `token_count` fits within `max_context_for_model`."
    },
    "chars_per_token_used": {
      "type": "number",
      "description": "The characters-per-token ratio used to derive `token_count` for this model. Observed 4 for a recognized model (gpt-4o) and 3.8 for an unrecognized one -- varies by model and by recognition, not a fixed constant."
    },
    "max_context_for_model": {
      "type": "number",
      "description": "The model's maximum context window size, in tokens."
    }
  },
  "description": "The token-count estimate.",
  "additionalProperties": true
}