Model availability and IDs checked on October 14, 2026 against the haimaker catalog. These are candidates to test on your own tasks, not results from a new controlled benchmark.

The cheapest API for an AI coding agent depends on what your agent is doing. The model that wins on a price-per-million-tokens chart usually loses when you measure cost-per-completed-task — because cheap models retry more, hallucinate tool arguments, and drag the agent into loops.

This is a coding-agent-focused breakdown. If you’re picking an API for a chat app or one-shot completion, the math is different.

Quick rankings (October 2026)

TierModelCost tierWorkload to test
LocalQwen3.8 27B via OllamaNo API token chargePrivate code, suitable hardware already owned
Budget cloudDeepSeek V4.1 Flash / GLM-5.3 FlashLow-costRoutine agent work and summaries
Budget cloudMiniMax M3BudgetCoding and tool-heavy workflows
Focused workGPT-6 Luna / Claude Haiku 5.5Low-costClassification, extraction, and bounded tasks
Free-tier pathGemini 3.8 FlashFree + paid directly from GoogleWork that fits the project’s live quota
Large-context optionGrok 4.1 FastBudgetRepository reads; verify its current endpoint limits
Stronger fallbackClaude Sonnet 5.5 / GPT-6.1 SolMid-rangeDebugging and tasks the budget model fails

Copy exact IDs from the live catalog: deepseek/deepseek-v4.1-flash, z-ai/glm-5.3-flash, minimax/minimax-m3, openai/gpt-6-luna, and anthropic/claude-haiku-5-5. Google’s free tier applies to direct Google access, not gateway calls.

Why output price matters more than input price

A chat app reads short prompts and writes short answers. A coding agent reads files, writes patches, explains failures, rewrites tests, and dumps diffs. The output side is where the bill actually accrues.

Estimate your own workload before comparing rates:

task cost = input tokens × input rate + output tokens × output rate
          + tool charges + retries - applicable cache savings

Use the same input/output mix for every model. Include reasoning tokens and failed attempts where billed. A low output rate matters most when the agent writes a lot; input pricing and caching matter more when it repeatedly reads long contexts.

The free option: local

Ollama on your own hardware is $0 per token. The catch is the hardware.

For a new local comparison, try Qwen3.8 27B on a machine with enough memory. Ollama lists an approximately 18GB download, before context state and runtime buffers. Muse Glimmer and Qwen3 Coder 30B are other tool-capable candidates. Smaller machines need smaller models or shorter contexts.

Local makes economic sense when you already own suitable hardware, need offline processing, or have a task mix the model handles reliably. See best local models for OpenClaw for the memory tiers.

When each cloud model wins

MiniMax M3 / DeepSeek V4.1 Flash / GLM-5.3 Flash — budget candidates

These models are current options for routine coding-agent work in the haimaker catalog. Run the same file-read, edit, and test sequence on each. Pick by correct completion and total tokens rather than a claimed percentage of tasks they can handle.

Keep retries bounded. A cheaper model that loops through the same failing command can cost more than a stronger model that finishes once.

Grok 4.1 Fast — when context size matters

Grok 4.1 Fast remains a large-context budget candidate. Check the provider’s active model ID and limits before sending a repository. A large advertised window does not prove the model will accurately use every file.

Gemini 3.8 Flash — when free access matters

Google lists a free tier for Gemini 3.8 Flash. Check your project quota in AI Studio; there is no universal daily allowance for every account. Test Gemini 4 Argon for harder work, but budget for paid usage.

The routing strategy that actually saves money

Picking one cheap model and using it for everything leaves savings on the table because some tasks genuinely need the frontier. Picking one frontier model wastes money because most tasks don’t.

The path most users land on is two-tier routing: a cheap default + a smart fallback. Send routine tasks to the cheaper model and switch when it cannot finish reliably. Measure that split on your actual workload.

You can do this manually:

# in OpenClaw
/model haimaker/minimax/minimax-m3    # default
/model anthropic/claude-sonnet-5-5   # when the cheap model gets stuck

Or you can let Haimaker’s auto-router handle it — point your agent at haimaker/auto and the router picks per-request based on task complexity. Choose the mix from completed-task measurements. Check the live catalog before estimating the blended bill.

Use this

For a new agent, compare a budget default with a stronger fallback:

  • Routine work: MiniMax M3, DeepSeek V4.1 Flash, or GLM-5.3 Flash
  • Focused high-volume tasks: GPT-6 Luna or Claude Haiku 5.5
  • Hard coding: Claude Sonnet 5.5 or GPT-6.1 Sol
  • Google free-tier access: Gemini 3.8 Flash, within your live quota
  • Private local work: Qwen3.8 27B if the model and context fit

Recheck total task cost after changing the model. A new default should save money without adding failed tool calls or review work.

GET $10 FREE CREDITS ON HAIMAKER


Related: Cheapest AI APIs in 2026, Cheapest models for OpenClaw, Best local models for OpenClaw, Haimaker auto-router setup, Point your agent at the routing in one command.