Claude Code Too Expensive? Free OpenCode Setup Without a GPU
The new OpenCode interface makes key generation simple: create the key in the console, connect it with opencode auth login, test the connection, and keep the key out of Git.

A Claude Code subscription is around $20 per month, and heavy users often need a higher tier. That is fine if the tool pays for itself. It is harder to justify when you are learning, between projects, or just want to test an agent without another recurring charge.
The OpenCode route is simple. You install the CLI, create a key in the new OpenCode interface, connect the key, and verify that the model responds. There is no GPU involved because the model runs on a hosted provider.
What changed in the new interface
The important change is the key flow. Instead of hunting through environment variables and provider docs, you create the key in the OpenCode console and copy it once. The console also gives you a place to revoke a key if it leaks.
The setup has four steps:
- Install Node.js and OpenCode.
- Generate the key in the console.
- Connect the key to OpenCode.
- Test the connection with a real prompt.
Step 1: Install OpenCode
Install Node.js 18 or newer, then install the CLI:
npm install -g opencode-ai
Confirm the version:
opencode --version
If the command is not found, reopen the terminal. On Windows, the PATH is often the issue right after a Node install.
Step 2: Generate the key
Open the OpenCode console in your browser and go to the API key section. Create a new key, give it a name you will recognize, and copy it immediately. Most consoles show the full key only once.
Keep the key in a password manager or a secure note until you paste it. Do not paste it into a chat, a GitHub issue, or a screenshot.
Step 3: Connect the key
In a terminal, run:
opencode auth login
Choose the provider that matches the key you created, then paste the key when prompted. OpenCode stores the credential in its own config directory, so you do not need to export it in every shell.
If you already have another provider configured, you can keep both. OpenCode lets you switch providers without deleting the old one.
Step 4: Test the connection
Start OpenCode from a project folder:
opencode
Then ask a question that proves it can see the workspace:
Explain what this project does and list the main entry points.
A useful answer should mention real files in the folder. If the model replies with generic advice, check that you started OpenCode in the right directory.
For a second test, ask it to make a small safe edit, such as adding a comment or renaming a variable. Review the diff before you accept it. The goal is to confirm the full loop: read, plan, edit, and run.
Keeping the key safe
- Run
opencode auth logininstead of pasting the key into project files. - Add
.envand local config files to.gitignore. - Do not share terminal screenshots that show the key.
- Revoke the key in the console if it appears anywhere public.
- Use a separate key for each machine if the console supports it.
A leaked key is not a small problem. It can be used until you revoke it, and you may not notice until the usage limit is gone.
Common errors
- Invalid key: copy it again. A trailing space or a missing character is common.
- Wrong provider: the key only works with the provider that issued it.
- Old CLI: update with
npm install -g opencode-ai@latest. - No response: check the provider status page and try a second free model.
- Rate limit: switch providers or wait. Free tiers are shared and busy.
Final thoughts
The new interface removes most of the friction from the free setup. Install the CLI, create a key in the console, connect it with the login command, and test it on a real file. If the free tier is enough for your daily work, you can skip the subscription entirely.
- The new OpenCode interface keeps key generation in one place.
- Connect the key with opencode auth login instead of hardcoding it.
- Test with a real prompt before you start a large task.
- Revoke and rotate the key if it is ever exposed.
- No GPU is needed because the model runs in the cloud.