Appearance
OpenCode
OpenCode is an open-source AI coding agent that can be configured to use custom API endpoints.
| Official Website | https://opencode.ai |
Use CC-Switch to quickly set it up with 3xCoder.
Installation
Install OpenCode via npm:
bash
npm install -g opencodeOr use npx:
bash
npx opencodeConfiguration with CC-Switch (Recommended)
The easiest way to configure OpenCode with 3xCoder is through CC-Switch:
- Run CC-Switch:
bash
npx cc-switch@latest- Select OpenCode as the target tool
- Enter your 3xCoder settings:
| Setting | Value |
|---|---|
| Base URL | https://api.3xcoder.com/v1 |
| API Key | Your 3xCoder key (sk-...) |
- Click Apply
- Launch OpenCode — it will use the 3xCoder endpoint
Manual Configuration
If you prefer manual configuration, set environment variables:
powershell
$env:OPENAI_BASE_URL = "https://api.3xcoder.com/v1"
$env:OPENAI_API_KEY = "sk-your-api-key-here"
opencodebash
export OPENAI_BASE_URL="https://api.3xcoder.com/v1"
export OPENAI_API_KEY="sk-your-api-key-here"
opencodeTo make this permanent, add the export lines to your shell profile (~/.bashrc, ~/.zshrc, or $PROFILE).
Usage
Once configured, OpenCode works like any other AI coding assistant:
bash
opencodeIt will connect to 3xCoder and use the available models for code generation, editing, and analysis.
Troubleshooting
opencode: command not found
- Ensure Node.js is installed:
node -v - Reinstall:
npm install -g opencode - Check that npm global bin is in your PATH
Connection errors
- Verify your API key works:
curl https://api.3xcoder.com/v1/models -H "Authorization: Bearer sk-your-key" - Check the base URL has no trailing slash
- Restart OpenCode after changing configuration
