Batch Mode
Run hundreds of questions against the same context. Cache is always enabled — the first question pays full cost, subsequent questions benefit from provider-level caching at up to 90% savings.End-to-end example
Audit a TypeScript source tree for security smells in three commands:End-to-end
stdout
Quick start
Create a questions file (one question per line):questions.txt
Questions file format
- One question per line
- Empty lines are skipped
- Lines starting with
#are treated as comments
Cache behavior
Batch mode always enables caching. Here’s the cost flow:
The exact savings depend on your provider:
Pre-warming the cache
Warm the cache before running batch queries to ensure the first question also gets cache pricing:Estimating costs
Check how much a batch run will cost before committing:Budget enforcement
Set a maximum spend to prevent runaway costs:Batch options
Gemini Batch API
For Google Gemini models, the--batch-api flag enables the Gemini Batch API, which provides an additional 50% cost reduction on top of caching:
Cost stacking
100 queries over 500K tokens of context: under $2.00 with both cache and batch stacking.
Batch API jobs are asynchronous. Results may take longer to return compared to standard API calls, but the cost savings are significant for large runs.
Practical patterns
Study session over documentation
Code audit
Codebase onboarding
CAG vs RLM for batch
By default, batch mode uses CAG (cache enabled). For very large contexts that exceed provider limits, RLMX falls back to standard RLM iteration automatically.
Provider context limits
If your context exceeds the provider limit, RLMX will warn you and fall back to RLM mode where the LLM navigates the context programmatically.