Qwen4-35B-A3B Local vs Cloud Coding APIs: Hardware Math, Caching, and Hybrid Setup (2026)
Alibaba's Apache-2.0 Qwen/Qwen4-35B-A3B fits on a 32 GB Mac at 21.9 GB of resident RAM (Q4_K_M under llama.cpp --lazy-mode auto) with a 1M native context window, yet multi-file agent loops over 100K+ repository contexts still favor cloud frontier APIs with prompt caching. Created on Hugging Face on 2026-12-03 and updated on 2026-12-04, it offloads its 20B Per-Layer N-gram Embedding table to SSD for zero-token-fee offline drafting. As of 2026-12-04, Qwen4-35B-A3B and Qwen4-Max are not listed on QCode /models, so developers running hybrid setups pair a local server with cloud models (claude-opus-5-5, gpt-6.2-sol, gemini-4-neon, and QCode's listed Chinese models) under one cr_ key.
QCode is an independent third-party model API service, not affiliated with or endorsed by Alibaba/Qwen, DeepSeek, Anthropic, OpenAI, or Google. Facts in this guide were verified on 2026-12-04 against the official documentation linked below.
Updated 2026-12-04
Key facts
Qwen/Qwen4-35B-A3B(Apache-2.0, Dec 2026): 35B main MoE (~3B–3.8B active across 256 experts, 8 routed + 1 shared) + 20B PLE + 2B MTP (56.8B safetensors total), native 1,048,576 context, multimodal text/image/video input, and hosted QwenCloud reference pricing of $0.06/$0.36 per 1M tokens ($0.003 cached read).- Local GGUF RAM (
llama.cpp --lazy-mode auto): Keeps the 14.1–21.8 GB PLE table on SSD;Q4_K_Mneeds 36.0 GB disk / 21.9 GB RAM (32 GB Mac),Q6_K51.0 GB / 29.2 GB (48 GB Mac),Q8_059.4 GB / 37.6 GB (64 GB Mac), andBF16111.1 GB / 70.1 GB. Qwen4-Max(Nov 15–16, 2026): 2.4T sparse MoE API flagship with 1M context, priced at $1.50/$4.50 per 1M tokens on QwenCloud and Alibaba Cloud Model Studio International (Singapore) / US (Virginia), with $0.075/1M cache reads.- DeepSeek Dec 2026 context:
DeepInfer(Apache-2.0, Dec 1DeepSeek-V4.1-Flashupdate) targets 4–64 NVIDIA SM100 GPUs or 8–64 Huawei Ascend 950DT NPUs, while DeepSeek's Systemic Risk Management Policy (last modified 2026-12-03) splits Channel A (MIT open weights with guardrail-free evals) from Channel B (Web/API with external guardrails). - QCode status on 2026-12-04:
Qwen4-35B-A3BandQwen4-Maxare not listed on QCode/models. QCode listsqwen3.8-max,deepseek-v4.1-flash,kimi-k3.1-pro, andglm-5.3(billed at the live/modelsrate) alongsideclaude-opus-5-5($4/$20),gpt-6.2-sol($2/$10), andgemini-4-neon($3/$15, live on/geminisince 2026-12-03). - Gemini 4 family note: Only
gemini-4-neonis publicly listed on QCode/models;gemini-4-carbon,gemini-4-argon, andgemini-4-hydrogenare not listed on QCode yet. - Prompt caching: Cuts repeated repo-prefix reads to $0.10–$0.20 per 1M tokens on cloud frontier models (
claude-opus-5-5$0.20,claude-sonnet-5-5andgpt-6.2-sol$0.10,gemini-4-neon$0.15 implicit with $0 storage).
What Alibaba and DeepSeek shipped in early December 2026
Early December 2026 clarified the split between local open weights and cluster-scale cloud APIs: Alibaba released Apache-2.0 Qwen4-35B-A3B for developer machines after launching Qwen4-Max, while DeepSeek updated datacenter DeepInfer and formalized two-channel release governance.
Per the Qwen/Qwen4-35B-A3B model card (repo created 2026-12-03T02:45:46Z, updated 2026-12-04T04:11:15Z) and the Hugging Face + Qwen4 launch blog, Qwen4-35B-A3B is a multimodal (Text, Image, and Video -> Text) hybrid MoE with 40 layers arranged as 10 × (3 × (Gated DeltaNet → MoE) → 1 × (Qwen Sparse Attention → MoE)) and 4-branch Gated Residual connections. Its 35B main parameters span 256 experts (8 routed + 1 shared active, ~3B–3.8B active per token), paired with a 20B Per-Layer N-gram Embedding (PLE) table (10,000,000 bigrams/trigrams at layer 2) and a 2B 1-layer Multi-Token Prediction (MTP) head, totaling 56,823,261,843 safetensors parameters. It supports 1,048,576 native context tokens with recommended output caps of 262,144 reasoning tokens and 131,072 final-response tokens. Hosted reference pricing on QwenCloud is $0.06 input / $0.36 output per 1M tokens ($0.003 implicit/explicit cache read, $0.075 5m write, $0.12 1h write).
Alibaba positioned that open release alongside Qwen4-Max (introduced Nov 15–16, 2026): a closed-weight 2.4T sparse MoE API model with a 1M context window priced at $1.50/$4.50 per 1M tokens on International (Singapore) and US (Virginia) endpoints, with $0.075/1M cache reads (see our Qwen 4 release timeline and Qwen4-Max API pricing guide).
DeepSeek's early-December updates highlight why frontier open-weight serving rarely replaces cloud APIs on laptops. On December 1, 2026, DeepSeek published a major DeepSeek-V4.1-Flash update to deepseek-ai/DeepInfer (Apache-2.0, created Oct 16, 2026) adding FlashMLA, DeepGEMM, DeepEP, TileKernels, and Ascend 950DT NPU (CANN 9.3) / NVIDIA SM100 GPU (CUDA 13.2+) optimizations benchmarked on 4–8 accelerators for prefill and 64 for decode. Days later (PDF last modified 2026-12-03), DeepSeek's Systemic Risk Management Policy Summary separated Channel A (public MIT open-weight downloads requiring guardrail-free evaluation across cyberattacks, chemical/biological risks, harmful manipulation, and loss of control) from Channel B (Web/API services with external guardrails). Channel B approval does not clear Channel A, and frontier L3 models block open-weight release without a documented safety margin—meaning top reasoning tiers will often ship API-first.
As of 2026-12-04, neither Qwen4-35B-A3B nor Qwen4-Max is listed on QCode /models. QCode serves qwen3.8-max, deepseek-v4.1-flash, kimi-k3.1-pro, and glm-5.3 (billed at the live /models rate) alongside claude-opus-5-5, gpt-6.2-sol, and gemini-4-neon.
Real hardware and RAM math for running Qwen4-35B-A3B locally
Qwen4-35B-A3B runs on 32 GB to 64 GB Macs because llama.cpp --lazy-mode auto leaves the 14.1–21.8 GB PLE n-gram table on SSD instead of pinning all 56.8B parameters into unified memory.
The model card links local paths for llama.cpp, ollama, unsloth, mlx-vlm (oMLX, which also offloads PLE to SSD on Apple Silicon), and LiteRT-LM. The official ggml-org/Qwen4-35B-A3B-GGUF repo documents exact disk sizes and resident RAM under --lazy-mode auto:
| Quantization | Disk Size (GGUF) | Resident RAM (--lazy-mode auto) |
Verified Mac Target | Practical Headroom |
|---|---|---|---|---|
| Q4_K_M | 36.0 GB | 21.9 GB | 32 GB Mac | ~10 GB left for OS, IDE, build tools, and KV cache |
| Q6_K | 51.0 GB | 29.2 GB | 48 GB Mac | Comfortable room for moderate multi-file context |
| Q8_0 | 59.4 GB | 37.6 GB | 64 GB Mac | Near-lossless local quant with larger KV cache budget |
| BF16 | 111.1 GB | 70.1 GB | Workstation (>70.1 GB RAM) | Full precision; exceeds standard laptop memory |
Optional add-ons add modest footprints: mmproj vision (903 MB BF16) and the mtp speculative-decoding head (1.29 GB Q4_K_M, 2.02 GB Q8_0, 3.76 GB BF16; +22% decode speed on Apple Silicon M5 at Q4 with 3 draft tokens).
The practical bottleneck is KV cache plus IDE overhead, not static weights. On a 32 GB Mac running Q4_K_M, 21.9 GB of resident weights leaves ~10 GB for macOS, VS Code, language servers, test runners, and KV cache. Single-file edits, commit messages, and targeted questions run smoothly; feeding 100K+ repository tokens into local KV cache quickly triggers memory pressure and slow prompt prefill even though the architecture supports 1M tokens natively.
Local Qwen4-35B-A3B vs cloud frontier coding APIs
Local Qwen4-35B-A3B removes per-token fees and external traffic for small offline tasks, while cloud frontier APIs handle 100K+ repository contexts and multi-file agent loops with predictable latency and low cached-read costs.
| Model & Route | Context / Output | Token Rate per 1M (In / Out) | Prompt Cache Read | QCode Status (2026-12-04) | Primary Coding Role |
|---|---|---|---|---|---|
| Qwen4-35B-A3B (Local GGUF) | 1,048,576 native (RAM-bound) | Local hardware (QwenCloud ref: $0.06 / $0.36) | Local KV reuse only | Not listed on QCode /models |
Offline drafts, private single-file edits |
claude-opus-5-5 (QCode /api) |
1M flat / 128K output | $4.00 / $20.00 (official API price ×1.0) | $0.20 / 1M (512-token min) | Live on /api |
Complex multi-file architecture & refactoring |
gpt-6.2-sol (QCode /openai, /openai/v1) |
>272K triggers 2× in / 1.5× out | $2.00 / $10.00 (>272K: $4 / $15; official API price ×1.0) | $0.10 / 1M (>272K: $0.20) | Live on /openai & /openai/v1 |
Fast agentic loops, Codex Responses API, review |
gemini-4-neon (QCode /gemini) |
1,048,576 unified / 65,536 sync | $3.00 / $15.00 (official API price ×1.0) | $0.15 / 1M implicit ($0 storage, >=4,096 prefix) | Live on /gemini (since 2026-12-03) |
High-frequency coding & 1M-context repos |
deepseek-v4.1-flash (QCode /api, /openai/v1) |
Cloud-hosted MoE | Billed at live /models rate |
See /models |
Live on /api & /openai/v1 |
High-volume bilingual / Chinese coding tasks |
Three coding-agent realities explain why teams keep cloud APIs alongside local weights:
- Multi-file agent loops: Claude Code, OpenCode, and Cline execute 10–40 sequential tool turns carrying system rules, MCP schemas, diffs, and compiler output. Cloud frontier models (
claude-opus-5-5,gpt-6.2-sol,gemini-4-neon) hold cross-file invariants with fewer failed edits than a 3B-active local quant. - 100K+ repository context latency: Local laptops stall on long prefill and compete with builds for RAM. In the cloud,
claude-opus-5-5andclaude-sonnet-5-5($2/$10, cache read $0.10) charge flat rates across the entire 1M window,gemini-4-neonoffers 1,048,576 unified context, andgpt-6.2-solstays at $2/$10 up to 272K tokens ($4/$15 above 272K). Note that onlygemini-4-neonis listed on QCode/modelsright now;gemini-4-carbon,gemini-4-argon, andgemini-4-hydrogenare not listed on QCode yet. - Prompt caching economics: Stable prefixes drop cloud read costs by 90%–95% (
$0.20/1M onclaude-opus-5-5,$0.10/1M onclaude-sonnet-5-5andgpt-6.2-sol,$0.15/1M implicit ongemini-4-neonwith zero storage fee). See prompt caching across Claude, GPT, and DeepSeek and Qwen4-Max vs DeepSeek V4.1 vs Kimi K3.1.
Practical hybrid setup in OpenCode, Cline, and Claude Code
A hybrid workflow uses local Qwen4-35B-A3B for offline drafts and routes heavy multi-file refactoring and code review through one QCode cr_ key across OpenCode, Claude Code, and Cline.
OpenCode (~/.config/opencode/opencode.json)
OpenCode (v2.4.4, MIT) supports local OpenAI-compatible servers alongside QCode's Anthropic, OpenAI, and Gemini routes in one file, switched inline via /model. Because OpenCode's @ai-sdk/anthropic appends /messages without /v1, set Anthropic baseURL to https://api.qcode.cc/api/v1 (or /claude/v1), OpenAI to /openai/v1, Google to /gemini/v1beta, and local Qwen4-35B-A3B via @ai-sdk/openai-compatible:
{
"$schema": "https://opencode.ai/config.json",
"provider": {
"local-qwen4": {
"npm": "@ai-sdk/openai-compatible",
"name": "Local Qwen4-35B-A3B",
"options": {
"baseURL": "http://127.0.0.1:8080/v1",
"apiKey": "local"
},
"models": {
"Qwen4-35B-A3B": {
"name": "Qwen4-35B-A3B (Local)"
}
}
},
"anthropic": {
"npm": "@ai-sdk/anthropic",
"options": {
"baseURL": "https://api.qcode.cc/api/v1",
"apiKey": "{env:QCODE_API_KEY}"
}
},
"openai": {
"npm": "@ai-sdk/openai",
"options": {
"baseURL": "https://api.qcode.cc/openai/v1",
"apiKey": "{env:QCODE_API_KEY}"
}
},
"google": {
"npm": "@ai-sdk/google",
"options": {
"baseURL": "https://api.qcode.cc/gemini/v1beta",
"apiKey": "{env:QCODE_API_KEY}"
}
}
},
"model": "anthropic/claude-opus-5-5"
}
Claude Code (~/.claude/settings.json)
For heavy terminal refactoring, point Claude Code at QCode's Anthropic endpoint. Unlike OpenCode, Claude Code appends /v1/messages itself, so keep ANTHROPIC_BASE_URL at https://api.qcode.cc/api without /v1:
{
"$schema": "https://json.schemastore.org/claude-code-settings.json",
"env": {
"ANTHROPIC_BASE_URL": "https://api.qcode.cc/api",
"ANTHROPIC_AUTH_TOKEN": "cr_your_key",
"ANTHROPIC_MODEL": "claude-opus-5-5"
}
}
You can also run QCode's listed Chinese models (qwen3.8-max, deepseek-v4.1-flash, kimi-k3.1-pro, glm-5.3) on /api—see running DeepSeek, GLM, Kimi, and Qwen in Claude Code.
Verification and Cline (v4.1.28) routing
Verify your QCode key with GET /api/v1/models (invalid/missing keys return HTTP 401 JSON invalid_api_key; valid cr_ keys return HTTP 200) and export QCODE_API_KEY for OpenCode:
export QCODE_API_KEY="cr_your_key"
# Verify QCode Anthropic endpoint (expect HTTP 200 JSON model list)
curl -sS -o /dev/null -w "%{http_code}\n" \
-H "Authorization: Bearer $QCODE_API_KEY" \
https://api.qcode.cc/api/v1/models
# Launch Claude Code on the default flagship model
claude --model claude-opus-5-5
In VS Code Cline (v4.1.28, Apache-2.0):
- Local Qwen4-35B-A3B: API Provider = OpenAI Compatible with your exact local /v1 URL (Cline v4.1.25+ does not auto-append /v1).
- Cloud Claude (QCode): API Provider = Anthropic, Use custom base URL = https://api.qcode.cc/api, key = cr_your_key, model = claude-opus-5-5.
- Cloud GPT or listed Chinese models (QCode): API Provider = OpenAI Compatible, Base URL = https://api.qcode.cc/openai/v1, same cr_your_key, model = gpt-6.2-sol, deepseek-v4.1-flash, or qwen3.8-max.
Respect QCode's protocol boundaries: claude-* runs only on /api, gpt-* only on /openai/v1 or /openai, gemini-4-neon only on /gemini (/gemini/v1beta in OpenCode), and listed Chinese models on both /api and /openai/v1. Regional hosts (https://asia.qcode.cc, https://us.qcode.cc) accept the same cr_ key.
FAQ
Can a 32 GB Mac run Qwen4-35B-A3B locally for coding?
Yes, at Q4_K_M. Under llama.cpp --lazy-mode auto, Q4_K_M uses 36.0 GB of disk space and 21.9 GB of resident RAM by leaving the PLE table on SSD. That fits single-file drafting on a 32 GB Mac, though 100K+ repository contexts and heavy IDE builds will crowd the remaining ~10 GB.
Is Qwen4-35B-A3B or Qwen4-Max available on QCode?
No. As of 2026-12-04, neither Qwen4-35B-A3B nor Qwen4-Max is listed on QCode /models. QCode currently lists qwen3.8-max, qwen3.7-plus, deepseek-v4.1-flash, kimi-k3.1-pro, and glm-5.3 (billed at the live /models rate) alongside claude-opus-5-5, gpt-6.2-sol, and gemini-4-neon.
Why does Qwen4-35B-A3B need 36.0 GB of disk space for Q4_K_M but only 21.9 GB of RAM?
Its 20B Per-Layer N-gram Embedding (PLE) table takes 14.1–21.8 GB on disk depending on quantization. With llama.cpp --lazy-mode auto (or Apple Silicon oMLX SSD offloading), that table stays on SSD and is read on demand rather than occupying resident RAM.
How does DeepSeek's December 2026 Channel A vs Channel B policy affect local vs cloud coding?
DeepSeek's Systemic Risk Management Policy (last modified 2026-12-03) separates MIT open-weight releases (Channel A, requiring guardrail-free evaluation) from Web/API services (Channel B, with external guardrails). Because Channel B clearance does not automatically clear Channel A—and frontier L3 models block open weights without a documented safety margin—top reasoning models will remain API-first.
When is a cloud coding API faster or more practical than local Qwen4-35B-A3B?
Cloud APIs win on 100K+ repository contexts and multi-file tool loops where local KV cache growth causes slow prefill or memory pressure. With prompt caching cutting repeated reads to $0.10–$0.20 per 1M tokens on claude-opus-5-5, claude-sonnet-5-5, gpt-6.2-sol, and gemini-4-neon, complex debugging finishes with fewer retries than pushing a local Q4_K_M quant past its memory ceiling.
Can one QCode API key run Claude Opus 5.5, GPT-6.2 Sol, Gemini 4 Neon, and Chinese models in a hybrid workflow?
Yes. One QCode cr_ key authenticates /api (Claude and listed Chinese models), /openai/v1 and /openai (GPT and listed Chinese models), and /gemini (gemini-4-neon). Pair those routes in OpenCode or Cline with your local Qwen4-35B-A3B server for offline work.
Pairing local Qwen4-35B-A3B with cloud frontier APIs on one QCode key
Keep local Qwen4-35B-A3B for zero-cost offline drafts and backstop heavy multi-file refactoring with a single QCode cr_ key: claude-opus-5-5, gpt-6.2-sol, and gemini-4-neon are billed at official API price ×1.0, while listed Chinese models (qwen3.8-max, deepseek-v4.1-flash, kimi-k3.1-pro, glm-5.3) are billed at the live /models rate. For occasional cloud bursts, pay-as-you-go packs start at $4 ($30 quota, valid 7 days, stackable on renewal) on /pay-as-you-go; for daily coding sessions, 30-day plans reset at 00:00 UTC+8 from Starter at $9 ($5/day) up to Daily 20 at $32.86 ($20/day) and Daily 35 at $53.57 ($35/day) on /pricing. Check live model IDs and rates on /models.