Omarchy Apps Sponsor

AI coding agent guide

OpenCode on Omarchy

The open-source terminal coding agent — bring your own key from any of 75+ providers and it reads, edits, and runs commands.

Reviewed 2026-11-25 · independent editorial guide

Short answer

Install OpenCode with omarchy pkg add opencode, then run opencode in your project and type /connect to pick a provider and paste your API key. The CLI is free and MIT licensed; you pay your chosen provider for API usage.

OpenCode on Omarchy

OpenCode on Omarchy is a MIT-licensed, open-source terminal coding agent with a rich TUI: you chat with it, it reads and edits files and runs commands, and you bring your own API key from Anthropic, OpenAI, Google, or any of 75+ supported providers.

TL;DR

omarchy pkg add opencode

Then cd ~/my-project and run opencode. That installs OpenCode (127 MB download, 275.3 MB installed, depends on glibc and ripgrep). On first launch, type /connect, pick a provider, and paste your API key. Then describe what you want done. The tool itself is free and open source; you pay your chosen provider for API usage. The Omarchy package version was not shown on the app page and is unconfirmed; upstream is on the 2.x line.

Getting started (5 minutes)

1. Connect a model provider.

Inside the TUI, type /connect, pick a provider, and paste the key. From the shell, opencode auth login (alias opencode providers login) opens the same picker. Keys are stored in ~/.local/share/opencode/auth.json. Keys already in your environment, or in a project .env file, are also picked up automatically. Check what is stored with opencode providers list. If you have no paid key, OpenCode Zen offers free models through OpenCode’s own gateway, and OpenCode Go is a $10/month subscription for its best models. Do not skip this step: without a provider, your first prompt fails before the agent starts.

2. Start with a read-only task.

OpenCode ships two agents: build (full access, the default) and plan (read-only analysis). Start in plan mode and try: “Take a look at this project and explain its main directories.” Then run /init once: it scans the repo and writes an AGENTS.md with build, test, and convention notes. Switch between build and plan with Tab in the TUI.

3. Three things worth doing in the first session:

  • Lock permissions before the first real run. The defaults allow almost everything except reading .env files. On untrusted code, set bash and edit to ask in ~/.config/opencode/opencode.json. Note that denying the read tool can also break OpenCode’s free-tier models, so use ask, not deny, for read.
  • Set two models. Put your main model in model and a small cheap model in small_model for titles, summaries, and compaction. This is the single biggest cost saver in OpenCode.
  • Try the web UI. opencode web serves the same agent in your browser, and opencode serve plus opencode run --attach gives you headless calls without re-booting MCP servers. Update with opencode upgrade.

Common issues & fixes

Every request fails with “Upstream request failed: Invalid credential”

This is OpenCode’s own gateway refusing a stored OpenCode Console (Zen) or Go key, not a key for Anthropic or OpenAI. A maintainer’s explanation on the tracker: “This happens when your stored OpenCode API key has expired. Several older keys stopped working after the console migration.” Reinstalling or switching models does not help. A search of the tracker in mid-November 2026 returned 47 issues with this message, several from people who had just paid for Go and found nothing worked.

Fix: Run opencode auth login (or /connect in the TUI) and sign in to OpenCode again, or create a new key in the OpenCode Console (Account, then Personal API keys, in the workspace that holds your credit or Go subscription) and connect that one. (Everpod guide)

Free models fail with “OpenCode’s free tier can only be used from within OpenCode”, even though you are inside OpenCode

The free tier is served through OpenCode’s Zen gateway, and the gateway checks that each request looks like one OpenCode would send. A denied read permission is enough to trip it. The same error is by design if you use the free models from another app, a proxy, or a direct API call: the pinned thread #59387 says free models only work inside OpenCode.

Fix: Run opencode debug config, find any read deny (including "*": "deny" and "tools": { "read": false }), change it to "ask" or remove it, and try again. If the message instead says free models “aren’t available from your current network because we’ve detected abusive traffic from this IP address”, it is your network, not your config. (Engineer Foodie guide, DEV investigation)

Selecting any OpenCode Console model fails with the bare message “Error: Workspace access denied”

