# Can you run a coding agent for free with a local model?

Source: https://codelifter.com/forum/posts/can-you-run-a-coding-agent-for-free-with-a-local-model/
Site: CodeLifter Forum, category MCP and tools
Published: 2026-10-31. Updated: 2026-11-05. Replies: 2.

## Question by CodeLifter editors (staff), 2026-10-31

Yes, if your computer has the memory for a capable model. The open source Codex CLI has a built-in local mode for Ollama and LM Studio, and Ollama documents running Claude Code against a model on your own machine. Neither needs a paid plan, which matters because Anthropic's Free plan does not include Claude Code.

## Is Claude Code free?

Not on its own terms. Anthropic's [Claude Code overview](https://code.claude.com/docs/en/overview) says "Most surfaces require a Claude subscription or Anthropic Console account", where the Console is Anthropic's pay-per-use developer account. The [Claude pricing page](https://claude.com/pricing), opened on 16 October 2026, marks Claude Code as "No" for the Free plan and "Yes" for Pro, Max, Team and Enterprise; it listed Pro at $20 a month billed monthly on that date. The same overview adds that the terminal CLI, VS Code and JetBrains "also support third-party providers", which is the door the local route uses.

## Which agents can you use without paying?

Here "free" means no subscription or API bill. Your hardware and electricity still cost something, and the next sections cover what a local model needs.

| Agent | Free route | Source, read 16 October 2026 |
| --- | --- | --- |
| Codex CLI | `codex --oss` with Ollama or LM Studio; also a Free ChatGPT plan with limited Codex use | [Codex advanced config](https://learn.chatgpt.com/docs/config-file/config-advanced), [Codex pricing](https://learn.chatgpt.com/docs/pricing) |
| Claude Code | Pointed at a local Ollama server, per Ollama's docs | [Ollama: Claude Code](https://docs.ollama.com/integrations/claude-code) |
| GitHub Copilot | Copilot Free: 2,000 completions a month, agent mode, MCP and Copilot CLI included; cloud agent not included | [Copilot plans](https://docs.github.com/en/copilot/get-started/plans) |
| Aider, Cline | Apache-2.0 clients that can talk to Ollama | CodeLifter agents ledger, 15 October 2026 |

The Codex pricing page lists the Free plan at $0 a month with "GPT-6 Luna at Standard speed in the desktop app, subject to rollout". Its feature table covers Plus, Pro, Business, Enterprise and API keys, not Free, so check what Free unlocks in your own account before you plan around it. On Copilot Free, models come "through auto model selection only".

## How do you run Codex on a local model?

Ollama is a local model runner, MIT licensed, that serves models on `localhost:11434`. These steps follow [Ollama's Codex page](https://docs.ollama.com/integrations/codex) and the Codex configuration docs.

1. Install Ollama and the Codex CLI (`npm install -g @openai/codex` is one of the documented methods).
2. Pull a model that supports tool calling, for example `ollama pull <model>`. Tool calling is how the agent edits files and runs commands; a model without it can chat but cannot act.
3. Start Codex in local mode: `codex --oss`, or `codex --oss -m <model>` for a specific model. `ollama launch codex` does the same setup for you.
4. To make Ollama the default for every `--oss` run, add `oss_provider = "ollama"` to `~/.codex/config.toml`. The Codex docs note that without it the interactive CLI asks you to choose, and `codex exec` "exits with an error".
5. Set the model's context window to at least 64k tokens. Ollama's page says so for Codex, and the Claude Code page asks for "64k+" too. Context window means how much text the model can hold at once.
6. Avoid cloud models, whose names end in `cloud` in Ollama's examples (`gpt-oss:120b-cloud`, `gemma4:cloud`). Those run on Ollama's servers, so your code would leave your machine.

## How do you run Claude Code on a local model?

Ollama's [Claude Code page](https://docs.ollama.com/integrations/claude-code) gives a one-line start, `ollama launch claude`, and a manual setup that replaces the Anthropic login with three environment variables:

```
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model <model>
```

This is Ollama's documented setup, not Anthropic's. Anthropic's [LLM gateway page](https://code.claude.com/docs/en/llm-gateway) warns that Claude Code adds capabilities with each release and a gateway that does not forward them "breaks the corresponding features". Ollama's own page says basic chat and file edits work with compatible models, and that hosted web search and advanced tool controls "are not fully supported". Expect gaps, and run `/status` inside Claude Code to confirm which endpoint it is using.

## What does a local model need?

Memory is the limit. The llama.cpp [quantize README](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md) says models "are currently fully loaded into memory", and lists an 8B model at 4.58 GiB in the Q4_K_M format and 7.95 GiB in Q8_0. Quantisation stores each weight in fewer bits so the model fits in less memory, at some cost in quality. The CodeLifter [local models page](https://codelifter.com/local-models/) uses its own rough estimate (parameters times bits divided by 8, times 1.2) and the model sizes it checked on 15 October 2026; by that estimate a 31B model at 4 bits needs about 19 GB.

Quality is the other limit. A small model that fits a laptop will make more mistakes with tool calls and long files than the hosted models these agents were built around. Test on a throwaway branch before you trust it with real work. The [local models prompt thread](/forum/posts/do-the-codelifter-prompts-work-with-local-models/) has the checks we apply to anything a local model writes, and the [coding agents thread](/forum/posts/claude-code-codex-or-copilot-how-do-coding-agents-differ/) compares the three agents on more than price.

## Short version

- Codex CLI runs local models with `codex --oss` and an Ollama or LM Studio server.
- Ollama documents a setup that runs Claude Code against a local model; Anthropic's Free plan does not include Claude Code.
- Copilot Free includes agent mode and Copilot CLI with monthly limits, on hosted models.
- Plan on enough memory to load the whole model, and a 64k context window.
- Skip model names ending in `cloud` if your code must stay on your machine.

## Reply 1 by CodeLifter editors (staff), 2026-10-31

**Is GitHub Copilot free for students?** Yes, for verified students. GitHub's [Copilot plans page](https://docs.github.com/en/copilot/get-started/plans), read on 16 October 2026, lists a Copilot Student plan, "Available to verified students", priced as free, with "an allowance of GitHub AI Credits". It includes the agents column with one exception, "Excludes third-party agents", and like Copilot Free it offers models "through auto model selection only", so you cannot choose a specific model. The same page says verified teachers and "maintainers of popular open source projects may be eligible for free access to Copilot Pro". Two conditions apply to the free tiers: GitHub says Copilot Free plans "are only available to individual developers who don't have access to Copilot through an organization or enterprise", so a school that already provides Copilot changes what you get, and the credit allowance runs out. Copilot is a hosted service, so your code goes to GitHub's models, not a local one. If your course forbids that, or forbids AI help entirely, a free plan does not change the rule; the [thread on whether teachers can tell](/forum/posts/can-a-teacher-tell-if-a-students-code-was-written-by-ai/) covers what is at stake.

## Reply 2 by CodeLifter editors (staff), 2026-11-05

**How much memory do you need to run a local coding model?** Enough to hold the whole model, plus room for its working context. The llama.cpp [quantize README](https://github.com/ggml-org/llama.cpp/blob/master/tools/quantize/README.md) states that "memory and disk requirements are the same" because the model is fully loaded, so the file size is your floor. Its table for an 8-billion-parameter model gives 4.58 GiB at Q4_K_M (about 4.9 bits per weight) and 7.95 GiB at Q8_0 (about 8.5 bits). For a rough figure on other sizes, the CodeLifter [local models page](https://codelifter.com/local-models/) uses parameters times bits per weight divided by 8, then adds 20 percent; that is our estimate, not a vendor figure. One trap: mixture-of-experts models, which activate only part of the network per token, still count in full. Tencent's Hy3 card describes 295B parameters with 21B active, and all of it has to fit. Context needs memory too, and [Ollama's Codex page](https://docs.ollama.com/integrations/codex) asks for "a context window of at least 64k tokens", so load the model at that setting and read your runner's memory report before you start a task, instead of trusting the file size alone.

---
Cite as: CodeLifter Forum, "Can you run a coding agent for free with a local model?", https://codelifter.com/forum/posts/can-you-run-a-coding-agent-for-free-with-a-local-model/, accessed 2026-11-12.
