Skip to content
Back to blog
claude codeArticle

Claude Code and OpenCode with local Qwen: compatible or supported?

OpenCode documents local llama.cpp. Claude Code can traverse a compatible gateway, but Anthropic does not support routing it to non-Claude models.

Author

Syntalith

Published Updated 3 min read

OpenCode officially documents local models through llama.cpp and an OpenAI-compatible provider. Claude Code supports Anthropic-compatible gateways, but Anthropic does not support routing the client to non-Claude models. Our Qwen task completed through Claude Code because patched vLLM emulated the required endpoint.

Technical compatibility and a supported configuration are different. That distinction affects upgrades, vendor help and downtime risk.

We ran the comparison after hours on a home PC with an RTX 3090. It describes these client versions on this stack. It is neither a vendor ranking nor a promise for another repository.

OpenCode has a documented local path

OpenCode provider documentation shows llama.cpp through @ai-sdk/openai-compatible, a baseURL and explicit context and output limits. It points to @ai-sdk/openai for a Responses endpoint.

This is our provider section with local paths removed. Port, model name and limits match the measured 150k vLLM profile:

{
  "$schema": "https://opencode.ai/config.json",
  "provider": {
    "qwen-local": {
      "npm": "@ai-sdk/openai-compatible",
      "name": "Local Qwen vLLM",
      "options": {
        "baseURL": "http://127.0.0.1:18020/v1",
        "apiKey": "{env:QWEN_VLLM_API_KEY}"
      },
      "models": {
        "qwen3.8-27b": {
          "name": "Qwen3.8-27B 150K Medium",
          "limit": { "context": 150000, "output": 32768 },
          "options": { "reasoningEffort": "medium" }
        }
      }
    }
  }
}

Use a key and limits that match the server. The disposable benchmark config granted "*": "allow" globally so approval pauses did not distort timing. We deliberately omit that setting here. In a normal repository, keep approval prompts or define a narrow operation allowlist. Broad permission belonged only in disposable worktrees with no secrets.

Four real OpenCode cells

TaskHidden checksTimeWhat mattered
CSV export1/332.69 smissed the custom separator required by README
pagination3/3325.88 sminimal fix, then unnecessary .git inspection and a false report claim
CSV import5/589.04 sfastest fully correct result in the cell
import follow-up3/3130.03 scorrect same-session change to upsert behaviour

That is more informative than saying "OpenCode works." It excelled once, violated an explicit contract once, and sometimes wandered after correct code. We therefore score hidden checks and inspect both the final diff and explanation.

A Claude Code gateway is not arbitrary-model support

Claude Code gateway connection documentation uses ANTHROPIC_BASE_URL and a credential. A gateway can centralise authentication, logging and routing for supported Claude models.

Anthropic's support boundary is explicit: routing Claude Code to non-Claude models is unsupported. A production standard should not depend on the next client version preserving incidental compatibility with an emulator.

What the Claude Code experiment showed

An early Claude Code attempt on llama.cpp ran for 7,298.5 seconds, overflowed context, did not finish and left a test that failed to compile. It received no final quality score.

On patched vLLM at 150k, Claude Code and Qwen Code received the same long prompt: fix two ignored json.Marshal errors in Go, preserve response shape, add deterministic fallback, tests and documentation.

Harness with Qwen3.8-27BScoreTimeCallsResult
Qwen Code100/100502.14 s52accepted
Claude Code through emulation98/1001,732.38 s50correct fallback and 6 tests

Claude Code was 3.45 times slower. That is strong quality and a weak default operating path. It demonstrates compatibility between those particular client and emulator versions, no more.

Decide without a client-brand contest

  1. Give clients the same commit, prompt, context limit, effort and tool policy.
  2. Score with hidden checks the agent cannot see in its prompt.
  3. Reject a contract violation even when public tests pass.
  4. Record client, provider and chat-template versions.
  5. After an update, repeat a small smoke, session resume and one regression task.

OpenCode is a stronger candidate for a documented local profile. Qwen Code won our long task. Codex officially exposes custom-provider configuration. Claude Code emulation has research value, but Anthropic does not support the pairing, so we do not propose it as a company standard.

Syntalith can build two controlled profiles, hidden acceptance checks and an upgrade procedure, then teach the team to evaluate them in the AI-Native course. The service delivers a predictable choice and handover. A home GPU is outside the offer. A free process scan selects the tool from the work and support requirement.

Free process scan

Start with a free process scan.

  • A 30-minute call with the engineer who would lead the work.
  • A review of the processes that cost you the most time and money.
  • A written summary of what to automate first and the likely cost range.

The scan chooses one process to assess, and within 2 business days you receive a recommendation, including when a simpler route is the better fit.

€0

30 minutes · written takeaway within 2 business days

Book a free process scan (30 min)

Times are shown in your own time zone. We work with clients across time zones.

Describe the process in the form