AI W1Coding · Artificial Intelligence

Install OpenCode on Windows and connect it to ChatGPT Plus, DeepSeek and the OpenAI API

A practical, start-to-finish walkthrough. Install the OpenCode coding agent on a Windows PC, then connect it to the AI account or API key you already pay for.

Windows 10 & 11 ChatGPT Plus / Pro DeepSeek API OpenAI API

Before you start

OpenCode is an open-source AI coding agent that runs in your terminal, in a desktop app, or in a browser. On Windows you will use the command line most of the time, so the guide uses PowerShell (press Win, type PowerShell, then open it).

You need three separate things, and it helps to keep them apart because they are billed differently:

ThingWhat it isHow it is billed
ChatGPT Plus / ProA monthly ChatGPT subscriptionFlat monthly fee; used through Sign in with ChatGPT
DeepSeek APIPay-as-you-go developer APIPrepaid credits on platform.deepseek.com
OpenAI APIPay-as-you-go developer APIUsage on platform.openai.com
Common mistake A ChatGPT Plus subscription is not the same as an OpenAI API key, and it does not include API credit. OpenCode can use either one, but they are different connections with different billing.

1Install OpenCode on Windows

There are two reliable ways to install it on Windows. Method A (the standalone ZIP) is the simplest because it does not need Node.js. Method B uses npm if you already work with Node.

Method A — Standalone ZIP (recommended)

  1. Open the official download page: opencode.ai/docs and download the Windows build. For a normal Intel/AMD PC choose opencode-windows-x64.zip.
  2. Create a folder such as C:\opencode and extract the ZIP into it. You should see the opencode.exe file inside.
  3. Add that folder to your PATH: open the Start menu, search Environment Variables, choose Edit the system environment variables, click Environment Variables, select Path, click Edit, New, and type C:\opencode. Click OK on every window.
  4. Close the old PowerShell window and open a new one, then check the install:
opencode --version

If you see a version number, OpenCode is installed. If you see “not recognized”, the PATH change has not applied to that window yet — open a fresh PowerShell.

Step 1 - Official OpenCode documentation and download page
Step 1 - Official OpenCode documentation and download page

Method B — Install with npm

If Node.js is already installed, open PowerShell and run:

npm install -g @opencode/cli

Then confirm it works with opencode --version. You can also update later with npm install -g @opencode/cli@latest.

About Windows package managers The OpenCode documentation notes that Windows package managers are not officially supported. The npm global install and the standalone ZIP are the recommended routes.

2Open a project folder

OpenCode works on a project directory: it can read and edit files there. Open PowerShell, go to the folder you want to work in, and start it.

cd C:\Users\YourName\Projects\my-app
opencode

You can also point it at a folder directly:

opencode C:\Users\YourName\Projects\my-app

For a quick one-off answer without the full-screen interface, use opencode run:

opencode run "Explain what this project does"

Inside OpenCode, type /help to see the commands, and /connect when you are ready to add an AI provider.

Step 2 - Official OpenCode terminal interface showing a session
Step 2 - Official OpenCode terminal interface showing a session

3Connect your ChatGPT Plus plan

If you pay for ChatGPT Plus or Pro, you can use that plan inside OpenCode instead of buying API credit. OpenCode supports this through the OpenAI provider with Sign in with ChatGPT.

  1. Start OpenCode in a project folder (Step 2).
  2. Run /connect.
  3. Choose OpenAI.
  4. Choose Sign in with ChatGPT (you may also see legacy Codex sign-in options).
  5. A browser window opens. Sign in with the same account that has ChatGPT Plus / Pro and approve the connection.
  6. Return to OpenCode and run /models to pick a model.
/connect
# Select: OpenAI
# Select: Sign in with ChatGPT

/models
Why this is different from an API key Usage through Sign in with ChatGPT counts against your ChatGPT plan, so these models do not show a per-message API cost. By default OpenCode applies a context cap for these sign-ins so plan usage is consumed at a similar rate to other OpenAI products.

4Connect DeepSeek

DeepSeek uses an API key and prepaid credit. The DeepSeek chat website and the developer API are separate products, so a normal chat account does not automatically include API credit.

  1. Go to platform.deepseek.com and sign in.
  2. Open the API keys section and create a new key. Copy it immediately — it is usually shown only once.
  3. Make sure there is a positive balance in the billing section, otherwise requests return errors.
  4. In OpenCode, run /connect, choose DeepSeek, and paste the key.
