返回目录
模型与 MCP 插件

dsh-qwen-sub-oauth

zznobzz/dsh-qwen-sub-oauth

Qwen Plus/Pro subscription as a DeepSeek Harness provider: OAuth device flow, automatic token rotation, no API key

Stars
0
Forks
0
Issues
0
更新
5 天前

PROJECT TOPICS

项目标签

INSTALL REFERENCE

安装参考

未验证
dsh plugin --profile web add github:zznobzz/dsh-qwen-sub-oauth

该命令指向仓库当前默认分支;尚无绑定当前 commit 的完整验证结果。

PROJECT README

README

dsh-qwen-sub-oauth

Use a Qwen Plus/Pro subscription (chat.qwen.ai) as a model provider in DeepSeek Harness — with OAuth, no API key.

The old free Qwen OAuth (chat.qwen.ai/api/v1/oauth2/*) was shut down on 2026-04-15. The subscription flow Qwen Code uses today is different, and this plugin speaks it: device flow against auth.qwen.ai, OpenAI-compatible gateway at api.qwen.ai/compatible-mode/v1, and automatic token rotation into the DSH credential store.

Русская версия

What it does

  • Registers the provider route qwen-sub-oauth (api.qwen.ai/compatible-mode/v1, models qwen3.8-max, qwen3.8-flash, qwen4-max, 1M context) in llm-pi-ai through the DSH config editor. It tries on activation; if the host refuses the edit while the install transaction is still open, /qwen-setup completes it.
  • Starts the OAuth device flow on activation when no refresh token is stored yet, and prints the verification URL to the host console.
  • While a sign-in is pending, relays the exact approval URL through a system-prompt section, so the assistant shows it verbatim in any chat. Commands: /qwen-login (confirm the pending code or start a fresh flow), /qwen-status (token presence and expiry), /qwen-setup (register the route again if the automatic attempt was refused). The link is also logged to $DSH_HOME/qwen-sub-oauth.log.
  • Refreshes the access token before it expires and writes QWEN_SUB_OAUTH_TOKEN / QWEN_SUB_OAUTH_REFRESH into the credential store. LLM adapters re-read the reference per request, so rotation needs no restart.

Requirements

  • A Qwen account with an active Plus or Pro subscription on chat.qwen.ai. OAuth alone grants no model access.
  • DeepSeek Harness with the llm-pi-ai plugin (every shipped profile has it) and the local credential store.

Install

dsh plugin --profile web add github:zznobzz/dsh-qwen-sub-oauth

The bundle activates live through HMR — no restart needed on a standard profile. (If your host runs with HMR disabled, restart the profile once.)

On first activation the plugin starts the device flow and logs a link such as:

[qwen-sub-oauth] авторизация: https://chat.qwen.ai/authorize?user_code=XXXX-XXXX&client=cli (код XXXX-XXXX)

Open it in a browser (you must already be signed in to chat.qwen.ai), approve the code, and wait for авторизация завершена in the log — or just ask the assistant to show the login link, it relays the live URL from its system prompt. Then run /qwen-setup to register the route. In the GUI, /qwen-login reprints the pending link or starts a new one, /qwen-status shows the current state.

Usage

Pick Qwen (подписка OAuth) in the model selector and choose qwen3.8-max, qwen3.8-flash or qwen4-max.

/qwen-login     # pending verification link + code, or a fresh flow
/qwen-status    # authorized? when does the access token expire?
/qwen-setup     # add the provider route to llm-pi-ai again

Configuration

- insert:
    - id: qwen-sub-oauth
      name: dsh-qwen-sub-oauth
      config:
        autoLogin: true        # start the device flow on activation when not signed in
        configureRoute: true   # register the pi-ai route when it is absent
        intervalMs: 600000     # token refresh tick

If you prefer to declare the route yourself, disable configureRoute and add it to your profile patch:

- id: llm-pi-ai
  name: "@deepseek-ai/dsh-llm-pi-ai"
  config:
    providers:
      qwen-sub-oauth:
        displayName: Qwen (OAuth subscription)
        api: openai-completions
        baseURL: https://api.qwen.ai/compatible-mode/v1
        apiKeyEnv: QWEN_SUB_OAUTH_TOKEN
        models:
          - id: qwen3.8-max
            name: Qwen3.8 Max
            contextWindow: 1000000
            maxTokens: 32768

How the flow works

Step Request
Device code POST https://auth.qwen.ai/api/oauth/device/code — client_id=qwen-code-cli, scope="model:invoke profile:read"
User approves https://chat.qwen.ai/authorize?user_code=…&client=cli (the advertised /device URI has no SPA route)
Token POST https://auth.qwen.ai/api/oauth/token — grant_type=urn:ietf:params:oauth:grant-type:device_code
Refresh POST https://auth.qwen.ai/api/oauth/token — grant_type=refresh_token
Profile GET https://auth.qwen.ai/api/oauth/userinfo
Model calls POST https://api.qwen.ai/compatible-mode/v1/chat/completions with Authorization: Bearer <access_token>

A User-Agent of the QwenCode/… shape is mandatory: Aliyun WAF answers 405 and an HTML stub to default HTTP-client agents.

Troubleshooting

  • MISSING_CREDENTIAL / PROXY_TOKEN_MISSING — no token in the store: run /qwen-login.
  • invalid_grant during refresh — the refresh token was revoked: rerun /qwen-login (delete QWEN_SUB_OAUTH_REFRESH first if the plugin still considers you signed in).
  • 405 plus HTML instead of JSON — a request went out without the QwenCode/… User-Agent.
  • The verification link lands on the chat home page — use the /authorize link this plugin prints. The device URI that the token endpoint advertises has no route in the deployed SPA; /authorize?user_code=…&client=cli is what Qwen Code itself opens.
  • No route in the model selector — run /qwen-setup; if it reports a configuration error, add the provider block manually or restart the profile.

Uninstall

dsh plugin --profile web remove dsh-qwen-sub-oauth

Remove the qwen-sub-oauth provider block from your profile patch and unset the stored credentials if you want the tokens gone.

Security and terms

  • Tokens live only in the DSH credential store ($DSH_HOME/.credentials.yaml, mode 0600); nothing is written into configuration.
  • client_id=qwen-code-cli is the public Qwen Code CLI client. Using its tokens from a third-party client is a grey area of Qwen's terms of service; quotas follow your subscription plan.
  • Never send your Qwen password or account credentials to any "subscription proxy" service. Revoke access by removing the stored tokens.

MIT licensed.

CLASSIFICATION EVIDENCE

分类依据

项目类型插件
功能分类模型与 MCP
规则置信度高

系统优先读取 GitHub Topics,再与站内分类词典和词根规则比对。当前命中: llm-provider、deepseek-harness。