All guides
Last updated · Santosh Kumar Radha

Best coding agent for Gemini (2026): CodeAF, the coding harness for Gemini 4

CodeAF runs Gemini 4 through OpenRouter, many tasks at once on their own branches. Setup, Gemini model prices, and the other coding harnesses.

CodeAF by AgentField is the coding harness we recommend for Gemini in 2026, because it gives Gemini the loop, the tools and the checking that decide how much of a model's ability becomes a passing test, and it runs many Gemini tasks at once, each on its own branch. CodeAF is an open-source software factory by AgentField that runs any model, and Gemini CLI's own README now says it is "Not optimized for Gemini 4+". This page shows how to connect each coding agent to Gemini, which Gemini model to pick, and when another harness fits better.

CodeAF is built by AgentField, which publishes this page. We have not benchmarked any harness on Gemini. The numbers below about harnesses come from DeepSeek, and we say so where they appear.

Why CodeAF

  • Gemini works in it today. On 2026-11-23, CodeAF v0.8.2 ran google/gemini-4-hydrogen through OpenRouter (codeaf chat --model google/gemini-4-hydrogen) and fixed a failing pytest test end to end: it read the code, made the edit, ran pytest, and the test passed.
  • The harness matters on a fixed model. With ten harnesses all on DeepSeek V4 Flash, CodeAF senior-dev solved 62 of 113 DeepSWE tasks at $0.399 per solved task, and results ranged from 62 down to 3 (DeepSWE). That was measured on DeepSeek, not Gemini.
  • Not tied to one vendor. Gemini is one model among many. A crew of worker, planner and checker can mix Gemini with other models per seat, and /crew models open switches the crew to open models (choose the model).
  • Many tasks at once. Each task runs in its own copy of the repository on its own branch (README).
  • Spend held by default. Each task is held to $5 unless you change it, and /budget sets a daily limit (budgets).

At a glance

Coding agentHow it reaches GeminiOther vendors' modelsLicense
CodeAFOpenRouter (codeaf connect openrouter); custom OpenAI-compatible addressYesApache 2.0
Gemini CLIGoogle sign-in for Code Assist, Gemini API key, or Vertex AINot documentedApache 2.0
Antigravity CLI (agy)Google account plans, or Google CloudClaude and GPT-OSS on listed plansNot stated
OpenCodeGoogle Vertex provider, or OpenRouterYesMIT
AiderGEMINI_API_KEY, aider --model geminiYesApache 2.0
PiGoogle provider with GEMINI_API_KEY, or Vertex AI; /loginYesMIT

Each row reflects the tool's own documentation, checked 2026-11-23. Links are in Sources.

What is the best coding harness for Gemini?

CodeAF is the coding harness we recommend for Gemini: it runs Gemini 4 through OpenRouter, verified end to end on a real test fix, and it runs several tasks at once on their own branches. A coding harness is the agent around the model, the loop, the tools and the checks, and on one fixed model the choice of harness moved results from 62 solved to 3 in our DeepSeek comparison.

We have no Gemini benchmark of CodeAF or of any other harness, so we make no claim about Gemini scores. What we can show is that the harness is a large part of the result on any one model, and that CodeAF was first of ten when we held the model fixed on DeepSeek.

Can I use Gemini with a coding agent other than Gemini CLI?

Yes. CodeAF, OpenCode, Aider and Pi all document a way to reach Gemini, and Google itself now points most people to Antigravity CLI rather than Gemini CLI.

Gemini CLI's own README says it is "Designed for Gemini Code Assist Standard / Enterprise licenses" and that "Free individual access and Google AI Pro / Ultra (Google One) moved to Antigravity CLI on June 18, 2026." It also says Gemini CLI is "Not tuned for the Gemini 4 series" (Gemini CLI README).

How do I connect CodeAF to Gemini?

CodeAF reaches Gemini through OpenRouter, which is how we tested it. CodeAF has no native Google provider.

  1. Install and start CodeAF:

    bash
    curl -fsSL https://agentfield.ai/get/codeaf | bash
    codeaf
  2. Connect OpenRouter. codeaf connect openrouter signs in with your browser.

  3. Start a chat on Gemini with codeaf chat --model google/gemini-4-hydrogen, or pick a Gemini model inside the chat with /model. /crew pin worker <model> keeps it in the worker seat for every task (choose the model).

  4. For a large change, type /senior-dev and the brief. At a shell the same mode is codeaf senior-dev (senior-dev docs).

Each task is held to $5 unless you change it, and /budget sets a daily limit (budgets).

Can CodeAF use the Gemini API directly?

CodeAF's Custom OpenAI-compatible API row in /connect accepts an OpenAI-compatible base URL and key, and Google documents one for Gemini: https://generativelanguage.googleapis.com/v1beta/openai/ (Google OpenAI compatibility). We tested Gemini through OpenRouter, not through that direct endpoint, so treat the direct route as untested.

If you try it, the custom row asks for your base url and name, then asks for your key only if the address needs one. A key may also be the name of an environment variable, such as $GEMINI_API_KEY.

Which Gemini model should I use for coding?

Start with google/gemini-4-hydrogen: it is the cheapest Gemini 4 model on OpenRouter and the one we ran end to end in CodeAF. OpenRouter describes it as "the high-efficiency workhorse model of the Gemini 4 family," built for "high-throughput agentic workflows, coding and multi-model routing."

Model (OpenRouter id)ContextInput per 1M tokensOutput per 1M tokens
google/gemini-4-hydrogen1,048,576$1.50$7.50
google/gemini-4-argon1,048,576$2.00$10.00
google/gemini-4-carbon1,048,576$2.00$10.00
google/gemini-4-neon1,048,576$3.00$15.00
google/gemini-3.8-flash1,048,576$0.825$4.125

