Dataset Cost Estimator — LLM Embedding Budget
Pricing
from $0.03 / cost report
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
Maintained by CommunityActor stats
0
Bookmarked
2
Total users
1
Monthly active users
a month ago
Last modified
Categories
Security
Limited permissionsShare
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-smallvstext-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 | FAILin the summary; withfailIfOverBudgetUsdenabled the run itself fails withBUDGET_GATE_FAILafter 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
- 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.
- Budget gate for agents / CI: set
budgetUsd,budgetBasisandfailIfOverBudgetUsd: true. The run fails when the estimate exceeds your budget, so the next step of your pipeline does not start. - Compare chat vs embedding costs on the same corpus in one run.
- Quick test with inline rows: paste JSON objects in
itemswithout creating a dataset.
Quick start
- Open the Input tab. The Inline JSON items field is prefilled with a 3-row sample: click Start to see a full report.
- 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.
- Optionally set Budget (USD) and Budget comparison basis, and enable Fail Actor run if over budget for automation.
- 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.
| Field | Description | Default |
|---|---|---|
reportName | Label shown in the report | Dataset LLM cost estimate |
items | Inline JSON rows (max 5,000) | – |
datasetId | ID or name of an Apify dataset you own (read-only access requested) | – |
allowRemoteFetch | Must be true to read datasetId | true |
textFields | Fields concatenated as billable text | text, markdown, content, body, pageContent, description |
chatModels | Chat model IDs to price | gpt-4o-mini, gpt-4o, claude-haiku-4.5, gemini-2.0-flash |
embeddingModels | Embedding model IDs to price | text-embedding-3-small, text-embedding-3-large |
maxItems | Safety cap on analyzed rows (1–50,000) | 1000 |
assumedOutputTokensPerItem | Assumed completion tokens per non-empty row for chat estimates | 0 |
budgetUsd | Optional USD budget for the gate | – |
budgetBasis | cheapest_embedding, most_expensive_embedding, cheapest_chat_input, most_expensive_chat_input | cheapest_embedding |
failIfOverBudgetUsd | Fail the run (after writing reports) if over budget; requires budgetUsd | false |
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
- Reads rows from
itemsordatasetId(up tomaxItems) - Extracts text from the configured
textFields - Estimates tokens with a versioned characters-per-token heuristic (about 4 chars/token, 3.8 for Claude models)
- Applies the static USD price table (per 1M tokens)
- Writes the dataset rows,
OUTPUTandREPORT, then applies the optional budget gate
Pricing
This Actor uses pay per event pricing. Events as configured:
| Event | Price | When it is charged |
|---|---|---|
Actor start (apify-actor-start) | $0.00005 | Once when the run starts (one event per GB of memory; memory is capped at 1 GB) |
Rows analyzed (rows-analyzed) | $0.00005 per row | Once per analyzed row (itemsAnalyzed, i.e. rows admitted after maxItems), only after the report is written |
Cost report (cost-report) | $0.03 | Once per run, only after OUTPUT / REPORT are written |
Typical cost per run: $0.00005 + $0.00005 × itemsAnalyzed + $0.03
| Rows analyzed | Event 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
maxItemsand 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; inlineitems≤ 5,000; 500,000 characters per row; 20,000,000 characters per run. - Only one source per run (
itemsordatasetId);runIdis 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.