Guides Coding

Best Free LLMs for Coding, and How to Use Them in Claude Code, Codex and Cursor

F
Free-LLM Editorial Team
• Updated: November 4, 2026 • 10 min read

You don't need a paid plan to get a good coding assistant. Several free APIs now serve models that handle tool calls, long files and multi-step edits well, and most coding tools let you plug them in. This guide lists the models worth using, where they're free today, and the exact settings for each tool. It also fixes the most common mistake people make with Claude Code.

The best free coding models right now

ModelFree onWhy it's good
GPT-OSS 120BGroq, Cloudflare, OVH, Inferbase, Cerebras (card)Reliable tool calling, very fast on Groq, available almost everywhere so easy to fall back
Kimi K2.7 CodeCloudflare Workers AI, Api.Airforce, InferbaseMoonshot's coding-tuned model, 262K context
GLM-5.3 FlashNVIDIA NIM, Cloudflare, FreeInference, Zro, LLM71M context, strong agentic coding, works in Claude Code via FreeInference
CodestralMistral (Experiment plan), LLM7Built for code, supports fill-in-the-middle for autocomplete
Qwen3.8 27BGroq, Cloudflare, Hetzner, OVH, localBest quality per GB; the default local coding model this year
Nemotron 3 Ultra / 3.5 LightningOpenRouter, Kilo, NVIDIA NIM1M context for whole-repo questions
Cohere North Mini CodeOpenRouter, Kilo, Cohere (trial key)Small agentic coding model, 256K context
Flint 40BOpenRouter, Ollama (local)New 40B MoE (2.5B active) for coding agents, runs on a laptop
Mistral Large 4NVIDIA NIM, Mistral (preview)Frontier-size open model, 1M context

Free tiers change every few weeks. Each name links to a provider page that shows today's free model list and limits.

Claude Code: the right way

Claude Code speaks Anthropic's Messages API (/v1/messages). If you set ANTHROPIC_BASE_URL to an OpenAI-style address like https://api.groq.com/openai/v1, requests fail. You have two options.

1. A provider with a native Anthropic endpoint

  • OpenRouter: https://openrouter.ai/api
  • Z.AI: https://api.z.ai/api/anthropic (GLM Flash models are free)
  • FreeInference: https://freeinference.org/anthropic
  • Ollama (local): http://localhost:11434, or simply ollama launch claude
  • LM Studio (local): http://localhost:1234
export ANTHROPIC_BASE_URL="https://openrouter.ai/api"
export ANTHROPIC_AUTH_TOKEN="sk-or-v1-your_key"
export ANTHROPIC_API_KEY=""
export ANTHROPIC_MODEL="nvidia/nemotron-3-ultra-550b-a55b:free"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="nvidia/nemotron-3.5-lightning:free"
claude

Set ANTHROPIC_MODEL every time. Without it Claude Code asks for its own model names, which other providers reject.

2. An OpenAI-only provider behind a proxy

For Groq, Cerebras, NVIDIA NIM, Mistral, Cloudflare and most gateways, run LiteLLM locally. It accepts Claude Code's requests and forwards them in OpenAI format:

cat > litellm.yaml <<'EOF'
model_list:
  - model_name: "gpt-oss-120b"
    litellm_params:
      model: "openai/openai/gpt-oss-120b"
      api_base: "https://api.groq.com/openai/v1"
      api_key: "os.environ/GROQ_API_KEY"
EOF
uvx --from 'litellm[proxy]' litellm --config litellm.yaml --port 4000 &

export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="sk-local"
export ANTHROPIC_MODEL="gpt-oss-120b"
claude

claude-code-router does the same job with a web UI (npm i -g @musistudio/claude-code-router, then ccr ui). Our setup generator builds either config for any provider in the directory, and the full walkthrough lives in our GitHub repo.

Codex CLI

Register the provider in ~/.codex/config.toml. Free providers use the Chat Completions API, so set wire_api = "chat":

model_provider = "groq"
model = "openai/gpt-oss-120b"

[model_providers.groq]
name = "Groq"
base_url = "https://api.groq.com/openai/v1"
env_key = "GROQ_API_KEY"
wire_api = "chat"

Cursor, Cline, Aider, OpenCode

  • Cursor: Settings → Models → enable "Override OpenAI Base URL", paste the provider's URL and key, then add the model id (for example openai/gpt-oss-120b on Groq).
  • Cline (VS Code): API Provider "OpenAI Compatible", then base URL, key and model id. It also has native OpenRouter, Mistral and Ollama options.
  • Aider: export OPENAI_API_BASE=… OPENAI_API_KEY=…, then aider --model openai/<model-id>.
  • OpenCode: set the provider's key (GROQ_API_KEY, OPENROUTER_API_KEY…) or run /connect in the TUI.

The setup page generates all of these for any provider.

Make free coding agents actually usable

  1. Pick for rate limits, not only quality. An agent sends many requests a minute. OpenRouter's 50 free requests a day disappear in one session; Groq's 1,000 a day or a local model go much further.
  2. Keep two providers configured. When one returns 429, switch. Our fallback guide shows how to automate it.
  3. Use a small model for small jobs. Point Claude Code's "haiku" slot (ANTHROPIC_DEFAULT_HAIKU_MODEL) at a fast free model so background tasks don't eat your main quota.
  4. Mind your code's privacy. Several free routes log prompts or use them for training. For private repos, run a local model with Ollama.
  5. Avoid "free Claude" key pools. Sites that sell Claude or GPT at 80% off, or give it away, are reselling shared accounts. They break the providers' terms and see all your code.

FAQ

What is the best free LLM for coding?

For hosted use, GPT-OSS 120B (free on Groq, Cerebras, Cloudflare and others), Kimi K2.7 Code (free on Cloudflare Workers AI), GLM-5.3 Flash (free on NVIDIA NIM, Cloudflare and FreeInference) and Codestral (free on Mistral's Experiment plan) are the strongest free options in November 2026. For local use, Qwen3.8 27B and Flint 40B are the usual picks.

Can I use Claude Code for free?

Claude Code itself is free to install, and you can point it at a free model. It needs an Anthropic-compatible endpoint: OpenRouter, Z.AI, FreeInference, Ollama and LM Studio have one. For OpenAI-only providers such as Groq or NVIDIA NIM, run a small proxy like LiteLLM or claude-code-router.

Why does Claude Code fail with my Groq or Mistral URL?

Claude Code sends Anthropic Messages API requests to /v1/messages. OpenAI-style base URLs only understand /chat/completions, so you get 404 or schema errors. Use a provider with a native Anthropic endpoint, or a translation proxy.

Which free coding model has the longest context?

GLM-5.3 Flash, DeepSeek V4 Flash and Nemotron 3 Ultra offer 1M-token context on free tiers (NVIDIA NIM, FreeInference, OpenRouter). Gemini 3.8 Flash on Google AI Studio also has 1M tokens.

Related: what changed in November 2026, best free LLM APIs, and the full list of free API keys.