This is a server-side workspace or account restriction, not a local permissions bug, so reinstalling, re-logging in, and rotating keys will not fix it. Every other provider keeps working from the same machine at the same time, which makes it look model-specific. The client shows the raw upstream body with no explanation (GitHub issue #58891, OpenCode v2.1.4).

Fix: Check that the workspace your key belongs to is the one holding your credit or Go subscription, and that the workspace was not deleted or its service account removed. If a new key from the right workspace still fails, the maintainers ask for an email to help@anoma.ly with your account email and workspace name. (GitHub issue #58891)

You followed a tutorial and the install command gives you the wrong version, or opencode is not found after installing

OpenCode 1 and OpenCode 2 are different lines with different installers. The 2.x install script is curl -fsSL https://opencode.ai/v2/install | bash, the 2.x npm package is @opencode/cli, and the 2.x Homebrew tap is anomalyco/tap/opencode-v2. The old 1.x script at opencode.ai/install and the old npm package opencode-ai install 1.x, and 2.x requested through the 1.x script errors out.

Fix: On Omarchy, omarchy pkg add opencode is the one to use; if you installed by another route first, remove the old binary before installing, since versions older than 0.1.x conflict. (TurboAI OpenCode 2 install guide)

The agent does something destructive on a repo you did not fully trust

The defaults allow everything except reading .env, so the fix is config, not a bug report. Config files merge in layers (global ~/.config/opencode/opencode.json, then project opencode.json), so a project file can tighten rules for one repo without touching your global setup.

Fix: Before the first run on untrusted code, set bash and edit to ask in opencode.json, and use plan mode for exploration. (The Deep Feed config guide)

Pairs well with / If you hate this, try

Pairs well with

  • git (review diffs before committing), Ollama for a local model with zero API spend, and the OpenCode Desktop app when you want the same agent in a window with several agents running side by side.

If you hate this, try

  • If you hate bringing your own key: Kimi Code CLI has a $0 membership tier with OAuth login and no key juggling, and Freebuff needs no login or key at all. If you want the same terminal-agent shape from one vendor’s models, Claude Code is the paid reference point.

Comparison: OpenCode vs Claude Code vs Kimi Code CLI vs Kilo Code CLI

OpenCodeClaude Code (CLI)Kimi Code CLIKilo Code CLI
PriceFree CLI; you pay your provider, or free Zen modelsRequires Claude Pro $20/mo+Free CLI; Kimi membership from $15/mo or per-token API billingFree agent; you pay provider rates
Best forPicking your own model per task, 75+ providers, local modelsThe strongest single-vendor models, no key jugglingA fast single-binary TUI with subagents and MCPPicking your own model per task, local models, scripted runs
Omarchy installomarchy pkg add opencodenpm install -g @anthropic-ai/claude-codeomarchy pkg add kimi-codeomarchy pkg add kilocode-cli

Verdict: Pick OpenCode if model choice matters more than polish: no other agent on this list talks to 75+ providers, and the free Zen models mean you can start with $0. Pick Claude Code if you want one vendor’s models and zero config, and Kimi Code CLI if you want a polished single-vendor agent with a free tier.

How to switch from Claude Code (~15 minutes per project)

  1. Export from Claude Code: your project instructions already live in CLAUDE.md. OpenCode reads AGENTS.md; copy the contents across or run /init and let it generate one from the codebase.
  2. Import into OpenCode: move MCP servers into opencode.json (or add them through the TUI), and set your model and small model in the same file. Your existing provider keys work as-is: paste them with /connect or set the standard env vars like ANTHROPIC_API_KEY.
  3. What doesn’t transfer: chat history, Claude-specific slash commands and permission modes, and Claude Code’s GitHub Actions integration. OpenCode has its own plan mode, opencode run for scripting, and opencode serve for headless use instead.
  4. Time estimate: takes about 15 minutes per project.

Open the OpenCode package

See the live version, upstream screenshot, requirements, source and exact Omarchy install command.

View OpenCode →

Frequently asked questions

Is OpenCode free?

The tool itself is free and open source (MIT). You pay your chosen LLM provider for API usage, or use OpenCode Zen’s free models, a free-tier provider key, or a local model. OpenCode Go is a $10/month subscription for its best models.

What is the difference between opencode and opencode-desktop?

Same agent, different window. opencode is the terminal UI this guide covers. opencode-desktop is the beta Electron app: the same agent in a desktop window, running several agents in parallel with a browser view beside them. The desktop package depends on the CLI package, and both share the same config at ~/.config/opencode/.

What is the difference between OpenCode 1 and OpenCode 2?

OpenCode 2 is a ground-up TypeScript rewrite, published on npm as @opencode/cli since 2.0.0 on September 11, 2026, with a new session table, plugin API, and server API. The 1.x line (old npm package opencode-ai, repo sst/opencode) keeps shipping separately. Make sure the installer you use matches the version you want.

Where does OpenCode store its config?

Global config is ~/.config/opencode/opencode.json, TUI theme and keybinds are ~/.config/opencode/tui.json, and stored credentials are ~/.local/share/opencode/auth.json. Project config goes in opencode.json at the project root, and the files merge in layers instead of replacing each other.

Can I use a local model?

Yes. OpenCode works with any of 75+ providers, including a local model through Ollama or any OpenAI-compatible endpoint. Point it at your local server in opencode.json or with the provider env vars.

Does it work offline?

Only with a local model. Every hosted provider needs network access.

Official sources

Commands and fixes verified against official sources November 2026; on-machine verification pending.