/connect
# Select: DeepSeek
# Paste your DeepSeek API key
If DeepSeek does not appear in the list Add it as a custom OpenAI-compatible provider in opencode.json (see the config section below). The base URL is https://api.deepseek.com and the common model IDs are deepseek-chat and deepseek-reasoner.

5Connect the OpenAI API

Use this route when you have a developer API key from OpenAI and want pay-as-you-go billing. This is separate from ChatGPT Plus.

  1. Sign in at platform.openai.com/api-keys.
  2. Create a new secret key and copy it right away.
  3. Check Settings → Billing on the platform so the account has API credit or a payment method.
  4. In OpenCode, run /connect, choose OpenAI, then choose the API key option and paste the key.
/connect
# Select: OpenAI
# Select: API key
# Paste your OpenAI API key
Keep the two connections separate You can have both a ChatGPT Plus sign-in and an OpenAI API key at the same time. If you use the API key, usage is billed per token by the API account — it does not draw from your ChatGPT Plus subscription.

6Pick a model

After connecting one or more accounts, run /models and choose the model you want. Models are referenced as provider/model, for example:

  • openai/… for OpenAI models (API key or ChatGPT sign-in)
  • deepseek/deepseek-chat for the standard DeepSeek chat model
  • deepseek/deepseek-reasoner for the reasoning model

You can make the choice permanent with the model field in your config file. If a model shows as unavailable, reconnect that provider and run /models again to refresh the list.

Step 6 - Official OpenCode interface with the model selector
Step 6 - Official OpenCode interface with the model selector

7Optional: set it up in a config file

Create an opencode.json (or opencode.jsonc) in your project folder for project settings, or at %USERPROFILE%\.config\opencode\opencode.json for global settings. Never put real keys in a file you might share or commit — reference environment variables instead.

{
  "$schema": "https://opencode.ai/config.json",
  "model": "deepseek/deepseek-chat",
  "providers": {
    "deepseek": {
      "env": ["DEEPSEEK_API_KEY"],
      "settings": {
        "baseURL": "https://api.deepseek.com"
      },
      "models": {
        "deepseek-chat": {},
        "deepseek-reasoner": {}
      }
    }
  }
}

Then set the key for your PowerShell session (or add it permanently through the Windows environment variables editor):

$env:DEEPSEEK_API_KEY = "your-key-here"

For OpenAI you can use OPENAI_API_KEY the same way. Storing keys in environment variables keeps them out of your project files.

Step 7 - Official OpenCode settings screen
Step 7 - Official OpenCode settings screen

Security, privacy and cost

  • Treat API keys like money. Anyone who has a key can spend on your account. Do not paste keys into screenshots, chats, GitHub, or tutorial pages.
  • Rotate a key immediately if it leaks, then update it in OpenCode.
  • OpenCode can read, write and run commands in the folder you open. Review what you ask it to do, especially before running shell commands.
  • Watch the billing page for DeepSeek and OpenAI while you test, so an accidental large request does not surprise you.
  • ChatGPT Plus usage counts against your plan limits, not an API balance.

Troubleshooting

PowerShell says “opencode is not recognized”
The folder holding opencode.exe is not on your PATH, or the old terminal still has the old PATH. Re-check Step 1, then close and reopen PowerShell.
Sign in with ChatGPT keeps opening a browser but never finishes
Make sure you are signed in to the correct ChatGPT account, complete the approval in the browser, and return to OpenCode. Update OpenCode to the latest version if the problem continues.
DeepSeek returns an authorisation or balance error
Confirm the key was copied completely, that it is still active, and that the DeepSeek account has credit. Creating a new key and reconnecting is the fastest fix.
A model says “unavailable”
Reconnect the provider, then run /models to refresh. Check that the model ID matches the provider (for example deepseek/deepseek-chat).
Can I use ChatGPT Plus and the OpenAI API together?
Yes. They are separate connections. The Plus plan powers the ChatGPT sign-in connection; the API key is billed separately by the OpenAI platform.

Official links

This page is a guide, not official OpenCode documentation. Features and menus can change between versions; when in doubt, follow the official documentation linked above.

↑