Dataset Cost Estimator — LLM Embedding Budget avatar

Dataset Cost Estimator — LLM Embedding Budget

Pricing

from $0.03 / cost report

Go to Apify Store
Dataset Cost Estimator — LLM Embedding Budget

Dataset Cost Estimator — LLM Embedding Budget

Estimate USD token costs for an Apify dataset before RAG upsert. Compare chat & embedding models; optional fail-if-over-budget. No LLM API keys.

Pricing

from $0.03 / cost report

Rating

0.0

(0)

Developer

FG EI

FG EI

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

a month ago

Last modified

Security

Limited permissions

Share

Dataset LLM Cost Estimator — Tokens & Embedding Budget

Estimate how much it will cost to embed or run chat models over an Apify dataset before you spend money with an LLM provider. Point the Actor at a dataset (for example the output of Website Content Crawler) or at inline JSON rows. You get a deterministic token and USD report for several chat and embedding models, plus an optional fail-if-over-budget gate for agents and CI pipelines.

  • No LLM API key needed: the Actor never calls OpenAI, Anthropic, Google or any other provider.
  • Deterministic: the same input always gives the same numbers.
  • Output: dataset rows, a full JSON report (OUTPUT) and a Markdown report (REPORT).

Token counts are a character-based heuristic, not an exact tokenizer. Use them for budgeting and model comparison, not as an invoice. See Limitations.

What you get

  • Token and USD estimates for embedding models (e.g. text-embedding-3-small vs text-embedding-3-large) and chat models (e.g. gpt-4o-mini, gpt-4o, claude-haiku-4.5, gemini-2.0-flash)
  • Token statistics per row (p50 / p90 / p99 / max) to size chunks and context windows
  • A budget gate: gateStatus: PASS | FAIL in the summary; with failIfOverBudgetUsd enabled the run itself fails with BUDGET_GATE_FAIL after the reports are written
  • The price table version used (priceTableVersion) in every report

This Actor is not a scraper, not an LLM processor and not an exact BPE tokenizer.

Use cases

  1. After a crawl, before a RAG upsert: run Website Content Crawler or RAG Web Browser, pass the resulting dataset ID, compare embedding costs before writing to your vector database.
  2. Budget gate for agents / CI: set budgetUsd, budgetBasis and failIfOverBudgetUsd: true. The run fails when the estimate exceeds your budget, so the next step of your pipeline does not start.
  3. Compare chat vs embedding costs on the same corpus in one run.
  4. Quick test with inline rows: paste JSON objects in items without creating a dataset.

Quick start

  1. Open the Input tab. The Inline JSON items field is prefilled with a 3-row sample: click Start to see a full report.
  2. To analyze your own crawl: clear Inline JSON items, paste your dataset ID in Apify Dataset ID (keep Allow remote dataset fetch enabled) and start.
  3. Optionally set Budget (USD) and Budget comparison basis, and enable Fail Actor run if over budget for automation.
  4. Read the Output tab: cost estimate rows, Markdown report and full JSON report.

Example input (API):

{
"reportName": "RAG crawl sample budget",
"items": [
{"url": "https://example.com/a", "text": "Deterministic token budgeting helps agent pipelines avoid surprise embedding bills before vector upsert."},
{"url": "https://example.com/b", "markdown": "Second document with enough characters to exercise percentile stats and multi-model cost rows."},
{"url": "https://example.com/empty"}
],
"textFields": ["text", "markdown"],
"chatModels": ["gpt-4o-mini", "gpt-4o"],
"embeddingModels": ["text-embedding-3-small", "text-embedding-3-large"],
"assumedOutputTokensPerItem": 50,
"budgetUsd": 1.0,
"budgetBasis": "cheapest_embedding",
"failIfOverBudgetUsd": false
}

Analyze an existing dataset instead:

{
"datasetId": "<your-dataset-id>",
"allowRemoteFetch": true,
"maxItems": 1000,
"budgetUsd": 5,
"budgetBasis": "most_expensive_embedding",
"failIfOverBudgetUsd": true
}

Input

Provide exactly one source: items or datasetId.

FieldDescriptionDefault
reportNameLabel shown in the reportDataset LLM cost estimate
itemsInline JSON rows (max 5,000)–
datasetIdID or name of an Apify dataset you own (read-only access requested)–
allowRemoteFetchMust be true to read datasetIdtrue
textFieldsFields concatenated as billable texttext, markdown, content, body, pageContent, description
chatModelsChat model IDs to pricegpt-4o-mini, gpt-4o, claude-haiku-4.5, gemini-2.0-flash
embeddingModelsEmbedding model IDs to pricetext-embedding-3-small, text-embedding-3-large
maxItemsSafety cap on analyzed rows (1–50,000)1000
assumedOutputTokensPerItemAssumed completion tokens per non-empty row for chat estimates0
budgetUsdOptional USD budget for the gate–
budgetBasischeapest_embedding, most_expensive_embedding, cheapest_chat_input, most_expensive_chat_inputcheapest_embedding
failIfOverBudgetUsdFail the run (after writing reports) if over budget; requires budgetUsdfalse

Supported models (price table 2026-09-11)

  • Chat: gpt-4o-mini, gpt-4o, gpt-4.1-mini, claude-haiku-4.5, claude-sonnet-4.6, gemini-2.0-flash, llama-3.3-70b
  • Embedding: text-embedding-3-small, text-embedding-3-large, voyage-3-lite, voyage-3

Unknown model IDs are rejected with an explicit INPUT_ERROR.

