Hydedocs

OpenCode

Set up OpenCode with Hyde Inference.

Before you start

Install OpenCode if you don't have it yet. The official install docs cover every platform. Quickest way:

curl -fsSL https://opencode.ai/install | bash
brew install anomalyco/tap/opencode
choco install opencode
# or: scoop install opencode  (WSL recommended)
npm install -g opencode-ai
Tip

Reload your shell afterwards (source ~/.zshrc, or source ~/.bashrc) so opencode is on your PATH.

You also need your Hyde setup link. It's in your invite email. Opening it creates your API key and shows the connect command. Treat the link like a password: don't forward or repost it.

Setup

1. Set up an isolated Hyde profile

If you use OpenCode with other providers, keep this setup fully isolated. It gets its own config and credentials. Add this alias to your shell profile (~/.zshrc or ~/.bashrc):

echo "alias opencode-hyde='XDG_CONFIG_HOME=~/.hyde-opencode/config XDG_DATA_HOME=~/.hyde-opencode/data opencode'" >> ~/.zshrc

Then source ~/.zshrc, and run it once to bootstrap the profile. Exit with Ctrl+C.

Tip

The rest of this guide uses opencode-hyde and ~/.hyde-opencode/. Skipping this step? Just run opencode. OpenCode merges the gateway in without touching your existing providers.

2. Connect to Hyde

Append the key export to your shell profile, load it, and log in. Swap in your real key and run:

echo 'export HYDE_INFERENCE_API_KEY="sk-PASTE-YOUR-KEY"' >> ~/.zshrc
source ~/.zshrc
opencode-hyde auth login https://inference.hyde.tech
Heads-up

Already have an export line? Re-running appends a duplicate export line, and the last one wins. If you've run this before, edit the existing line in ~/.zshrc instead.

Tip

Keep the key handy. Save the sk-… key somewhere permanent (notes, password manager). You'll need it again if you re-run setup or set up another tool. If you version-control your dotfiles, put this export in a separate untracked file instead.

bash instead of zsh? Point the >> line at ~/.bashrc and run source ~/.bashrc.

OpenCode stores the key and fetches the provider and its models from the gateway's public config. New aliases appear at the next start.

If you received an invite link, run the command your setup page shows:

opencode-hyde auth login https://inference.hyde.tech/setup/<your-token>

This creates your API key, registers every gateway model, and sets your default. It's safe to re-run because it reuses your key.

3. Start your session and verify

cd /path/to/your/project
opencode-hyde

Type /models to pick. Every gateway model is listed. Then ask it something real. The reply should stream from the gateway.

Tip

New models appear automatically. OpenCode re-fetches the gateway config on every start.

Models

Everything the gateway serves is in your /models picker. The current catalog lives on the Models page.

If it breaks

"Invalid, expired, or already used"

The link is single-use and expires in 7 days. Get a fresh one from your admin, then re-run step 2.

401 / unauthorized when chatting

On the invite path, your key was revoked from the Keys tab. Get a fresh setup link to re-issue a key, then re-run step 2. Without an invite, the key isn't set in the shell you launched from. Check with echo "${HYDE_INFERENCE_API_KEY:0:10}…" and export it again.

Asked to verify your email

Normal on first visit. Enter the code from your inbox. The command appears after.

A new model doesn't show up

Relaunch opencode-hyde. The config re-fetches at launch.

opencode: command not found

Reload your shell (source ~/.zshrc or source ~/.bashrc).

Was this page helpful?