Free Intensive Nov 21–22Free 2-day hands-on Vibecoding Intensive on Nov 21–22 at 16:00 MSK (Sat–Sun) · Live Cohort 3 starts Nov 23Join Free →Cohort 3 (Nov 23)
ReleaseInsight · On RadarHabr AI→ original

A $1-Ish AI Coding Agent: How to Set Up OpenCode with DeepSeek and Stay Under 60% of Context

You can run your own AI coding agent for roughly 100 rubles. OpenCode is free and works with DeepSeek Flash, a cheap model, and the 100 rubles is the minimum top-up through Alipay. The model's conversation memory holds 1 million tokens, but the fuller it gets, the worse the answers become, so the author advises using no more than 60% (600K). In practice, split the work into small tasks for fresh subagents and clear the session with /clear.

AI-processed from Habr AI; edited by Hamidun News
A $1-Ish AI Coding Agent: How to Set Up OpenCode with DeepSeek and Stay Under 60% of Context
Source: Habr AI. Collage: Hamidun News.
Listen to article
Article Fact Sheet & Key Figures
ParameterDetails
Primary sourceHabr AI ↗
Editor-in-Chief
Key metric #1Russian text uses 38% more tokens than English
Key metric #2The author herself tries not to go above 300K tokens
Key metric #3For Edit and Bash, turn on Ask mode and confirm every command

You can run your own AI coding agent today for about 100 rubles. The figure is approximate: it is the minimum transfer through the Chinese payment service Alipay, which is used to top up the balance for the DeepSeek model. The agent itself, OpenCode, is free and open source, and DeepSeek Flash is the fast, inexpensive model that runs inside it. The second important number in the Habr write-up is 60%. This is the share of the context window, that is, the dialogue's "working memory" (for Flash it is 1 million tokens), that you should not exceed: beyond that, the model starts to think less clearly. The engineering core of the instructions is below.

Cheap start: OpenCode plus DeepSeek

The author opens with a historical analogy. Portraits once cost a lot and took weeks to commission, then the camera came along and anyone could take a picture. With programming, she argues, the same shift is happening: the agent now plays the role of the camera, writing code and doing any task on a computer, from a bot to a financial report. But there is no "make it a masterpiece" button: typing "make it the best" will not produce a finished result.

The setup is simple. OpenCode is available as a terminal app, a web version and a desktop application. You register with DeepSeek, top up the balance by QR code via Alipay, get an API key at platform.deepseek.com, and paste it into the provider settings, selecting the deepseek-flash model. Error 401 means the key is wrong, and 402 means the balance is empty. Alipay requires verification with a foreign passport, and you can top up by transferring through Sber to China using a +7 phone number. These instructions are personal: for work tasks, clear them with your security department first.

You can even start for free: OpenCode offers free models. But they are often time-limited, and some use your data to improve their models, so for real work the paid DeepSeek option is better.

Agents, commands and control

You do not have to write agents by hand. It is enough to ask the main agent in the chat, for example, "Create a Finance subagent; it is a financial analyst and calculates only with scripts." OpenCode creates the file .opencode/agents/finance.md, and the subagent can then be called with @finance. Project-wide rules live in AGENTS.md, and the agent reads that file at the start of every session, so it does not "forget" who you are. You can chain several agents together with a command: a file in .opencode/commands runs a sequence such as "analyst, then programmer, then tester" with a single /audit input.

Three things guard against the agent going off on its own: the Questions panel, where the agent asks clarifying questions before starting work; the To-do panel, a checklist of steps; and the Permission setting. If you set Ask for Edit and Bash, the agent will request permission for every file change and every command. The author warns candidly that agents do read instructions, but sometimes the drive to finish the task wins out, so real control comes from Permission, not from hoping for obedience.

Context: why 60%, not 100%

The most useful part of the write-up concerns context. By default, OpenCode remembers nothing between sessions, and subagents work in isolated spaces. The model has a "smart zone" at the start of the context and a "dumb zone" as the context grows: attention blurs, like trying to follow one speaker in a room where a hundred people are talking at once. That is why the author calls Flash's 1-million-token window not a reserve of intelligence but a large space for mistakes. Her recommendation is to stay under 60%, that is, under 600K tokens, and she herself tries not to get anywhere near 300K.

This leads to practical rules:

  • Break large tasks into small ones and give each one to a fresh subagent.
  • Prefer /clear over compressing the history. After compression a residue remains: it is unclear what was kept, and old data can mislead the model. /clear gives you a clean window with the system prompt.
  • Keep the system prompt, AGENTS.md and agent descriptions short: everything that is always in context occupies that smart zone.
  • Write these instructions in English: Russian text takes about 38% more tokens. You can discuss the task with the agent in Russian, then ask it to translate the prompt into English and save it.
  • Anything that can be codified, write as Python scripts: the model itself is poor at calculation.

Limitations

This is a personal guide, not a quality measurement: figures such as 60% and 300K are the author's practical rules of thumb, not benchmark results. The Alipay payment route depends on your bank and regional access, and the 100-ruble figure changes with the minimum transfer amount. The main takeaway for developers and product managers: the cost and quality of an agent's work depend on context discipline at least as much as on the choice of model. Short persistent instructions, isolated subagents and regular session clearing deliver more than switching to a more expensive model.

Story

Key Questions Answered

What are the key details on Cheap start: OpenCode plus DeepSeek?

The author opens with a historical analogy. Portraits once cost a lot and took weeks to commission, then the camera came along and anyone could take a picture. With programming, she argues, the same shift is happening: the agent now plays the role of the camera, writing code and doing any task on a computer, from a bot to a financial report. But there is no "make it a masterpiece" button: typing "make it the best" will not produce a finished result. The setup is simple.

What are the key details on Agents, commands and control?

You do not have to write agents by hand. It is enough to ask the main agent in the chat, for example, "Create a Finance subagent; it is a financial analyst and calculates only with scripts." OpenCode creates the file .opencode/agents/finance.md, and the subagent can then be called with @finance. Project-wide rules live in AGENTS.md, and the agent reads that file at the start of every session, so it does not "forget" who you are.

What are the key details on Context: why 60%, not 100%?

The most useful part of the write-up concerns context. By default, OpenCode remembers nothing between sessions, and subagents work in isolated spaces. The model has a "smart zone" at the start of the context and a "dumb zone" as the context grows: attention blurs, like trying to follow one speaker in a room where a hundred people are talking at once. That is why the author calls Flash's 1-million-token window not a reserve of intelligence but a large space for mistakes.

ZK
Zhemal Khamidun — CPO at Alpina Digital, product manager of AlpinaGPT. Building AI products since 2019. Hamidun News is a pet project that grew into a production aggregator with 6,000+ readers.
✦ Unified AI Workspace · Nomad

Test Frontier LLMs & Autonomous Agents in One Workspace

Run Claude Opus 5.5, GPT-6, Gemini 3.1, and DeepSeek side-by-side in Nomad AI (nomadnet.ai) — unified model routing, deep research, and multimodal workflows under one subscription.

Try Nomad AI →Launch Nomad Agent
What do you think?
Loading comments…