Skip to content

Choosing an LLM

Pick a model for free-form documents. Start with the recommendation below and step up only if values come back null.

Our default advice

Start free: a local model through Ollama when the documents are private, or the Gemini API free tier when they are not. Move to a paid model only when an evaluation on your documents shows the free one missing values.

How the model is set

qaechi-parser talks to any server that speaks the OpenAI Chat Completions API with tool (function) calling. Three environment variables choose the server and the model:

Variable What it does Default
OPENAI_API_KEY Turns model-based extraction on. Use the provider's key; a local server accepts any non-empty value. (unset: stub mode)
OPENAI_BASE_URL Sends requests to another OpenAI-compatible server instead of OpenAI. https://api.openai.com/v1
QAECHI_LLM_MODEL Model ID on that server. gpt-4o-mini

Related settings: QAECHI_LLM_TIMEOUT_SECONDS (120), QAECHI_LLM_MAX_RETRIES (2) and QAECHI_LLM_MAX_INPUT_CHARS (200,000; longer input fails instead of being cut). To stay under your provider's requests and tokens per minute, see Caching and rate limits.

What qaechi-parser asks of the model:

  • Tool calling. Extraction and grading use structured output through function calling, so the model must support tools.
  • temperature=0. Extraction should be repeatable. If a provider rejects the parameter, open an issue with the model ID.
  • A long enough context. Without retrieval, the whole document goes in one request.

Retrieval and embeddings

QAECHI_RETRIEVE (off by default) also needs an embeddings endpoint, and it uses the same OPENAI_BASE_URL. It is tested with OpenAI embeddings only. With any other server, keep retrieval off; qaechi-parser then sends every chunk, which is fine for most documents.

Recipes

Nothing leaves your machine. Needs a GPU or Apple Silicon with enough memory for the model.

ollama pull qwen3.8:27b           # 18 GB download, tools + vision, 256K context
export OPENAI_BASE_URL=http://localhost:11434/v1
export OPENAI_API_KEY=ollama      # any non-empty value
export QAECHI_LLM_MODEL=qwen3.8:27b
qaechi-parser parse contract.pdf --doc-type contract

Any Ollama model tagged tools works the same way; see the tool-capable models. vLLM and LM Studio expose the same /v1 API.

No card needed. Create a key in Google AI Studio.

export OPENAI_BASE_URL=https://generativelanguage.googleapis.com/v1beta/openai/
export OPENAI_API_KEY=$GEMINI_API_KEY
export QAECHI_LLM_MODEL=gemini-3.5-flash-lite   # or gemini-3.8-flash

Free tier data is used to improve Google's products

Google's pricing page marks free-tier content as used to improve our products; paid-tier content is not. Do not send contracts, personal data or anything under NDA through the free tier. Turn on billing, or run locally, for those.

export OPENAI_API_KEY=sk-...
export QAECHI_LLM_MODEL=gpt-6-luna     # cheapest current model

Leave OPENAI_BASE_URL unset.

The options compared

Prices are standard-tier USD per 1M tokens, input / output, from the providers' pricing pages in November 2026. They change often; check OpenAI and Gemini before you budget.

Option Example models Cost Strengths Trade-offs
Local, open weights qwen3.8:27b, nemotron-3.5-lightning (Ollama) Free (your hardware) Documents never leave the machine; no rate limits; no per-token bill Needs ~20 GB+ of GPU/unified memory for good models; slower on CPU; quality below frontier models on messy layouts
Gemini free tier gemini-3.5-flash-lite, gemini-3.8-flash Free, rate-limited Strong quality for free; long context; zero setup beyond a key Content used to improve Google's products; per-project rate limits; models and quotas change without notice
Low-cost paid gpt-6-luna ($0.10 / $0.50), gemini-3.5-flash-lite paid ($0.30 / $2.50), gpt-4o-mini ($0.15 / $0.60, current default) Cents per hundred pages Cheap at volume; no training on your data; higher rate limits Can miss values in dense tables or long contracts
Balanced paid gpt-6.1-terra ($1 / $5), gemini-3.8-flash paid ($0.75 / $3.75 until Dec 31, 2026) Low Good accuracy on tables and multi-page documents Costs add up on large batches
High accuracy paid gpt-6.2-sol ($2 / $10), gpt-6.2-astra ($8 / $40) Highest Best on ambiguous wording, cross-page references and messy scans turned to text 10 to 80 times the cost of the low-cost tier; slower

Claude

Claude models are not supported yet. Anthropic's OpenAI-compatible endpoint is meant for testing and does not enforce tool schemas, so qaechi-parser does not rely on it. "More model providers" is on the roadmap.

Whatever you pick, qaechi-parser's checks still apply: every quote is matched verbatim against the source, and an unproven value comes back as null. A weaker model shows up as more nulls and more quoteCheck.notInSource entries, not as silently wrong numbers.

Which one for you

By what your documents contain

If your documents are Start with Why
Confidential (contracts, HR, medical, anything under NDA) Local (Ollama) Nothing leaves your network. Move to a paid tier only under a data agreement you accept.
Public or non-sensitive (published reports, marketing decks) Gemini free tier Best quality for zero cost.
Fixed-layout and repeated (one bank's statements, one ERP export) A parser plugin Same answer every time. Write a plugin.
Scanned images OCR first, then any model qaechi-parser reads text layers; pages with no text are listed in notes.

By domain

Domain Typical documents Recommendation
Finance and accounting Ledgers, invoices, statements Parser plugins for recurring layouts. Models: local or gemini-3.8-flash; step up to gpt-6.1-terra if totals or line items come back null.
Legal Contracts, amendments, NDAs Local first. If accuracy is short, a paid tier with no training on your data (gpt-6.1-terra or gpt-6.2-sol). Never a free tier.
Healthcare, HR, public sector Records with personal data Local only, unless your compliance team approves a provider.
Sales and marketing Decks, proposals, brochures Gemini free tier; gpt-6-luna when you need volume without rate limits.
Operations and logistics Spreadsheets, delivery notes, forms Parser plugins for stable forms; low-cost tier for the rest.
Research and RAG Long papers, manuals Long-context model (Gemini or qwen3.8:27b, 256K). Keep QAECHI_RETRIEVE off unless you use OpenAI embeddings.

By goal

Goal Pick
Try qaechi-parser today, for free Gemini free tier with non-sensitive files, or no key at all (stub mode)
Keep every document private Local model through Ollama
Lowest cost at high volume gpt-6-luna, or a local model if you own the hardware
Highest accuracy on hard documents gpt-6.2-sol; gpt-6.2-astra for the hardest cases
Reproducible results across months Pin an exact model ID in QAECHI_LLM_MODEL and re-test before you change it

Measure before you switch

Model rankings depend on your documents. Before you pay for a bigger model:

  1. Take 20 to 50 real documents and write down the values you expect.
  2. Run them through two candidates (for example a local model and gemini-3.8-flash).
  3. Compare per field: how many values match, how many come back null, and how many quotes land in quoteCheck.notInSource.
  4. Pick the cheapest model that meets your bar, and pin it.

한국어