Qaynaq LABS · TOOLS

LLM COST · GOOGLE · MULTI-STEP AGENT LOOP

Gemini 1.5 Pro: $22.50/mo

At 10.00M input tokens ($12.50) and 2.00M output tokens ($10.00) per month, on multi-step agent loop workload.

Pricing: $1.25/M input · $5/M output · 2,000,000 token context

How this workload behaves

Multi-step agent loops are output-heavy workloads where the LLM generates intermediate reasoning steps, tool calls, and final responses in rapid succession. Each iteration compounds costs because output tokens from one step become input tokens for the next, creating a multiplicative effect on total spend. The primary driver here is the high output token volume ($5/M) combined with the loop’s tendency to generate verbose intermediate outputs. Context window utilization is also critical, as agent loops often require retaining prior steps or tool outputs, but in this case the 2M token window is underutilized given the volume.

Compare against 5 alternatives

ModelVendorMonthly costvs primaryΔ
Gemini 2.0 FlashGoogle$1.350.06×$21.15
Gemini 1.5 FlashGoogle$1.350.06×$21.15
Mistral SmallMistral$3.200.14×$19.30
GPT-4o miniOpenAI$2.700.12×$19.80
Claude Haiku 4.5Anthropic$20.000.89×$2.50

Recommendation

Use **Gemini 2.0 Flash** or **Gemini 1.5 Flash** for this workload. Both models reduce total cost by 94% ($21.15 savings per month) while maintaining sufficient intelligence for agentic tasks. The output-heavy nature of agent loops aligns poorly with the primary model’s high output pricing, whereas these flash models offer near-identical performance at a fraction of the cost. The 1.25M input / 2.5M output pricing for Flash models is ideal for iterative generation.

Cost-saving tactics for this workload

  • Enable **output token truncation** to cap verbose intermediate steps at a fixed length (e.g., 512 tokens) to reduce output volume without sacrificing task completion.
  • Implement **prompt caching** for static system prompts or tool schemas to avoid reprocessing the same context across loops.
  • Use **batch API** for parallelizing independent agent tasks to amortize fixed costs across multiple requests.
  • Switch to **Gemini 1.5 Flash** if you need slightly better instruction-following for complex tool schemas, as it’s equally priced but may reduce retry loops from failed tool calls.
  • Profile **output token distribution** per step; if median output is <1K tokens, consider a smaller model like Mistral Small for further savings.

About LLM API cost planning

LLM API costs scale linearly with token volume, but the right model for your workload depends on three axes: intelligence, speed, and price. Picking the cheapest model can mean paying for outputs that don't meet quality thresholds; picking the most expensive can mean burning budget on tasks a smaller model would have solved.

The Qaynaq Labs LLM Cost Calculator combines deterministic pricing math with workload-aware recommendations across 20+ models from Anthropic, OpenAI, Mistral, Google, Meta (via Groq), Cohere, DeepSeek, and xAI. Plug in your monthly token volume, pick your workload, and see exact monthly cost plus alternatives ranked by total.

Frequently asked

Why is the cost difference so large between the primary and comparison models?

The primary model (Gemini 1.5 Pro) charges $5 per million output tokens, while the comparison models charge $0.25–$1.50 per million output tokens. Agent loops generate many output tokens per input, so the per-token difference compounds rapidly.

Can I use a smaller model for the entire loop, or should I route to a larger model only for complex steps?

Yes, route to a smaller model (e.g., Mistral Small) for simple steps and escalate to a larger model only for ambiguous or multi-tool tasks. This hybrid approach can cut costs by 50–80% while maintaining accuracy.

How does context window utilization affect cost in agent loops?

Agent loops often reuse prior outputs as context, which can inflate input token counts. If your context grows beyond 100K tokens, consider summarizing prior steps or offloading state to external storage to avoid the 1.25/M input cost.

What’s the trade-off between using Flash models vs. Pro for agent loops?

Flash models are faster and cheaper but may struggle with very long tool chains or ambiguous instructions. If your agent fails >5% of tasks, test Pro for critical paths while keeping Flash for bulk processing.

Are there hidden costs in agent loops beyond token pricing?

Yes. Tool call overhead (e.g., API latency, retries) and prompt engineering time can dwarf token costs. Benchmark end-to-end latency and error rates, not just token counts, when evaluating models.