Analyzing the output of another run: open that run in Apify Console, copy its default dataset ID and pass it in datasetId. This Actor uses Apify limited permissions and requests read access to that dataset only. A runId input is not supported in this version: an input containing a non-empty runId is rejected with INPUT_ERROR (only the Actor start event is charged).

Output

Dataset (Output tab, views Overview and Model estimates):

  • 1 row type: cost_estimate_summary: gateStatus, itemsAnalyzed, itemsWithText, totalChars, totalTokensRefCl100kApprox, tokenPercentilesRef, budgetUsd, budgetBasis, budgetBasisModel, budgetBasisCostUsd, overBudget, priceTableVersion, disclaimer…
  • 1 row per embedding model type: embedding_model_estimate: model, inputTokens, inputCostUsd, totalCostUsd, usdPer1MInput
  • 1 row per chat model type: chat_model_estimate: model, inputTokens, assumedOutputTokens, inputCostUsd, outputCostUsd, totalCostUsd, usdPer1MInput, usdPer1MOutput

Key-value store: OUTPUT (full JSON report, including a ppe ledger of the events charged by the run) and REPORT (Markdown).

Sample summary (from the example input above):

{
"type": "cost_estimate_summary",
"reportName": "RAG crawl sample budget",
"gateStatus": "PASS",
"itemsAnalyzed": 3,
"itemsWithText": 2,
"totalTokensRefCl100kApprox": 50,
"budgetUsd": 1.0,
"budgetBasis": "cheapest_embedding",
"budgetBasisModel": "text-embedding-3-small",
"budgetBasisCostUsd": 1e-06,
"overBudget": false
}

Sample Markdown report:

# RAG crawl sample budget
- Gate: **PASS**
- Items analyzed: 3 / available 3
- Items with text: 2 · empty: 1
## Embedding estimates (cheapest first)
| Model | Tokens | USD |
|---|---:|---:|
| text-embedding-3-small | 50 | 0.000001 |
| text-embedding-3-large | 50 | 0.000006 |
## Chat estimates (cheapest total first)
| Model | Input tokens | Assumed output tokens | Input USD | Output USD | Total USD |
|---|---:|---:|---:|---:|---:|
| gpt-4o-mini | 50 | 100 | 0.000008 | 0.000060 | 0.000068 |
| gpt-4o | 50 | 100 | 0.000125 | 0.001000 | 0.001125 |

Errors are explicit in the run log: INPUT_ERROR (invalid input), PROCESS_ERROR (rows cannot be processed, e.g. a text cap is exceeded), UNHANDLED_ERROR (unexpected failure, e.g. the dataset cannot be read), BUDGET_GATE_FAIL (over budget with failIfOverBudgetUsd).

How it works

  1. Reads rows from items or datasetId (up to maxItems)
  2. Extracts text from the configured textFields
  3. Estimates tokens with a versioned characters-per-token heuristic (about 4 chars/token, 3.8 for Claude models)
  4. Applies the static USD price table (per 1M tokens)
  5. Writes the dataset rows, OUTPUT and REPORT, then applies the optional budget gate

Pricing

This Actor uses pay per event pricing. Events as configured:

EventPriceWhen it is charged
Actor start (apify-actor-start)$0.00005Once when the run starts (one event per GB of memory; memory is capped at 1 GB)
Rows analyzed (rows-analyzed)$0.00005 per rowOnce per analyzed row (itemsAnalyzed, i.e. rows admitted after maxItems), only after the report is written
Cost report (cost-report)$0.03Once per run, only after OUTPUT / REPORT are written

Typical cost per run: $0.00005 + $0.00005 × itemsAnalyzed + $0.03

Rows analyzedEvent cost
3 (example input)≈ $0.0302
100≈ $0.035
1,000≈ $0.08
10,000≈ $0.53
50,000 (maximum maxItems)≈ $2.53
  • Invalid input or a failure before the report is written: only the Actor start event is charged.
  • Budget gate FAIL: the reports are written, so rows analyzed and the cost report are charged.
  • You control the maximum with maxItems and with Apify's maximum cost per run setting.
  • No LLM provider cost: the Actor does not call any LLM API. The pricing panel on this page is the authoritative source for current prices.

Limitations

  • Token counts are a heuristic (characters per token), not tiktoken / exact BPE. Calibrate against your provider's tokenizer for invoices.
  • Model prices come from a static table dated 2026-09-11; provider prices may change. The table version is written in every report.
  • No chunking, embedding, scraping or LLM calls are performed.
  • Caps: maxItems ≤ 50,000; inline items ≤ 5,000; 500,000 characters per row; 20,000,000 characters per run.
  • Only one source per run (items or datasetId); runId is not supported.

Typical pipeline

Website Content Crawler / RAG Web Browser → Dataset LLM Cost Estimator → (if PASS) your embedding / LLM pipeline

Permissions and data

  • Runs with Apify limited permissions: it reads its own input, the dataset you pass, and writes to its own default storages.
  • Text is processed inside the Actor container and is never sent to an LLM provider.
  • Results are kept in your run storages according to your Apify retention settings. You remain responsible for the lawfulness of the content you analyze (e.g. GDPR).

FAQ

Why not a local script? Your crawl already lives in an Apify dataset, and agents, webhooks and schedules can call an Actor directly. The budget gate is the run status itself, so an orchestrator can stop the pipeline without custom code.

How accurate are the token counts? Good enough for budget gates and relative comparisons between models; not an exact invoice. Every report includes a disclaimer.

Do I need an OpenAI / Anthropic key? No.

Support: open an issue on the Actor's Issues tab. Never paste secrets or API keys in issues.