How to Get Unlimited Free AI Coding in Your Terminal & VS Code (No Subscription Required) with OpenCode, Ollama, and DeepSeek.
How to Use OpenCode + Ollama + DeepSeek for Free (Unlimited AI Coding)
If you have been using the open-source OpenCode AI coding agent in your terminal or VS Code, you have probably run into this frustrating error:
Error: Free usage limit reached. Free models work in OpenCode; subscribe to OpenCode Go to keep going.
While OpenCode itself is 100% free and open-source, its complimentary cloud-hosted models carry strict daily caps. Luckily, you don't need a paid subscription to bypass this. By pairing OpenCode with Ollama and running DeepSeek locally on your machine, you can unlock completely free, unlimited agentic coding.
Here is a step-by-step guide to setting it up in your terminal and IDE.
Prerequisites
- OpenCode installed (via Terminal or VS Code Extension).
- A computer with a decent processor. (8GB RAM can run 1.5B/7B models; 16GB+ RAM is ideal for 7B+ models).
Step 1: Install Ollama
Ollama allows you to run powerful large language models locally on your hardware.
-
Open your terminal and run the installation command for your operating system:
- Mac or Linux:
curl -fsSL https://ollama.com | bash
-
Windows: Download the installer directly from ollama.com.
- Verify it's working by opening a new terminal window and typing:
ollama --version
Step 2: Download the DeepSeek Coding Model
DeepSeek offers exceptional code-generation models that rival massive commercial alternatives. We will download a coding-specific variant.
In your terminal, run the following command to download and start the model:
ollama run deepseek-coder:7b
💡 Hardware Tip: If your machine lacks a dedicated graphics card (GPU) or has less than 16GB of RAM, download the lighter, faster version instead:
ollama run deepseek-coder:1.3b
Keep this terminal window open while Ollama finishes downloading the model weights. Once it displays a >>> prompt, your local model server is officially running at http://localhost:11434.
Step 3: Configure OpenCode to Use Your Local Model
Now we just need to redirect OpenCode away from its rate-limited cloud servers and point it toward your machine.
Option A: Using OpenCode in the Terminal
When launching a new OpenCode agent session in your workspace, simply pass the local model flag targeting your Ollama instance:
opencode --model ollama/deepseek-coder:7b
(Swap 7b for 1.3b if you downloaded the smaller version).
If you want to make this your permanent default so you don't have to type the flag every time, run:
opencode config
Follow the interactive prompt to switch your primary AI provider to Local/Ollama and specify your model.
Option B: Using the OpenCode VS Code Extension
If you prefer coding inside your IDE layout, configure the extension settings directly:
- Open VS Code and open your Settings (
Ctrl + ,on Windows/Linux orCmd + ,on macOS). - Search the settings bar for OpenCode.
- Locate the Model Provider dropdown and change it from
OpenCode Free CloudtoOllama(orLocal). - In the Model Name input field, type exactly:
deepseek-coder:7b(ordeepseek-coder:1.3b).
Conclusion
That’s it! Your AI coding agent is now completely self-hosted. OpenCode will orchestrate your files, execute terminal commands, and debug your application using DeepSeek's intelligence all powered entirely by your local machine. No limits, no subscriptions, and complete privacy for your code.
Happy hacking!
Tags: opencode deepseek ollama abdulsalamamtech agent coding
Top comments (0)