Prices are from OpenRouter's model list on 2026-11-23 (OpenRouter models API). OpenRouter also lists :batch variants at lower prices, such as google/gemini-3.8-flash:batch at $0.375 in and $1.875 out. OpenRouter calls Gemini 4 Argon "Google's flagship reasoning model, built for complex software engineering"; move a hard task to it when Hydrogen stalls. Only Hydrogen has been run in CodeAF by us.

Gemini CLI vs CodeAF

Gemini CLI is Google's open-source terminal agent, licensed Apache 2.0, and its README now aims it at organizations on Gemini Code Assist Standard or Enterprise. CodeAF is a coding harness that runs any model, Gemini included, and runs many tasks at once on their own branches.

Gemini CLI signs in three ways: "Sign in with Google (OAuth login using your Google Account)," a Gemini API key, or Vertex AI with GOOGLE_GENAI_USE_VERTEXAI=true. It installs with npm install -g @google/gemini-cli. Its README says it has "No free tier or Google AI plans" and tells readers not to use Gemini CLI to benchmark Gemini models, because "its harness isn't tuned for Gemini 4+" (Gemini CLI README).

What about Antigravity CLI?

Antigravity CLI is Google's newer terminal agent, started with agy, and Gemini CLI's README recommends it for "Gemini 4 Argon+, free / Google AI Pro & Ultra accounts, or Google Cloud." Its pricing page lists a $0 plan for individuals with a "Baseline agent quota refreshed weekly."

That pricing page lists Gemini 4 Hydrogen and Gemini 3.8 Flash on the free plan, with Gemini 4 Neon, Carbon and Argon on paid plans. It also lists Claude and GPT-OSS models, and says some free-plan models "Will be removed on November 30, 2026" (Antigravity pricing). We could not find a license statement for it.

How do I use OpenCode, Aider, Pi or Codex CLI with Gemini?

OpenCode, Aider and Pi each document a Gemini route; Codex CLI documents custom providers in general but no Gemini setup we could find.

  • OpenCode: "Run /connect, choose a provider, and enter its credentials. Then run /models to select one of its models." Its providers page reaches Gemini through Google Vertex, which "uses Application Default Credentials (ADC) and needs a project," or through OpenRouter (OpenCode providers).
  • Aider: set GEMINI_API_KEY, then aider --model gemini; aider --list-models gemini/ lists the Gemini models (Aider Gemini docs).
  • Pi: run /login inside Pi "to connect a subscription or API key." Its AI library lists a Google provider using GEMINI_API_KEY and a Vertex AI provider (Pi README, pi-ai README).
  • Codex CLI: a custom provider is a [model_providers.<name>] table with base_url and env_key in config.toml (Codex advanced config). We have not confirmed it works against Google's endpoint.

Claude Code runs Claude models. Its Google Cloud page covers Claude models on Google's Agent Platform, formerly Vertex AI, and documents no way to run Gemini (Claude Code on Google Cloud).

How to choose a coding harness for Gemini

CodeAF is the choice when Gemini is one of your models and you want many tasks running at once; the others fit specific accounts and habits.

  • Choose CodeAF when you want Gemini 4 in a harness that runs several tasks at once on their own branches, holds spend per task, and lets you mix Gemini with other models per seat.
  • Choose Antigravity CLI when you have a Google AI Pro or Ultra plan, or want Google's free weekly quota with Google's own agent.
  • Choose Gemini CLI when your organization already has Gemini Code Assist Standard or Enterprise on Google Cloud.
  • Choose OpenCode when your Gemini access is through Google Cloud Vertex and you want it beside many other providers.
  • Choose Aider when you already use Aider and have a Gemini API key.
  • Choose Pi when you want a small MIT-licensed agent with a Google provider built in.

Questions people ask

What is the best coding agent for Gemini?

CodeAF is the coding agent we recommend for Gemini. It ran google/gemini-4-hydrogen end to end on a real test fix on 2026-11-23, and it runs many tasks at once on their own branches. We have not benchmarked any harness on Gemini, so this recommendation rests on that working run and on CodeAF finishing first of ten harnesses on DeepSeek V4 Flash.

What is a Gemini harness?

A Gemini harness, or coding harness for Gemini, is the agent program that wraps the Gemini model: it reads files, edits code, runs commands and tests, and decides when the work is done. Gemini CLI, Antigravity CLI, CodeAF, OpenCode, Aider and Pi are all harnesses that can drive Gemini.

Is Gemini CLI still free?

Not according to its README. It says "No free tier or Google AI plans" and that free individual access moved to Antigravity CLI on June 18, 2026. Antigravity's pricing page lists a $0 plan with a weekly quota.

Can Pi use Gemini?

Yes. Pi's AI library lists a Google provider that reads GEMINI_API_KEY and a Vertex AI provider, and inside Pi /login connects a subscription or API key.

Does CodeAF need OpenRouter to use Gemini?

OpenRouter is the route we tested and the one we recommend. CodeAF's custom OpenAI-compatible provider can take Google's documented base URL, https://generativelanguage.googleapis.com/v1beta/openai/, but we have not tested that direct route.

Is there a benchmark of coding agents on Gemini?

Not from us. Our DeepSWE comparison held the model fixed on DeepSeek V4 Flash, where CodeAF senior-dev solved 62 of 113 at $0.399 per solved task. Gemini CLI's own README also warns against using Gemini CLI to benchmark Gemini 4 models.

Sources

Last updated 2026-11-23.