Is Claude Code free? What it costs, and how to run it for free or for less
Claude Code is free to install, but running it on Claude needs a paid plan or an API key. The free and cheap options: local models with Ollama, or other providers.


The short answer
Installing Claude Code costs nothing, but running it on Anthropic's models does: the free Claude plan doesn't include Claude Code, so you need Pro or a higher plan, or an API key billed per token. To spend nothing, run it on a model you host yourself with Ollama; to spend less, point it at a cheaper provider's model. Both work because Claude Code can talk to any Anthropic-compatible endpoint, but neither is Claude, so expect weaker results on hard tasks.
| Option | What you pay | Good to know |
|---|---|---|
| Claude Pro or higher | From $20 a month | Claude models, within the plan's 5-hour and weekly limits |
| Anthropic API key | Per token | No plan limit; the bill grows with use |
| Local model with Ollama | Nothing but your own hardware | Needs a model with tool calling and a 64k+ context; slower and weaker than Claude on most machines |
| Ollama cloud models | Your Ollama account | Larger models without downloading them; some hosted tools aren't fully supported |
| DeepSeek, Kimi or GLM | Their per-token prices | Each publishes an Anthropic-compatible endpoint for Claude Code |
Article · Claude Code pricing: what each plan costs, what the API costs, and paying only for what you use → What each Claude plan and the API cost for Claude Code.
Run Claude Code on a local model with Ollama
Ollama serves local and cloud models through an Anthropic-compatible API, and has a launcher for Claude Code. Install Ollama, pull a model that supports tool calling, then start Claude Code through it:
# the launcher picks a model and starts Claude Code
ollama launch claude
# or set the endpoint yourself
export ANTHROPIC_AUTH_TOKEN=ollama
export ANTHROPIC_API_KEY=""
export ANTHROPIC_BASE_URL=http://localhost:11434
claude --model qwen3.5- For larger repositories, set the model's context length to 64k or more.
- Settings in Claude Code's settings files override your shell variables. If it still talks to Anthropic, check the
envblock there, then run/statusto see the connection. - For a script or CI,
ollama launch claude --model <model> --yes -- -p "…"skips the pickers and passes the rest to Claude Code.
Pay less with another provider's model
DeepSeek, Moonshot (Kimi) and Z.ai (GLM) each publish an Anthropic-compatible endpoint and the environment variables to point Claude Code at it. You keep Claude Code's tools and workflow and pay their per-token prices. Set the variables in one shell to try it, since putting them in your settings changes Claude Code everywhere.
Article · Use DeepSeek in Claude Code and Codex: the official setup, and a per-session switch → DeepSeek in Claude Code and Codex, from DeepSeek's own guides.
Article · Use Kimi and GLM models in Claude Code and Codex → Kimi and GLM models in Claude Code and Codex.
Any of these, per session, in Mirasim
Mirasim's free plan includes the whole local workspace, and sessions that run on your own accounts, API keys or local models use no Mirasim credit. Instead of editing environment variables, you choose the model for each session, so one Claude Code session can run on a local model while the next uses Claude.
- Local models: Mirasim detects Ollama (and mlx-lm on macOS), can start the backend and pull models, and adds it as a model provider.
- Other providers: add an endpoint and key in Settings › Models; any OpenAI-compatible endpoint works, including OpenRouter, and Mirasim translates between protocols so Claude Code can use it.
- Then set the session's “Paying with” to “API key” and pick the model.
- Or stay on Claude models on Mirasim credit, charged per use: Opus 5.5 50% off, Sonnet 5.5 50% off off the official API price.
Chapter 16 · Models, accounts and quota › Local models → Local models in Mirasim: Ollama and mlx-lm.
Questions
- Can I use Claude Code without a Claude subscription?
- Yes. Sign in with an Anthropic API key and pay per token, or point it at another endpoint such as Ollama, DeepSeek, Kimi or GLM.
- Does Claude Code work with Ollama?
- Yes. Ollama provides an Anthropic-compatible API and
ollama launch claude. Pick a model that supports tool calling; basic chat and file edits work with compatible models. - Do Claude-only features still work on another model?
- Claude Code's own tools, such as reading and editing files and running commands, keep working with compatible models. Features that rely on Anthropic's service, such as Remote Control, need Claude Code talking to api.anthropic.com.
Article · Claude Code Remote Control, and other ways to use Claude Code from your phone → Remote Control, and what it needs.
Article · Is Codex free? What the free plans include, and how to run Codex on local models → The same question for Codex.
Sources
Checked on November 27, 2026 against claude.com/pricing, Anthropic's Claude Code documentation (code.claude.com/docs, Manage costs effectively) and Ollama's Claude Code guide (docs.ollama.com/integrations/claude-code). Check those pages for current plans and setup.
Keep reading

Claude Code login: how to sign in, switch accounts, and fix login problems
How to log in to Claude Code with a Claude plan, the Console or an API key, which credential wins, how to keep several accounts, and fixes for common login errors.

Claude Code pricing: what each plan costs, what the API costs, and paying only for what you use
Claude Code comes with Claude Pro, Max, Ultra, Team and Enterprise, or runs on an API key per token. What each costs, what developers spend, and how to spend less.

Codex and Claude Code over SSH: run them on a remote server, and keep them running
How the ChatGPT desktop app and Claude Desktop connect to SSH hosts, how to run the CLIs on a server yourself, sign in without a browser, and keep them running.