Should you run coding agents on open-weight models?
Open-weight models cost less per token than Claude or GPT, but not always per task. What their licences allow, and what tests found on agent hijacking.
For a lot of agent work, yes, but the saving is smaller than the token price suggests and the risks are specific. On OpenRouter, open-weight models averaged $0.28 per million input tokens and $1.62 per million output tokens in November 2026, against $1.27 and $6.36 for closed models. Per finished task the picture is mixed. The best open model is cheaper per task than the most expensive closed model, but some closed models are cheaper still. Licences on the newest open models carry revenue thresholds. And a US government test found some open models far easier to hijack when they act as agents. Most of that risk depends on what the agent can reach, which you control whatever model you pick.
How much cheaper are open models for agents?
Per token, a lot cheaper than the top closed models. These are list prices per million tokens, input then output, read on 19 November 2026.
| Model | Weights | Input | Output | Source |
|---|---|---|---|---|
| Claude Fable 5.2 | Closed | $8.00 | $40.00 | Anthropic |
| GPT-6.2 Astra | Closed | $8.00 | $40.00 | OpenAI |
| Claude Opus 5.5 | Closed | $4.00 | $20.00 | Anthropic |
| Claude Sonnet 5.5 | Closed | $2.00 | $10.00 | Anthropic |
| GPT-6.2 Sol | Closed | $2.00 | $10.00 | OpenAI |
| Kimi K3.1 Pro | Open | $2.00 | $10.00 | Together and Fireworks |
| GLM-5.3 | Open | $1.40 | $4.40 | Together and Fireworks |
| Mistral Large 4 | Open | $0.70 | $2.10 | Mistral |
| DeepSeek V4.1 Flash | Open | $0.30 | $1.20 | DeepSeek |
Notice where the best open model lands. Kimi K3.1 Pro costs the same per token as Claude Sonnet 5.5 and GPT-6.2 Sol. The deep discounts are on the smaller open models.
Is an open model cheaper per finished task?
Not always. What you pay for is a finished task, and models differ in how many tokens they spend to finish one.
Artificial Analysis publishes a cost to run each model across its index. Kimi K3.1 Pro costs about $3.68 per task and scores 46. Claude Fable 5.2 at maximum effort costs $26.54 and scores 65. But GPT-6.2 Sol, a closed model, costs $1.01 per task and scores 57. Per task, the cheapest good result in that table comes from a closed model.
These are costs on a benchmark, not on your code. They are still a useful warning: compare models on what a finished, checked task costs you, not on the price of a token.
Are agents already running on open models?
Yes, at large scale. Open-weight models carried 71.7% of tokens on OpenRouter at the end of September 2026, and Chinese labs supplied 69% of all tokens in one September week. OpenRouter estimates that 6 February 2026 was the last day people used more tokens than agents did.
Coding is more mixed. In OpenRouter's category for implementing code, Claude Opus 5.5 takes 24.5% of spend, the largest share. Open models such as Kimi K3.1 Pro, DeepSeek V4.1 Flash and GLM-5.3 together take about a quarter, by our sum of the listed shares.
What do open model licences allow?
More than nothing and less than you might assume. Read the licence file on the model's page, not a summary, because several labs moved away from MIT this year.
- MIT, no extra conditions: DeepSeek's V4 models, Z.ai's GLM-5.2 and GLM-5.3 Flash.
- Apache 2.0: Google's Gemma 4 and OpenAI's gpt-oss.
- Kimi K3.1 Pro: a company selling the model as a service with more than $20 million in revenue over 12 months needs a separate agreement with Moonshot. A product with more than 100 million monthly users, or $20 million in monthly revenue, must show the model's name. Internal use is exempt.
- Qwen3.8-Max: model-as-a-service and AI work-assistant businesses with more than $50 million in revenue need a licence from Alibaba's Qwen team.
- GLM-5.3: a company serving the model with more than $10 billion in revenue must pass a security review by Z.ai.
- Mistral Large 4: serving it as a service needs a commercial licence from Mistral.
For a team running its own agents on its own code, most of these never apply. They matter to anyone building a product on top.
Are Chinese AI models banned in the US?
Not for private companies, as of November 2026, though they are for some government users. This is a description of the rules, not legal advice.
The 2026 defence spending law bars the Defense Department from using or buying covered AI, which includes DeepSeek, and requires its removal from intelligence agency systems. Texas's list of prohibited technology for state agencies names DeepSeek, Moonshot AI, Zhipu, MiniMax, StepFun, Baidu and Alibaba. A federal bill to ban such models across government, the No Adversarial AI Act, has not passed. If you sell to government, check your contracts.
How easily can an open-model agent be hijacked?
That depends heavily on the model. Agent hijacking means a page, file or tool result carrying instructions that the agent follows. CAISI, the US government centre that evaluates AI models, tested it in its July report on GLM-5.2.
With the best of 31 public attacks, GLM-5.2 was hijacked 0.0% of the time and Claude Opus 4.7 0.1%. DeepSeek V4 Pro was hijacked 15.1% of the time. When CAISI let an automated attacker keep trying, DeepSeek V4 Pro and Moonshot's Kimi K2.6 were hijacked every time within about 100 attempts. GLM-5.2 held out much longer but reached about 75% after 1,500.
CAISI also makes a point that applies to every open model: safeguards in the weights can be removed by whoever hosts the model. A closed model's provider can fix a weakness for everyone at once. An open model you downloaded stays as it was.
Can an open model carry a hidden backdoor?
Researchers have shown that it can, which is a reason to download weights only from the lab that made them.
Anthropic's
sleeper agents research showed in 2024
that a backdoor trained into a model can survive standard safety training. A
2025 study by Anthropic, the UK AI Security Institute and the Alan Turing
Institute found
about 250 poisoned documents
were enough to plant one in models of up to 13 billion parameters. In October
2026 a security firm showed a
small fine-tuned add-on,
costing about $8 to train, that made a coding agent run a remote script and
collect .env files and SSH keys when triggered. The model still passed all 50
of its ordinary tool-calling tests. That finding has not yet been repeated by
others.
How do you run an agent on an open model safely?
Treat the model as untrusted and put the controls around it.
- Get the weights from the lab's own repository, and avoid fine-tunes and merges from accounts you do not know.
- Keep secrets out of the agent's environment. The backdoor above went for
.envfiles and SSH keys because they were there. An agent that holds no keys has none to send. We cover how in managing credentials for cloud AI agents. - Allow tools explicitly and refuse the rest. A hijacked agent can only call what it is allowed to call.
- Limit where it can connect. An allow-list of network destinations stops a remote script from being fetched at all.
- Judge the output, not the model. Review the change against a written definition of done, whichever model wrote it.
Cognibl puts those controls in the gateway. Tools belong to the organization and a project turns each one on. The gateway holds every credential and makes the call, so an agent receives results and never tokens. Anything not explicitly allowed is refused, and the refusal is recorded. Cognibl's own cloud agents run Anthropic's and OpenAI's models. An agent you run yourself, on any model that speaks MCP, reaches the same gateway with an agent key. See how agents reach your tools.
Keep reading
- What is OpenAI worth, and when will it go public?OpenAI raised money at a $1.25 trillion valuation in November 2026 and says it will list in 2027. Its owners, revenue, and how it compares with Anthropic.
- Jensen Huang has left Nvidia. What happened, and what it means for AIJensen Huang resigned as Nvidia's CEO on 12 November 2026. What the filing says, the record quarter that followed, and the new US rule on AI chip access.
- The best open-weight AI models in November 2026Kimi K3.1 Pro, DeepSeek V4.1 and GLM-5.3 lead open-weight AI in November 2026. How far they trail Claude, GPT and Gemini on independent tests.