{"slug": "how-to-use-opencode", "title": "How to use OpenCode", "summary": "OpenCode, an open-source coding harness, allows developers to select their preferred AI model provider without being locked into a single ecosystem, unlike Codex or Claude Code. Installation is available via curl script, npm, or Homebrew, and configuration is done through the /connect command. The tool is positioned as a flexible alternative for developers who want to switch between frontier models.", "body_md": "# How to use OpenCode\n\n### Wouldn't it be great if your coding harness wasn't coupled to your model provider? I'll show you how to use OpenCode to build software.\n\nOpenCode is the open source coding harness that most closely matches frontier lab features.\n\nOpenCode lets you select your model without gluing yourself into one ecosystem. Codex is great, but it locks you into OpenAI models. Claude Code is great, but it locks you into Anthropic models.\n\nI’ve written at great length about [swapping back and forth between these harnesses](https://www.augmentedswe.com/p/codex-vs-claude-code-2c0), mostly switching when one lab releases a new frontier model.\n\nBut wouldn’t it be great if you didn’t have to? OpenCode lets you just select your preferred model. In this way, it’s like Cursor.\n\nBut it’s also open-source, which Cursor is not.\n\nBut enough telling you what OpenCode is. I’ll show you how to install and use it!\n\n## How to install OpenCode\n\nThe recommended way to install OpenCode is by running the install script:\n\n```\ncurl -fsSL https://opencode.ai/install | bash\n```\n\nBut you can also install through your package manager of choice. If you chose the above, skip these options:\n\n#### Install OpenCode with NPM\n\n```\nnpm install -g opencode-ai\n```\n\n#### Install OpenCode with Homebrew\n\n```\nbrew install anomalyco/tap/opencode\n```\n\nThen, run `opencode`\n\nfrom the directory you want to work in.\n\nIf you’re curious about open source coding harnesses, you’re obviously in the right spot. I spend dozens of hours researching each of these guides so you have a shortcut to building software with AI.\n\nI’d love to have you join us and get notified when we share more tutorials like this.\n\n## Configuring an OpenCode AI Provider\n\nOpenCode is just a coding agent harness. You actually need an LLM model behind that harness, so you’ll need to configure one.\n\nThe great thing here is **you get to choose.**\n\nYou can choose your model in Cursor, but *not your model provider*. With OpenCode, you can drop in an API key for OpenAI, Anthropic, Grok, or some other provider. [Choosing a frontier model is tricky](https://www.augmentedswe.com/p/choosing-fable-5-gpt-56-sol), and your choice will probably change over time.\n\nRun `/connect`\n\nin the CLI to see some options:\n\nWhich should you choose? I have a few recommendations:\n\n## Keep reading with a 7-day free trial\n\nSubscribe to The AI-Augmented Engineer to keep reading this post and get 7 days of free access to the full post archives.", "url": "https://wpnews.pro/news/how-to-use-opencode", "canonical_source": "https://www.augmentedswe.com/p/how-to-use-opencode", "published_at": "2026-08-13 10:34:23+00:00", "updated_at": "2026-08-13 10:53:05.050953+00:00", "lang": "en", "topics": ["developer-tools", "ai-tools", "ai-infrastructure"], "entities": ["OpenCode", "Codex", "Claude Code", "Cursor", "OpenAI", "Anthropic", "Grok", "Homebrew"], "alternates": {"html": "https://wpnews.pro/news/how-to-use-opencode", "markdown": "https://wpnews.pro/news/how-to-use-opencode.md", "text": "https://wpnews.pro/news/how-to-use-opencode.txt", "jsonld": "https://wpnews.pro/news/how-to-use-opencode.jsonld"}}