Skip to content
OPQAI.
Sourced intermediate / 💻 Coding

Continue AI Coding with Local Models When Claude Code Quota Runs Out

Job to be done: Continue AI coding when cloud LLM quotas are exhausted by switching to local models

🇳🇬 Ways to use this in Nigeria

Ideas to get you started, adapt to your situation.

  • Student

    Continue coding assignments using a local AI model when Claude Code quota runs out, avoiding data costs.

  • 9-5 employee

    Keep writing code for work projects without interruption by switching to a local AI model after hitting cloud LLM limits.

  • Entrepreneur

    Develop product features using a local AI coder when paid cloud services exceed budget or quota.

What you’ll get

A way to keep coding with Claude Code even after you hit its usage limit, by pointing it at a free AI model running on your own computer instead of Anthropic’s cloud. When your quota resets, you switch back. This keeps you in flow without paying for more cloud usage. It is intermediate: you will use a terminal and set a couple of environment variables, but it is a short, repeatable setup.

Tools you need

  • Claude Code (paid): the AI coding tool you already use. It normally talks to Anthropic’s cloud, but you can redirect it.
  • LM Studio (free): a friendly desktop app to find, download, and run open-source AI models locally, and to serve them so Claude Code can connect.
  • Llama.cpp (free) and Ollama (free): alternative ways to run local models, if you prefer them to LM Studio.

Steps

  1. Check your Claude Code usage: see how much quota is left before you run dry. In the Claude Code terminal:

    /usage

    You should see your current usage, so you can anticipate hitting the limit.

  2. Install and open LM Studio: download it for your system from lmstudio.ai and launch it. You should see its interface with a model search.

  3. Download a local coding model: search LM Studio for an open-source coding model (the author suggests options like GLM-4.7-Flash or a Qwen coding model). Pick a “quantized” version (a smaller, compressed model that runs faster and uses less memory, with a slight quality trade-off) and download it.

  4. Start LM Studio’s local server: this makes the model available for other tools to use. In a terminal:

    lms server start --port 1234

    You should see it report that the server is listening on port 1234. (A “port” is just a numbered door on your computer that programs use to talk to each other.)

  5. Point Claude Code at the local server: in the same terminal, set two environment variables (settings for this terminal session) so Claude Code calls your local server instead of the cloud.

    # macOS or Linux
    export ANTHROPIC_BASE_URL=http://localhost:1234
    export ANTHROPIC_AUTH_TOKEN=lmstudio
    # Windows (PowerShell)
    $env:ANTHROPIC_BASE_URL = "http://localhost:1234"
    $env:ANTHROPIC_AUTH_TOKEN = "lmstudio"

    There is no visible output; the settings are now active for this terminal.

  6. Launch Claude Code on the local model: still in the same terminal:

    claude --model openai/gpt-oss-20b

    Claude Code should start, now using your local model. Expect it to feel slower and a bit less polished than the cloud.

  7. Confirm or switch back: check which model is active (and switch back to the cloud once your quota resets) with:

    /model

Original source

Based on a blog post by Tim Plaisted, shared by fugu2 on Hacker News, explaining how to redirect Claude Code to local open-source models when your cloud quota is spent.

Notes & variations

  • Free-tier alternatives: instead of LM Studio you can serve a model with Llama.cpp directly, or use Ollama, which is often the simplest to set up (especially on macOS).
  • Common mistake: expecting cloud-level speed and quality from a local model. Smaller or quantized models are slower and rougher; adjust your expectations and use them for the simpler tasks.
  • Tip for better results: the best local coding model changes often. Check communities like Hugging Face or r/LocalLLaMA for current recommendations, and try a few quantized versions to find what runs well on your machine.

Keep going

More Coding workflows