DeepSeekDSH
中文GitHub
Menu
Independent community guideNot affiliated with DeepSeek.Download versions and guide references

Qwen 4 & Qwen4-Max in DSH: Pricing, 1M Context & Setup

Connect Alibaba's Qwen4-Max to DeepSeek Harness: flat-rate 1M context ($1.50/$4.50), DashScope vs Token Plan URLs, and Qwen 4 vs local 27B open weights.

On this page
Architectural diagram connecting Qwen4-Max 1M flat-rate cloud inference and local open-weight models to DSH

Alibaba Cloud rolled out Qwen4-Max (qwen4-max, following the November 11, 2026 qwen4-max-preview launch) on Model Studio / DashScope with one billing feature that coding-agent users immediately notice: a full 1-million-token context window at a flat $1.50 input / $4.50 output per million tokens, with no long-context surcharge cliff.

At the same time, developers searching for qwen 4, qwen 4 27b, or qwen 4 open weights often mix up three separate things: cloud-hosted qwen4-max API keys, Alibaba's Qwen Token Plan subscription endpoints, and local open-weight Qwen models running in Ollama or LM Studio. This guide separates all three and walks through exact DeepSeek Harness (DSH) setup.

Cloud qwen4-max vs Token Plan vs local open weights

Using Alibaba Cloud Model Studio's model catalog, OpenAI compatibility docs, and DeepSeek API pricing, compare which Qwen route matches your hardware and billing setup:

Route / ModelExact Model IDContext & Pricing (USD / 1M tokens)Where It Runs & DSH Route
Qwen4-Max (DashScope Pay-as-you-go)qwen4-max (or qwen4-max-preview)1M flat rate: $1.50 input / $4.50 output / $0.075 cachedAlibaba Cloud Model Studio API; add as Custom Provider (openai-completions) in DSH
Qwen Token Plan (Subscription)Catalog entry under Token PlanBundled quota under Alibaba Coding / Token PlanBuilt-in qwen-token-plan (Intl) or qwen-token-plan-cn (China) card in DSH
Local Open-Weight Qwen (27B class)e.g. qwen3.8-27b quantized GGUF$0 API bill; requires 24 GB+ local VRAM / unified memoryRuns locally via Ollama or LM Studio (see our local Qwen 27B DSH guide)
DeepSeek V4.1 Flash (Comparison)deepseek-flash1M context: $0.30 / $1.20 ($0.15 / $0.60 off-peak)Built-in DeepSeek card in DSH; lowest per-token cost for routine repository work

Why the flat 1M window matters for coding agents: OpenAI's gpt-6.2-sol ($2 / $10) surcharges requests above 272K input tokens, and Gemini 4 frontier models step up pricing above 200K input tokens. qwen4-max keeps the same $1.50 / $4.50 rate across the entire 1M window and drops cached prefix reads by 95% to $0.075 / 1M.

4-step setup: connect qwen4-max to DeepSeek Harness (DSH)

Before pasting a key, check which Alibaba product issued it—mixing standard DashScope keys with Qwen Token Plan endpoints is the #1 cause of 401 Unauthorized errors (full regional breakdown in our Qwen & DashScope provider tutorial).

Step 1: Create a DashScope API key in the matching region

Open the Alibaba Cloud Model Studio / Bailian console for China (cn-beijing) or the international Model Studio console (ap-southeast-1 Singapore) and copy your sk-... API key. Keys from China and Singapore consoles are completely separate.

Step 2: Add a Custom Provider in DSH for standard DashScope keys

In DSH, open Settings → Models → Add model provider → Custom model API and fill in the exact regional values:

Provider name: dashscope-qwen4
Protocol:      openai-completions
Base URL:      https://dashscope-intl.aliyuncs.com/compatible-mode/v1   (or dashscope.aliyuncs.com/compatible-mode/v1 for China)
API Key:       sk-your_dashscope_key
Model ID:      qwen4-max

*(Using Qwen Token Plan instead of standard pay-as-you-go DashScope? Pick the built-in Qwen Token Plan or Qwen Token Plan China card under Third-party providers instead of using the URLs above!)*

Step 3: Optional Anthropic Messages compatibility path

Model Studio also exposes an Anthropic-compatible endpoint for tools expecting anthropic-messages. In DSH, standard openai-completions above is the cleanest path and supports Fetch available models via /models, so stick to compatible-mode/v1 unless you are testing Anthropic-specific middleware.

Step 4: Verify in a fresh session and disposable folder

Click New session, choose an empty dsh-test workspace, select qwen4-max, and send a read-only check:

Reply with the active workspace status only. Do not create or modify any files.

Common questions

Can I download qwen4-max open weights to run offline in Ollama?

No—qwen4-max is Alibaba's proprietary flagship cloud model served through Model Studio / DashScope. When developers search for qwen 4 27b or local open weights, check Hugging Face or ModelScope for Alibaba's explicitly open-licensed dense/MoE releases (and follow our local Qwen 3.8 27B DSH setup guide to size your GPU VRAM before downloading).

Why does my sk-... key return 401 on qwen-token-plan in DSH?

