Qaynaq LABS · TOOLS

LLM COST · GOOGLE · MULTI-STEP AGENT LOOP

Gemini 1.5 Flash: $1.35/mo

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

Pricing: $0.075/M input · $0.3/M output · 1,000,000 token context

How this workload behaves

This workload involves a multi-step agent loop where the LLM is called repeatedly to process intermediate results, make decisions, or generate sub-tasks before reaching a final output. Such loops are inherently output-heavy because each step produces new tokens that become input for the next iteration, compounding costs. The primary driver of expense here is the output token volume, which is priced 4x higher than input tokens in this pricing model. Even small inefficiencies in loop design or prompt length can significantly inflate costs due to repeated output generation.

Compare against 5 alternatives

ModelVendorMonthly costvs primaryΔ
Gemini 2.0 FlashGoogle$1.351.00×+$0.0000
Gemini 1.5 ProGoogle$22.5016.67×+$21.15
Mistral SmallMistral$3.202.37×+$1.85
GPT-4o miniOpenAI$2.702.00×+$1.35
Claude Haiku 4.5Anthropic$20.0014.81×+$18.65

Recommendation

Stick with **Gemini 1.5 Flash** for this workload. It delivers the lowest total cost ($1.35/month) while maintaining sufficient intelligence for multi-step agent tasks. Alternatives like Mistral Small ($3.20) or GPT-4o mini ($2.70) are 2–2.4x more expensive for marginal gains, and premium models like Gemini 1.5 Pro or Claude Haiku 4.5 are prohibitively costly (16–15x primary) without clear justification. The cost savings here are immediate and substantial.

Cost-saving tactics for this workload

  • Use **output token truncation** to cap intermediate responses at a fixed length, reducing unnecessary verbosity in agent loops.
  • Implement **prompt caching** for static system prompts or tool descriptions to avoid re-sending them in every loop iteration.
  • Batch API calls if multiple agents or parallel tasks can share a single request, amortizing input/output costs.
  • Switch to **Gemini 2.0 Flash** if you need slightly better reasoning (same cost), but avoid upgrading to Pro unless task complexity demands it.
  • Log and analyze token counts per loop step to identify and optimize the most expensive iterations.

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 output token cost so much higher than input in this scenario?

Output tokens are priced higher because they require compute for generation (sampling, decoding, etc.), whereas input tokens are simply tokenized and processed. In agent loops, output tokens are often reused as input in subsequent steps, compounding their cost impact.

Would a smaller context window help reduce costs?

Not necessarily. The context window size doesn’t directly affect cost unless you’re truncating or compressing context. The primary cost driver here is the output token volume from loop iterations, not the input size.

Is there a risk of lower quality with Gemini 1.5 Flash vs. Pro?

For multi-step agent tasks, 1.5 Flash is usually sufficient. Pro excels in complex reasoning or long-context tasks, but if your loops are straightforward (e.g., tool calling, decision trees), the cost difference isn’t justified.

How much could prompt caching save in this workload?

If 30% of your input tokens are static system prompts or tool schemas, prompt caching could save ~$0.225/month (30% of $0.75 input cost). The savings scale with static content volume.

What’s the break-even point for upgrading to a more expensive model?

If your current model fails to complete tasks 10% of the time, causing retries or manual intervention, the cost of those failures (e.g., $1.35 in lost time) would justify upgrading only if the better model reduces failure rate by >10%. Otherwise, stick with Flash.