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
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.
- Nov 21, 2026Free Claude Code Runs Claude Code on DeepSeek and Qwen: 60+ Providers, 68,000 Stars
- Nov 21, 2026GPT-4o Pulled After 13 Lawsuits: AI Ethics Is Sold With the Model, and It Costs Dearly
- Nov 21, 2026Linger Runs 12 AI Models on Your PC: Up to 5x Faster and $0 in Token Costs
- Nov 21, 2026Claude Opus 5.5 Picked a School in Iran as a Military Target in 22 of 32 Tries. OpenAI Models Never Did.
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.
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.
The AI world, distilled — once a week
Seven stories that actually mattered, hand-picked. No noise, no reposts, no press releases.
Done! Check your inbox for a confirmation.