Because a standard pay-as-you-go DashScope API key only authenticates against dashscope.aliyuncs.com (China) or dashscope-intl.aliyuncs.com (International), whereas qwen-token-plan routes to token-plan.*.maas.aliyuncs.com. Match the endpoint to the exact billing plan you activated.

Does qwen4-max charge double when my repository prompt passes 256K tokens?

Under Model Studio's published qwen4-max pricing, standard input and output rates stay flat across its 1M context window rather than doubling at 128K or 256K. Even so, passing unnecessary build artifacts slows down time-to-first-token—let DSH's file search read targeted files first.

Should I use qwen4-max or qwen4-max-preview?

Use qwen4-max for stable day-to-day coding sessions so your behavior does not shift unexpectedly mid-sprint. Reserve qwen4-max-preview for testing newer snapshot capabilities in a separate session.

Model and workflow guides

Models and costs

Gemini 4 Carbon Guide: Dec 1 Price Jump & Opus 5.5

Compare Gemini 4 Carbon with Neon, Argon, and Claude Opus 5.5: check the Dec 1 2x API price jump ($2/$10 to $4/$20), 95% cache rules, and DSH setup.

Read →
Models and costs

Gemini 4 Neon is here. When is it worth switching models?

Compare Gemini 4 Neon with Hydrogen and GPT-6.2 Sol, see a $0.45 API cost breakdown, and set up Neon step by step in Gemini, Antigravity, or DSH.

Read →
Models and costs

GPT-6.2 Astra & Sol Guide: Specs, Pricing & Choice

Beginner guide to OpenAI's GPT-6.2 Astra and Sol: Claude vs DeepSeek price table, plain-English benchmarks, 272K cliff, and step-by-step DSH & Python setup.

Read →
Models and costs

GPT-6.1 Terra Guide: Uses, Pricing and Sol Comparison

Beginner guide to OpenAI's GPT-6.1 Terra: half-price visual, computer-use, and writing model compared with Sol and DeepSeek, plus DSH and Python setup steps.

Read →
Model setup and costs

Connect Local Qwen 3.8 27B to DSH

Beginner guide to connecting local Qwen 3.8 27B to DSH: GPU memory table, LM Studio / Ollama / llama.cpp port setup, exact 5-field config, and error fixes.

Read →
Model setup and costs

Codex Costs: API Billing vs Subscription Usage

Beginner guide to OpenAI Codex costs: ChatGPT Plus login vs API-key billing table, real per-prompt dollar math, and 3 steps to lock a monthly budget cap.

Read →
Model setup and costs

Connect Grok API to DSH: Setup & Tools

Step-by-step beginner guide to connecting xAI's Grok API (grok-4.7) to DSH: Grok vs Groq comparison, exact 5-field custom provider setup, and 401/404 fixes.

Read →
Model setup and costs

Choose a Gemini Model by Task and Cost

Beginner guide to Google Gemini model selection: compare 3.8 Flash, 4 Argon, and DeepSeek prices, watch 2027 rate changes, and set up DSH in 4 simple steps.

Read →
Model benchmarks and engineering

Gemini 4 Argon Coding Benchmarks & 1M Window

Beginner guide to Google's Gemini 4 Argon coding scores vs Claude and GPT, how its shared 1M window and 65K output cap work, plus 4-step DSH setup.

Read →
API costs and enterprise ROI

Gemini 4 Argon API Pricing, Cache & ROI Guide

Beginner guide to Gemini 4 Argon API pricing: Dec 2026 2x rate jump, how 95% auto-caching and thinking tokens bill, DeepSeek cost comparison, and calculator.

Read →
Model setup and costs

Claude Sonnet vs Opus: Which Should You Use?

Beginner guide to Claude Sonnet 5.5 vs Opus 5.5: side-by-side API prices, per-prompt cost math, clear rules on when to upgrade, and 4-step DSH setup.

Read →
Models and costs

Opus 5.5 vs Fable 5.2: Which Model Is Right for You?

Beginner guide to Claude Opus 5.5 vs Fable 5.2: side-by-side API prices, coding benchmarks, per-task cost math, 30-day retention rules, and 4-step DSH setup.

Read →
Content creation

How to draft a video script with Media Desk for DeepSeek Harness

Install Media Desk (dsh-media-desk) in DeepSeek Harness and turn a one-line phone note into a video script, storyboard, and cover step by step.

Read →
Mobile and remote access

Use DeepSeek Harness on Your Phone: Beginner Guide

Zero-jargon beginner guide to using DeepSeek Harness on your phone: find your computer IP, connect over home Wi-Fi in 2 minutes, or use Tailscale on 4G/5G.

Read →
Model interfaces and workflows

MiniMax H3 vs M-Series in DSH: Which Works?

Beginner guide to MiniMax H3 vs M3 in DSH: why H3 is for video while M3 handles coding, how to avoid region 401 errors, and 4-step DSH setup instructions.

Read →
API credentials and troubleshooting

Kimi API Key Errors: Region, Model and Permissions

Beginner fix guide for Kimi / Moonshot API key errors: match .ai vs .cn URLs, avoid retired model names and K3 Max typos, decode 401/404/429, and set up DSH.

Read →