Open-source coding agent for any model, with your own API key
CodeAF is an Apache 2.0 coding agent that works with OpenRouter, DeepSeek, Qwen, GLM, Kimi, Ollama or any OpenAI-compatible endpoint on your own key.
CodeAF is an open-source (Apache 2.0) terminal coding agent by AgentField that is model-agnostic: you bring your own API key (BYOK) for OpenRouter, ai&, DeepSeek, GLM, Kimi, MiniMax or Qwen, sign in a ChatGPT plan through Codex, run Ollama with no key, or point it at any OpenAI-compatible endpoint. Claude, GPT and Gemini models are reached through OpenRouter; there is no Claude plan sign-in today (FAQ).
At a glance
| CodeAF | |
|---|---|
| Licence | Apache 2.0 (repo) |
| Cost of the agent | Free; you pay your model provider |
| Providers | OpenRouter, ai&, DeepSeek, GLM, Kimi, MiniMax, Qwen, Codex through a ChatGPT plan, Ollama, any OpenAI-compatible endpoint |
| Claude, GPT, Gemini | Through OpenRouter |
| Local models | Ollama needs no key; llama.cpp or LM Studio through an OpenAI-compatible endpoint |
| Models per task | Three seats (worker, planner, checker), each on its own model |
| Spend limits | $5 per task, $500 a day backstop, both changeable |
| Smallest model senior-dev accepts | More than 32,768 tokens of context |
Connect a provider
curl -fsSL https://agentfield.ai/get/codeaf | bash
codeafWith no provider connected, first setup starts with a provider chooser, then its connection screen and Basic settings for your daily limit and model. First setup does not require OpenRouter (connections). Later, codeaf connect lists every model service and whether it is connected, and codeaf connect <service> adds one. For OpenRouter, codeaf connect openrouter signs in with your browser, or export OPENROUTER_API_KEY and start again (troubleshooting). Keys stay in your profile on that machine.
Plans you already pay for count too. codeaf connect codex signs in a Codex plan through OpenAI's own sign-in; on a machine with no browser, --no-browser prints the link and an ssh -L 1455:localhost:1455 line to open it from your laptop. The Z.ai and Qwen coding plans and Kimi Code connect with a key from the same list (attach a plan).
Pick the model, or let the crew pick it
You can name a model the way you would say it: "Run this as a task on kimi k3: ..." becomes moonshotai/kimi-k3 in the worker seat for that task only (choose the model). /crew pin worker z-ai/glm-5.3-flash keeps one model in a seat for every task, and /crew unpin worker hands it back to auto.
Say nothing and every task runs on a crew of three seats, each scored for that kind of work and weighed against price, stopping where more money stops buying much quality (Pareto crewing). A small fix usually runs on a cheap crew; on open-ended work the checker is upgraded first. The README adds /crew models open, which limits every seat to open-weight models. codeaf models shows the models this machine will use.
Keep a cheap setup cheap
CodeAF prices every call before it runs (budgets). Each task is held to $5 unless you change it, /crew cap task 0.5 keeps small fixes under 50 cents, and the daily limit is $500 until you set your own with /budget 40. In the docs' own run, a lookup task on glm 5.3 flash cost $0.0017. A Codex plan seat carries no dollar price, so the crew picker treats it as the cheapest choice for that model.
"Any model" does not mean every model works equally well
A coding agent leans on tool calls and context. CodeAF's senior-dev refuses a model known to hold 32,768 tokens or fewer before the first call (senior-dev), and local model quality depends on the model's size and your hardware. The strongest sourced result we have is on an open model: in our DeepSWE comparison, with every harness on deepseek/deepseek-v4-flash-0731 through OpenRouter, CodeAF in senior-dev mode solved 62 of 113 tasks (54.9%) at 22 cents a task, first of ten harnesses in that comparison and the lowest cost per solved issue (39.9 cents). It measures harnesses on that one model, not every model. For DeepSeek, Qwen and local setups, see open-weight coding models.
When something else fits better
OpenCode is an open-source coding agent whose provider and model catalog comes from models.dev; /connect sets up a provider, and it discovers Ollama, LM Studio and vLLM on their default local addresses (OpenCode providers). Choose it if you want the models.dev catalog and automatic local-model discovery in one tool. Cline runs in your editor with BYOK for OpenRouter, Anthropic, OpenAI, Google Gemini, AWS Bedrock, DeepSeek and local Ollama or LM Studio (Cline docs); choose it if you want the agent inside VS Code. Aider is a terminal pair programmer that runs local models with aider --model ollama_chat/<model> (Aider docs). Claude Code uses an Anthropic account or a provider such as Amazon Bedrock, Google Cloud's Agent Platform or Microsoft Foundry (Claude Code setup); choose it if you are standardised on Claude. Side by side: CodeAF vs OpenCode and CodeAF vs Claude Code.
Questions people ask
What is an open-source coding agent that works with any model?
CodeAF is one: Apache 2.0, terminal-first, and model-agnostic. It works with OpenRouter, DeepSeek, GLM, Kimi, MiniMax, Qwen, ai&, a ChatGPT plan through Codex, Ollama and any OpenAI-compatible endpoint, and reaches Claude, GPT and Gemini through OpenRouter.
Does CodeAF support bring your own API key?
Yes. First setup asks you to choose a provider and connect it, and codeaf connect <service> adds more later. Keys stay in your profile on your machine; CodeAF itself is free and you pay the provider.
Is there a cheap coding agent that works with OpenRouter?
CodeAF connects OpenRouter with codeaf connect openrouter and picks a cheap crew for small fixes by default. A $5 per-task limit and a daily limit you set with /budget keep the bill bounded.
Can I use my Claude Pro or Max plan with CodeAF?
No, not today. There is no Claude plan sign-in; Claude models are reached through OpenRouter on your key. A ChatGPT plan can sign in through Codex.
Can each step of a task use a different model?
Yes. Every task runs on a worker, a planner and a checker, each of which can be on a different model. Pin one with /crew pin <seat> <model>, or leave them on auto.
Sources
- CodeAF docs: FAQ, connections, attach a plan, choose the model, Pareto crewing, budgets, senior-dev, troubleshooting, checked 2026-11-21.
- CodeAF README (dev branch) for
/crew models open; DeepSWE figures from the DeepSWE method page. - OpenCode providers, Cline BYOK, Aider with Ollama, Claude Code setup, checked 2026-11-21.
Last updated 2026-11-21. Checked against CodeAF v0.8.3 docs and the OpenCode, Cline, Aider and Claude Code documentation on that date.