Claude Code and opencode on Open-Weight Models: GLM, Kimi and DeepSeek on Morpheus
Run Claude Code or opencode on GLM, Kimi and DeepSeek via claude-code-router, the vendors' APIs or Morpheus. Five runs tested by us, plus one trap to avoid.
What this guide covers
Claude Code and opencode are coding agents. You describe a change, and the agent reads your files, edits them and runs commands until the job is done. Every step is a question to an AI modelModelA trained neural network that takes inputs (text, images, audio) and produces outputs (more text, classifications, generated content). In DeAI the model is the thing that actually does the work.Like a very experienced apprentice who has spent years watching thousands of masters make furniture. They can't explain how they know when a joint is right, but they can make a chair that looks and functions like a Chippendale. The training is invisible. The output is what matters.Model in the glossary →, and every question carries pieces of your code.
The models in this guide are open-weightOpen WeightsAn AI model whose trained parameters are publicly published and downloadable, so anyone can run, fine-tune, or modify it without permission. Llama, Qwen, DeepSeek, Mistral, and Hermes are open-weight models.Like the difference between a published recipe and a restaurant's secret formula. Anyone with the recipe can cook the dish at home, modify it, or open their own restaurant. The secret formula stays locked in someone else's kitchen.Open Weights in the glossary →: their makers publish them, so anyone can run them. That’s why there’s a choice of route at all. You can rent GLM from Z.ai, or from an independent provider on Morpheus, and get the same model either way. For agents other than coding agents, our agent-to-Morpheus hub covers the set-up.
What you'll end up with
Claude Code or opencode?
Both do the same job in your terminal. The differences that matter here are who owns the tool and what it sends home.
| opencode | Claude Code | |
|---|---|---|
| Licence | Open source (MIT), code on GitHub | Anthropic’s: “All rights reserved”, under its commercial terms |
| Built for | Many providers: 75+ by opencode’s own count | Claude models; Anthropic won’t support it on other models |
| Reaching Morpheus | Directly | Through a translator such as claude-code-router |
| What the tool itself sends home | Nothing unless you run /share, which uploads that session to opencode’s servers as a public link | Usage metrics and error reports, which Anthropic says never include your code or prompts and which you can switch off. /feedback sends the conversation, code included |
Details are from each project’s own repository and docs, read on 3 October 2026. If owning the whole stack is the point, opencode is the better fit. Claude Code makes sense if it’s already the tool you know.
Where your code goes on each route
| Route | Who reads your prompts and code | Works with | Tested by us |
|---|---|---|---|
| The vendor’s own API (Z.ai, Moonshot, DeepSeek) | The company that made the model | Claude Code directly, opencode | No: set-up from each vendor’s docs, read 3 Oct 2026 |
| Venice | Venice, which says it keeps nothing from models it tags Private | opencode directly, Claude Code through claude-code-router | No: set-up from Venice’s docs, read 3 Oct 2026 |
| Morpheus, through your own Uplink gateway | The independent provider serving your session | opencode directly, Claude Code through claude-code-router | Yes, 3 Oct 2026 |
| A model on your own machine | Nobody else | Both, if your hardware can run the model | Not in this guide |
How private is each route?
A coding agent sends your files to the model a piece at a time, so whoever runs the model can read your code. That includes any API keys, passwords or client work sitting in those files.
- The vendor’s API. The vendor receives your code, and its own privacy policy decides what it keeps and for how long. Read that policy before you send anything you wouldn’t post publicly.
- Venice. Venice runs the open-weight models itself and tags them Private, and says it never stores those conversations. We haven’t been able to verify that independently. Our Venice review covers its full privacy model.
- Morpheus. The provider serving your session can read your prompts, as any server can. It sees your wallet address, not your name or email, and no single company sees all your sessions. Some Morpheus providers run models inside a trusted execution environment, sealed hardware you can check the provider can’t look into. Our Morpheus review covers how that check works, and our private AI inference explainer covers the wider picture. We didn’t use one of those models in these tests.
- Your own machine. Fully private, because your code never leaves it.
What we tested
We gave each agent the same small job: a Python file with three broken functions and six failing tests, with orders to fix the file without touching the tests. Every run went through our own Uplink gateway to providers on the Morpheus network.
| Agent | Model on Morpheus | Result | Time |
|---|---|---|---|
| opencode | DeepSeek V4 Flash | All 6 tests pass | 49 s |
| opencode | GLM 5.2 | All 6 tests pass | 47 s |
| opencode | DeepSeek V4 Pro | All 6 tests pass | 59 s |
| opencode | Kimi K2.7 Code | All 6 tests pass | 45 s |
| Claude Code, through claude-code-router | DeepSeek V4 Flash | All 6 tests pass | 177 s |
Times include opening a Morpheus session where one wasn’t already open, and no run edited the tests. We didn’t dig into why Claude Code took longer. The job is small: it shows that each route works, and says little about which model codes best.
Route 1: opencode on Morpheus
opencode is the easier of the two. It speaks the same format as OpenAI’s API, and so does an Uplink gateway, so they connect with no translator in between. You add Morpheus as a custom provider in a small settings file, list the models you want, and pick one when you start.
The opencode settings file we used
Put this in opencode.json in your project folder (or in ~/.config/opencode/opencode.json for every project). The {file:...} line reads your Uplink key from a file, so the key never sits in the settings itself.
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"morpheus": {
"npm": "@ai-sdk/openai-compatible",
"name": "Morpheus via Uplink",
"options": {
"baseURL": "https://your-uplink-host/v1",
"apiKey": "{file:~/.config/uplink/opencode.key}"
},
"models": {
"0x<model-id-from-uplink>": { "name": "GLM 5.2 (Morpheus)" }
}
}
}
}Then run opencode and choose the model, or in one line: opencode run -m morpheus/0x<model-id> "your task".
Use the model’s ID code, the long string starting with 0x, rather than its name. Several Morpheus listings share a name, and Uplink can resolve a shared name to a far pricier listing. Your gateway’s model list shows each ID.
Route 2: Claude Code through claude-code-router
Claude Code sends Anthropic-format requests, and a Morpheus gateway only understands OpenAI’s format. claude-code-router (CCR) sits on your machine and translates between the two. Claude Code talks to CCR, and CCR talks to Morpheus.
Read this before you install CCR
CCR’s setup wizard changed global settings on our machine without asking first. Moving from “Verify connection” to the “Connect agent” step, with the scope left on its default of “System default”, applied its profiles at once:
- It added a block to
~/.claude/settings.jsonthat points every Claude Code session at CCR on your own machine. - It created a Codex settings file,
~/.codex/config.toml, that does the same for Codex. - Restarting CCR applied both again.
Once CCR stopped, Claude Code and Codex on that machine could not reach any model. CCR does keep backups (settings.json.ccr-original next to the file it changed), and restoring from them fixed it.
The safer set-up
The safer way is to stop the wizard after the provider is saved and launch Claude Code yourself, pointed at CCR for that one session. Nothing global changes.
Setting up CCR without touching your global settings
CCR 3 needs Node.js 22 or newer and is set up in a browser page.
npm install -g @musistudio/claude-code-router, thenccr ui.- Under Providers → Add Provider, choose Other / custom API endpoint. Name it
morpheus, set the endpoint tohttps://your-uplink-host/v1and paste your Uplink key. CCR detects the format by itself. - Add your model by its
0xID with Custom model. - Stop when the provider is saved. Skip Connect agent.
Then start Claude Code in your project with CCR as its address for this session only:
ANTHROPIC_BASE_URL=http://127.0.0.1:3456 \
ANTHROPIC_AUTH_TOKEN=<your CCR client key> \
ANTHROPIC_MODEL="morpheus,0x<model-id>" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="morpheus,0x<model-id>" \
claudeCreate a CCR client key on its API Keys page. Set the Haiku model too: Claude Code uses that slot for background jobs, so it has to name a model your route serves.
Anthropic’s own gateway documentation says Anthropic won’t support routing Claude Code to models other than Claude. Our run worked, but expect rough edges after Claude Code updates. Claude Code warned at the start that it didn’t know the model name, then did the job.
Route 3: Claude Code straight to the vendor
Z.ai, Moonshot and DeepSeek each run an Anthropic-format address, so Claude Code can talk to them with no translator. We haven’t tested these. The details below are from each vendor’s own page, read on 3 October 2026.
| Vendor | Address for Claude Code | How the vendor sets it up |
|---|---|---|
| Z.ai (GLM) | https://api.z.ai/api/anthropic | A script that edits ~/.claude/settings.json |
| Moonshot (Kimi) | https://api.moonshot.ai/anthropic | An env block in ~/.claude/settings.json, plus a clean-up script for old settings |
| DeepSeek | https://api.deepseek.com/anthropic | export lines in your terminal |
Two of the three change your global Claude Code settings. If you also use Claude Code with your Anthropic plan, put the same values in front of the claude command for one session instead, as in Route 2. DeepSeek also says it maps Claude model names to its own: Opus names go to DeepSeek V4 Pro, and Sonnet and Haiku names to DeepSeek’s Flash model.
Route 4: Venice
Venice hosts GLM, Kimi and DeepSeek itself and speaks OpenAI’s format, so opencode connects to it directly. opencode lists Venice as a built-in provider, and Venice publishes its own opencode and Claude Code guides. Its Claude Code guide uses claude-code-router too, so the warning in Route 2 applies.
We haven’t tested Venice with these coding tools. The details below are from Venice’s docs and its live model list, read on 3 October 2026.
opencode on Venice, from Venice's guide
Set your key in the terminal with export VENICE_API_KEY="your-api-key", then put this in opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"venice": {
"npm": "@ai-sdk/openai-compatible",
"name": "Venice AI",
"options": {
"baseURL": "https://api.venice.ai/api/v1",
"apiKey": "{env:VENICE_API_KEY}"
},
"models": {
"zai-org-glm-5-2": { "name": "GLM 5.2" }
}
}
}
}Venice’s model list at https://api.venice.ai/api/v1/models gives each model’s ID and its privacy tag.
Not sure? Here’s how we’d choose
- Just want a cheaper coding agent? opencode with the vendor’s own API is the shortest path, if you’re comfortable sending your code to that company.
- Already settled on Claude Code? The vendor’s Anthropic address, set for one session at a time.
- Don’t want your code going to the model’s maker? opencode on Venice for the simplest set-up, or on Morpheus if you’d rather no single company served every request. Either is one settings file and no translator.
- Want Claude Code on Morpheus? It works through CCR. Skip its Connect agent step.
- Want it fully private? Run the model on your own machine. opencode and Claude Code both work with local model servers such as Ollama.
What it costs
On the vendor routes and Venice you pay per token from an account with that company. On Morpheus you pay in MOR, at prices set by competing providers that change often.
Your gateway locks some MOR as collateral (a stake) for each session it opens, and can estimate that stake before it opens one. The stake comes back after the session closes, part at once and the rest the next day.
If you’re weighing this against Anthropic’s own plans, our heavy AI habit costs piece has three months of our Claude Code usage priced out.
Troubleshooting
opencode run hangs with no output. Run from a script, with no terminal attached, it waits for input that never comes. Add < /dev/null to the end of the command.
Claude Code can’t connect after you tried CCR. Look in ~/.claude/settings.json for an env block pointing at 127.0.0.1:3456. Restore settings.json.ccr-original if it’s there, or delete that block. Check ~/.codex/config.toml for a block marked “CCR managed” as well.
“Model not found” through Uplink. Use the 0x model ID, not the name.
Slow first answer. On Morpheus the first request to a model opens a session on-chain before any answer comes back. Later requests reuse that session.
Read next
Guide
Morpheus Uplink: Your Own OpenAI-Compatible Gateway to Decentralised Inference
Uplink puts API keys, automatic sessions and a stake dashboard in front of a Morpheus consumer node. Tested on our own VPS, with the three traps we hit.
Journal
What a Heavy AI Habit Actually Costs
Three months of my Claude Code usage came to $19,765.21 at API rates on a Max 5x plan. The pricing, the usage limits, and the two costs the plan hides.
Resource
Open-Weight AI Models Compared
The best open-source and open-weight LLMs for local inference in 2026: Qwen, DeepSeek, gpt-oss, Gemma, GLM, Mistral and more, with licences and RAM needs.