How to use a coding agent without another subscription
By Flavio
Updated
Tagged: AI
Connect OpenCode to DeepSeek or Ollama, understand API billing and local hardware costs, and test whether the setup works for your projects.
You don’t need a monthly subscription to use a coding agent. You can install an open source agent, plug in a model provider, and pay only for what you use. Or you can run a model on hardware you already own, using something like LM Studio Bionic if you want a project interface around it.
The agent and the model are two separate pieces. OpenCode is the interface that reads your files and runs tools, while DeepSeek or Ollama supplies the model that generates the answers.
Splitting them up gives you control over how you pay, and lets you judge whether a model finishes your tasks well enough to be worth the cost. Here, we’ll focus on getting the tools wired up and understanding how the billing works.
If you want a quick refresher on which account handles model usage in different coding tools, check the subscription vs API key glossary entry.
Decide where the model runs
With a hosted API, your computer runs the agent and the provider runs the model. Every prompt, along with whatever project files the agent pulls in, goes out to that provider.
With a local model, your machine handles both jobs. You’ll need enough RAM for the model plus its working context, and big repos or long threads push that memory usage up fast.
Ollama works both ways. An ollama command can point straight to a remote cloud model, so check the model tag before assuming everything stays on your machine.
If you’re working on a private codebase, decide upfront which files you’re fine sending to a provider. Even when the model runs locally, check what your agent’s tools can do: anything that fetches a URL still makes a network request.
Connect OpenCode to DeepSeek
First, install OpenCode using any of the options in the OpenCode tutorial. With npm, you can install the CLI like this:
npm install -g @opencode/cli
Next, open a small Git repo with a clean starting commit and start OpenCode:
opencode
If you still have an older v1 install on your PATH, opencode might launch that instead. The v2 release also runs as opencode2, and which opencode shows which binary your shell picks up.
Inside OpenCode, run /connect, pick DeepSeek, and paste in an API key from your DeepSeek account. Then run /models and choose the Flash model. You can see the full connection steps in OpenCode’s provider guide.
Keep that API key inside the provider connection. Never paste it into a chat prompt or commit it to a project config file.
DeepSeek’s model table lists deepseek-flash as the API name for DeepSeek-V4.1-Flash. Pick the official catalog entry instead of guessing a model ID from a social post.
Start with a small, focused prompt:
Find the function that calculates an order total.
Explain its behavior for an empty order.
Do not change any files yet.
From there, ask for one test and the smallest change that gets it passing. Read the diff and run the test yourself to confirm your account, model, and agent tools are all working together.
Understand what the API bill measures
API billing counts the tokens you send to the model and the tokens it sends back. A single coding task can trigger many requests under the hood, because one short prompt often pulls in source files, command output, and a few rounds of fixes.
DeepSeek splits pricing into cached-input, uncached-input, and output rates, with peak and off-peak windows. At peak rates, Flash costs $0.30 per million uncached input tokens and $1.20 per million output tokens. Check the current pricing table before you add credit.
Say a task uses one million uncached input tokens and 100,000 output tokens at peak rates. That comes out to $0.42 for that task, or $21 across fifty similar ones. Those numbers assume that exact token volume and leave out any other services you pay for, so expect your own bill to move with your repo size and how many rounds of fixes the agent needs.
A subscription gives you a predictable monthly fee with its own usage caps, while API billing moves directly with your token count. Either way, what matters is how many working changes you get out of it. Here’s a quick look at how that breaks down:
Use Ollama with a cloud model
Install Ollama, sign in when prompted for cloud access, and start the integration:
ollama launch opencode
The launcher lets you pick a model. If you want to jump straight into Muse Spark Open through Ollama Cloud, Ollama lists a direct launch command in its official model catalog:
ollama launch opencode --model muse-spark-open:cloud
The :cloud tag means the model runs remotely, so you’re not downloading the model weights onto your laptop. Check Ollama’s cloud documentation and current plans for account access and usage terms, since Ollama Cloud has its own pricing separate from the DeepSeek API rates above.
Ollama’s launcher handles the connection setup for you. If your local tools don’t match what’s documented, check the OpenCode integration guide instead of copying manual config from an older tutorial.
Run a local model instead
That same integration guide works with local models and calls for a context window of at least 64k. Pick a model your machine can handle with a 64k context window, keeping in mind that the RAM you need will be higher than the model’s download size.
If you’ve never run a local model before, start with my Ollama introduction to get Ollama installed, pull a model, and test local API requests. Once that’s working, pick the model inside the coding integration.
Running locally skips per-token API charges, though you’re still paying for hardware, electricity, and the time you spend waiting on your machine. Buying a new computer just to dodge a small API bill takes a long time to pay for itself.
Before you change your daily workflow, try the same small task on each setup with the same starting code, prompt, and tests. Write down what you spent, how long it took, how many tries failed, and how much you had to fix by hand. A setup that lands a clean patch in your own repo is a much better reason to switch than someone else’s demo.
Want me to talk about your product? You can sponsor this site.
Related posts about ai: