Connect → OpenCode
Use AxForge with OpenCode
OpenCode is an open-source coding agent for the terminal. It takes any OpenAI-compatible service as a provider in its config file.
- An AxForge API key. Get one (a minute).
- Node.js 18 or newer. This guide was tried with OpenCode 2.3.0 on 2026-11-15.
Set it up
-
Install OpenCode
npm install -g @opencode/cliHad OpenCode before? If
opencode --versionsays 1.x, remove that one first withnpm uninstall -g opencode-ai, then install as above.opencode --versionthen says 2.x. -
Add AxForge to your project
In your project folder, create a file
opencode.json:{ "$schema": "https://opencode.ai/config.json", "provider": { "axforge": { "npm": "@ai-sdk/openai-compatible", "name": "AxForge", "options": { "baseURL": "https://api.axforge.ai/v1" }, "models": { "glm-5.3-flash": { "name": "GLM-5.3-Flash", "limit": { "context": 500000, "output": 16384 }, "options": { "reasoningEffort": "high" } }, "mimo-v2.6-flash": { "name": "MiMo-V2.6-Flash", "limit": { "context": 262144, "output": 16384 } }, "qwen3.8-27b": { "name": "Qwen3.8 27B", "limit": { "context": 262144, "output": 16384 } } } } }, "model": "axforge/glm-5.3-flash" }The last line makes GLM-5.3-Flash the model OpenCode starts with, the one we set up for coding. GLM thinks before each step; its
"reasoningEffort": "high"has it think harder than its default, low. Each model'slimittells OpenCode how much it reads at once (500,000 tokens for GLM, 262,144 for the other two), so it shortens a long session before it reaches that. The key is not in the file: you give it to OpenCode in the next step.
-
Give OpenCode your key, once
In the same folder:
opencode auth login axforgePaste your key and press Enter. It says Connected to AxForge. OpenCode keeps the key, so every project with this
opencode.jsonuses it and you don't give it again.
-
Start it in your project
cd my-project opencodeUnder the message box it says GLM-5.3-Flash AxForge.

-
Give it a task
Ask in plain words. It finds the file, edits it and shows the result.

The settings
| Setting | Value |
|---|---|
| npm | @ai-sdk/openai-compatible |
| options.baseURL | https://api.axforge.ai/v1 |
| the key | opencode auth login axforge, in the project folder |
| models | glm-5.3-flash, mimo-v2.6-flash, qwen3.8-27b |
| options (glm-5.3-flash) | reasoningEffort high |
| limit | context 500000 (GLM) or 262144 (the other two), output 16384 |
| model | axforge/glm-5.3-flash |
Which model for what: glm-5.3-flash is the one
for coding and thinks before it answers, mimo-v2.6-flash is the fastest, qwen3.8-27b reads
images. To start on another one, change the last line of the file, for example to
axforge/mimo-v2.6-flash.
Check that it works
Under the message box it says GLM-5.3-Flash AxForge, and a task gets done. The calls show in the console under API Keys → Recent calls within a minute.
When it does not work
Not sure which it is? The connection doctor makes seven small
checks on your key and names the fix: irm https://dev.axforge.ai/assets/axforge-doctor.ps1 | iex in
PowerShell, curl -fsSL https://dev.axforge.ai/assets/axforge-doctor.sh | bash on macOS and Linux.
| What you see | What it means | Fix |
|---|---|---|
| "Invalid API key. Create one at https://console.axforge.ai/keys." | OpenCode has no key for axforge, or it was refused | run opencode auth login axforge again in your project folder (step 3); or make a new key |
| "Integration not found: axforge" | OpenCode was started outside your project | run it in the folder that holds opencode.json (step 2) |
| "Database is not empty and has no session table" | an OpenCode 1 meets the data an OpenCode 2 (such as the OpenCode app) has already updated; nothing is lost | npm uninstall -g opencode-ai, then npm install -g @opencode/cli (step 1) |
| Another model or provider under the message box | the config file was not found | start OpenCode in the folder that holds opencode.json, and check its name |
Test a call says in one click whether a problem is your key, your balance or us.