# How to use a coding agent without another subscription

> Connect OpenCode to DeepSeek or Ollama, understand API billing and local hardware costs, and test whether the setup works for your projects.

Author: [Flavio Copes](https://flaviocopes.com/about/) | Published: 2026-10-22 | Topics: [AI](https://flaviocopes.com/tags/ai/) | Canonical: https://flaviocopes.com/coding-agents-without-subscription/

You can use a coding agent without paying a monthly subscription for it. Install an open source agent, connect a model provider, and pay for the model usage. Alternatively, run a model on hardware you already own.

The agent and the model are separate pieces. [OpenCode](https://flaviocopes.com/opencode/) provides the interface, reads your project, and runs tools. DeepSeek or a model served through Ollama generates the responses.

That gives you more control over how you pay. It also gives you something to evaluate: whether the model finishes your tasks well enough to justify its total cost.

I haven't run a comparison of these models on my projects. This guide explains the setup and the billing choices using their official documentation. It doesn't rank them by coding quality.

## Decide where the model runs

With a hosted API, your computer runs the agent while a provider runs the model. The provider receives the prompts and any project content the agent includes in those requests.

With a local model, your computer does both jobs. You need enough memory for the model and its working context. Large repositories and long conversations make that context more demanding.

Ollama supports both arrangements. An Ollama command can call a cloud model, so seeing `ollama` in a command doesn't establish that the work stays on your machine.

For a private project, decide which files you can send to a provider before connecting the agent. Keeping inference local also requires checking the rest of the setup: a tool that fetches a URL still makes a network request.

## Connect OpenCode to DeepSeek

Install OpenCode using one of the methods in the [OpenCode tutorial](https://flaviocopes.com/opencode/). If you use npm, the current CLI installs with:

```bash
npm install -g @opencode/cli
```

Open a small Git repository with a clean starting commit, then run:

```bash
opencode
```

Inside OpenCode, enter `/connect`, select DeepSeek, and provide an API key from your [DeepSeek account](https://platform.deepseek.com/). Then enter `/models` and choose the Flash model available through that provider. OpenCode documents this connection workflow in its [provider guide](https://opencode.ai/v2/docs/providers/).

Keep the key in the provider connection. Don't paste it into a prompt or commit it in a project configuration file.

DeepSeek's [model table](https://api-docs.deepseek.com/quick_start/pricing/) identifies `deepseek-flash` as the API name for DeepSeek-V4.1-Flash, checked on October 16, 2026. Pick the supported catalog entry rather than guessing a model ID from a social post.

Start with a bounded request:

```text
Find the function that calculates an order total.
Explain its behavior for an empty order.
Do not change any files yet.
```

Then ask for one test and the smallest necessary change. Review the diff and run the test yourself. This first task should establish that your account, selected model, and agent tools work together.

## Understand what the API bill measures

API billing depends on tokens sent to the model and tokens generated by it. An agent can make many requests during one task. A short instruction can lead to a long session containing source files, command output, and repeated repairs.

DeepSeek lists separate cached-input, uncached-input, and output rates, with peak and off-peak pricing. Its Flash peak rates on October 16, 2026 were $0.30 per million uncached input tokens and $1.20 per million output tokens. Check the [current pricing table](https://api-docs.deepseek.com/quick_start/pricing/) before adding credit.

For an illustration, a task using one million uncached input tokens and 100,000 output tokens at those peak rates costs $0.42. Fifty such tasks cost $21. This is arithmetic using an assumed workload, not a measured average task or a monthly forecast. It excludes separately billed services.

A subscription gives you a recurring price with its own usage rules. API billing gives you a variable bill. Neither tells you how many correct changes you will finish.

## Use Ollama with a cloud model

Install [Ollama](https://ollama.com/download), follow its sign-in prompts for cloud access, then launch the integration:

```bash
ollama launch opencode
```

The launcher lets you choose a model. Ollama also publishes a direct launch command for Muse Spark Open in its [official model catalog](https://ollama.com/library/muse-spark-open):

```bash
ollama launch opencode --model muse-spark-open:cloud
```

Here, `:cloud` means the model runs remotely. You aren't downloading the model weights to your laptop. Review Ollama's [cloud documentation](https://docs.ollama.com/cloud) and [current plans](https://ollama.com/pricing) for account access and usage terms. Cloud access through Ollama has its own billing arrangement; it doesn't inherit the DeepSeek API rates above.

Ollama's launcher handles the connection setup. If your installed tools differ from the documented integration, check the [OpenCode integration guide](https://docs.ollama.com/integrations/opencode) before copying a manual configuration from an older tutorial.

## Run a local model instead

The same integration guide supports local models and calls for a context window of at least 64k. Choose a model your machine can run with that context allocation. The download size alone doesn't tell you the total memory requirement.

My [Ollama introduction](https://flaviocopes.com/ollama-local-llm/) explains installation, model downloads, and local API requests. Start there if you haven't run a local model before, then select it in the coding integration.

Local inference avoids a provider's per-token charge for those requests. You still pay for hardware and electricity, and you wait for the machine to finish. Buying a new computer solely to avoid a small API bill needs a longer calculation.

Before changing your normal workflow, try the same small task on each setup. Keep the starting code, instructions, and tests the same. Record the actual bill, elapsed time, failed attempts, and how much correcting you had to do. A setup that produces a usable patch on your project is a better reason to switch than someone else's successful demo.
