{"id":191,"date":"2026-10-07T09:17:26","date_gmt":"2026-10-07T05:17:26","guid":{"rendered":"https:\/\/demensdeum.com\/blog\/2026\/10\/07\/opencode-deepseek\/"},"modified":"2026-10-07T09:17:26","modified_gmt":"2026-10-07T05:17:26","slug":"opencode-deepseek","status":"publish","type":"post","link":"https:\/\/demensdeum.com\/blog\/2026\/10\/07\/opencode-deepseek\/","title":{"rendered":"Installing OpenCode and connecting DeepSeek"},"content":{"rendered":"<p>OpenCode is an open programming agent that lives right in the terminal. It can read project files, edit code, run commands and tests, search the repository and work with git &#8211; about the same thing that Claude Code and other console agents do. The main difference is that OpenCode is not tied to one model provider: dozens of providers can be connected through it, including DeepSeek. In this post I will describe installing the agent and connecting DeepSeek to it.<\/p>\n<h2>What you need<\/h2>\n<p>You only need two things to work:<\/p>\n<ul>\n<li><b>Modern terminal.<\/b> WezTerm, Alacritty, Ghostty, Kitty or any other will do.<\/li>\n<li><b>API key of the provider.<\/b> In our case, DeepSeek.<\/li>\n<\/ul>\n<p>Node.js is not required if you install the agent with a standard installation script &#8211; the binary arrives ready-made.<\/p>\n<h2>Installation<\/h2>\n<p>The easiest way is the official installation script:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>curl -fsSL https:\/\/opencode.ai\/install | bash\n<\/code><\/pre>\n<\/div>\n<p>It will detect the platform itself and put the executable file in PATH. After installation, you should check that everything is in place:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>opencode --version\n<\/code><\/pre>\n<\/div>\n<p>If the command displays the version, the installation was successful.<\/p>\n<h2>Installation using other methods<\/h2>\n<p>If you prefer package managers, there are several options. Via Node.js:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>npm install -g opencode-ai\n<\/code><\/pre>\n<\/div>\n<p>Bun, pnpm and Yarn can do the same:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>bun install -g opencode-ai\npnpm install -g opencode-ai\nyarn global add opencode-ai\n<\/code><\/pre>\n<\/div>\n<p>macOS and Linux have Homebrew. Please note: it is tap from the developers that is recommended, and not the official formula &#8211; it is updated less frequently:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>brew install anomalyco\/tap\/opencode\n<\/code><\/pre>\n<\/div>\n<p>On Arch Linux:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>sudo pacman -S opencode\nparu -S opencode-bin\n<\/code><\/pre>\n<\/div>\n<p>The first command installs the stable version from the repository, the second &#8211; the latest one from the AUR.<\/p>\n<h2>Installation on Windows<\/h2>\n<p>In Windows, it is recommended to work via WSL: this way the performance is higher and the compatibility with the agent\u2019s capabilities is complete. But there are also native methods. Via Chocolatey, Scoop or npm:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>choco install opencode\nscoop install opencode\nnpm install -g opencode-ai\n<\/code><\/pre>\n<\/div>\n<p>There is also an option through Mise, as well as a Docker container:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>mise use -g github:anomalyco\/opencode\ndocker run -it --rm ghcr.io\/anomalyco\/opencode\n<\/code><\/pre>\n<\/div>\n<p>Finally, the finished binary can always be taken from the releases page on GitHub.<\/p>\n<h2>DeepSeek key<\/h2>\n<p>The key is created in your DeepSeek personal account. Go to platform.deepseek.com, open the section with API keys and click create a new key. It is better to save the resulting string immediately: it will be shown only once.<\/p>\n<h2>DeepSeek connection<\/h2>\n<p>Then everything is done inside the agent itself. Launch OpenCode in the terminal:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>opencode\n<\/code><\/pre>\n<\/div>\n<p>In the interface we execute the connection command:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>\/connect\n<\/code><\/pre>\n<\/div>\n<p>In the list of providers that opens, look for <b>DeepSeek<\/b>, select it and insert the API key. Keys added in this way are saved to a file:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>~\/.local\/share\/opencode\/auth.json\n<\/code><\/pre>\n<\/div>\n<p>After connecting, all that remains is to select the model with the command:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>\/models\n<\/code><\/pre>\n<\/div>\n<p>DeepSeek models will be available in the list, including <b>deepseek-v4-pro<\/b>, <b>deepseek-flash<\/b> and <b>deepseek-v4-flash<\/b>. For routine work in the repository, the flash option is sufficient; For complex tasks, it makes sense to switch to pro.<\/p>\n<h2>Configuration via config<\/h2>\n<p>If you don\u2019t want to store the key through a master or need to set your own API address, the provider is described directly in the <b>opencode.json<\/b> configuration file:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>{\n  \"$schema\": \"https:\/\/opencode.ai\/config.json\",\n  \"provider\": {\n    \"deepseek\": {\n      \"options\": {\n        \"baseURL\": \"https:\/\/api.deepseek.com\"\n      }\n    }\n  }\n}\n<\/code><\/pre>\n<\/div>\n<p>The <b>baseURL<\/b> field is useful if you go through a proxy or your own gateway. In this case, it is convenient to transfer the key itself to an environment variable:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>export DEEPSEEK_API_KEY=\u0432\u0430\u0448_\u043a\u043b\u044e\u0447_deepseek\nopencode\n<\/code><\/pre>\n<\/div>\n<p>This option is good for CI and one-time launches: the key does not end up in storage, but lives only in the environment of the process.<\/p>\n<h2>First launch in the project<\/h2>\n<p>Go to the project directory and launch the agent:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>cd \u0432\u0430\u0448_\u043f\u0440\u043e\u0435\u043a\u0442\nopencode\n<\/code><\/pre>\n<\/div>\n<p>The first step is to initialize it:<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism undefined-numbers lang-unknown\" data-lang=\"unknown\"><code>\/init\n<\/code><\/pre>\n<\/div>\n<p>OpenCode will analyze the project structure and create a file <b>AGENTS.md<\/b> &#8211; an analogue of instructions for the agent. This file is worth committing to git: it helps the agent understand the conventions and patterns adopted in the project.<\/p>\n<h2>How to use it<\/h2>\n<p>The work is structured in much the same way as with other agents. A couple of tricks you should know right away:<\/p>\n<ul>\n<li><b>Planning mode.<\/b> The <b>Tab<\/b> key switches the agent between planning and assembly modes. In the first, he only suggests how to solve the problem and does not change anything &#8211; it is convenient to check the idea before making changes.<\/li>\n<li><b>Links to files.<\/b> The <b>@<\/b> key opens a fuzzy search through project files to transfer a specific file to the agent in the context.<\/li>\n<li><b>Rolling back changes.<\/b> The <b>\/undo<\/b> command undoes the last edits and returns the original request, <b>\/redo<\/b> returns them back. You can roll back several steps in a row.<\/li>\n<li><b>Sharing a conversation.<\/b> The <b>\/share<\/b> command creates a link to the current conversation and copies it to the clipboard. By default, conversations are not published anywhere.<\/li>\n<\/ul>\n<p>For simple changes, you don\u2019t have to switch to planning mode, but immediately describe what needs to be done and specify the files via @.<\/p>\n<h2>What to pay attention to<\/h2>\n<p>A couple of practical points. OpenCode does not require a subscription: you pay the provider directly when you spend tokens, so long sessions with DeepSeek are predictably cheaper than top models. The key is stored locally in auth.json &#8211; this is worth considering on a shared machine, but for other people&#8217;s environments an environment variable is more reliable.<\/p>\n<p>And one more thing: the quality of answers to complex architectural problems differs among models of different classes, so for design it makes sense to take a stronger model, and give the routine away to a quick and cheap one.<\/p>\n<h2>Links<\/h2>\n<p><a href=\"https:\/\/opencode.ai\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/docs\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/docs\/providers\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/providers\/<\/a><br \/>\n<a href=\"https:\/\/github.com\/anomalyco\/opencode\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/anomalyco\/opencode<\/a><br \/>\n<a href=\"https:\/\/platform.deepseek.com\/api_keys\" rel=\"noopener\" target=\"_blank\">https:\/\/platform.deepseek.com\/api_keys<\/a><br \/>\n<a href=\"https:\/\/api-docs.deepseek.com\" rel=\"noopener\" target=\"_blank\">https:\/\/api-docs.deepseek.com<\/a><\/p>\n<h2>Sources<\/h2>\n<p><a href=\"https:\/\/opencode.ai\/docs\/\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/<\/a><br \/>\n<a href=\"https:\/\/opencode.ai\/docs\/providers\/#deepseek\" rel=\"noopener\" target=\"_blank\">https:\/\/opencode.ai\/docs\/providers\/#deepseek<\/a><br \/>\n<a href=\"https:\/\/github.com\/anomalyco\/opencode\/releases\" rel=\"noopener\" target=\"_blank\">https:\/\/github.com\/anomalyco\/opencode\/releases<\/a><br \/>\n<a href=\"https:\/\/models.dev\/\" rel=\"noopener\" target=\"_blank\">https:\/\/models.dev\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>OpenCode is an open programming agent that lives right in the terminal. It can read project files, edit code, run commands and tests, search the repository and work with git &#8211; about the same thing that Claude Code and other console agents do. The main difference is that OpenCode is not tied to one model [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[],"class_list":["post-191","post","type-post","status-publish","format-standard","hentry","category-notes"],"translation":{"provider":"WPGlobus","version":"3.0.6","language":"en","enabled_languages":["en","ru","zh","de","ja","fr","es","pt","hi"],"languages":{"en":{"title":true,"content":true,"excerpt":false},"ru":{"title":true,"content":true,"excerpt":false},"zh":{"title":true,"content":true,"excerpt":false},"de":{"title":true,"content":true,"excerpt":false},"ja":{"title":true,"content":true,"excerpt":false},"fr":{"title":true,"content":true,"excerpt":false},"es":{"title":true,"content":true,"excerpt":false},"pt":{"title":true,"content":true,"excerpt":false},"hi":{"title":true,"content":true,"excerpt":false}}},"_links":{"self":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/191","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/comments?post=191"}],"version-history":[{"count":0,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/posts\/191\/revisions"}],"wp:attachment":[{"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/media?parent=191"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/categories?post=191"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/demensdeum.com\/blog\/wp-json\/wp\/v2\/tags?post=191"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}