To estimate the cost of processing a collection of ~10,000 documents using paperless-ai (assuming integration with an LLM via OpenRouter), here's a step-by-step breakdown:
Key Variables to Determine Cost
- Average document size (in tokens).
- Model choice (from OpenRouter’s pricing).
- Processing type (e.g., OCR, summarization, metadata extraction).
Step 1: Estimate Tokens per Document
-
Text-based documents (e.g., PDFs, emails, reports):
- 1 token ≈ 4 characters (≈0.75 words per token).
- A typical 1-page document (~500 words) ≈ 375–500 tokens.
- A longer document (10 pages, ~5,000 words) ≈ 3,750–5,000 tokens.
-
Scanned/Image-based documents (if using OCR):
- OCR text extraction adds minimal tokens (same as text documents).
- If using vision models (e.g., for layout analysis), costs rise significantly (images = more tokens).
Step 2: Total Tokens for 10,000 Documents
Assume average 1,000 tokens per document (adjust based on your docs):
- Total input tokens = 10,000 docs × 1,000 tokens = 10 million tokens.
Step 3: Cost by Model (OpenRouter Pricing)
Use the cheapest models from your previous question:
| Model | Input Cost (per 1M tokens) | Total Cost (10M tokens) |
|---|
| GPT-4o Mini | $0.15 | $1.50 |
| Claude 3 Haiku | $0.25 | $2.50 |
| Gemini 1.5 Flash | $0.35 | $3.50 |
| Qwen 1.5 32B Chat | ~$0.48 | $4.80 |
Example for GPT-4o Mini:
10M tokens × $0.15/1M tokens = $1.50.
Step 4: Output Costs (If Applicable)
If the AI generates text (e.g., summaries, tags), add output costs:
- GPT-4o Mini Output: 0.60/1Mtokens.Ifoutputis100.60`.
Critical Notes
-
Document Size Variability:
If documents are longer (e.g., 5,000 tokens each), costs scale proportionally (e.g., $7.50 for GPT-4o Mini).
-
API Calls vs. Batch Processing:
- If processing one document at a time, OpenRouter charges per API call.
- Batch processing (all docs in one request) uses total tokens, which is cheaper.
-
Free Models:
Nous: Capybara 7B is often free on OpenRouter, but it’s less reliable for complex tasks.
How to Check Exact Costs
- Go to OpenRouter’s Models Page.
- Filter by models with large context windows (e.g., 128K+).
- Use the "Cost (USD)/1M input tokens" column to calculate.
Recommendation
For 10,000 average-sized documents, GPT-4o Mini at 1.50–2.10 (input + output) is the cheapest capable option. For massive documents, Gemini 1.5 Flash ($3.50) is better for 1M+ token contexts.