Files
qwenwork-autoreg/README.md
T

3.9 KiB

Tool use / local PC access

QwenWork's own desktop CLI (resources/agent-sdk/components/qwencode/.../qwen-code, ACP mode --acp, QWENWORK_QWENCODE_PROMPT_CAPABILITY=native-tools-v1) does have native tools, but its provider is pinned to DashScope inside the build: --auth-type openai plus OPENAI_BASE_URL / DASHSCOPE_PROXY_BASE_URL / QWENWORK_MODEL_PROXY_TARGET still send the request to dashscope.aliyuncs.com and return 401 Incorrect API key provided for any foreign key. So the desktop harness cannot be repointed at an arbitrary endpoint.

Instead qw_agent.py gives the same result with full control — an OpenAI-compatible tool loop over this PC: fs_read, fs_write, fs_list, fs_grep, shell.

# any OpenAI-compatible backend, e.g. the qwenwork shim when the pool has credits
python qw_agent.py --base http://127.0.0.1:48981/v1 --model qw-flash \
  --prompt "read C:/Users/User/tmp/qwrepo/README.md and report total_lines"

Proof run (local router, deepseek-v4.1-flash-1017, 3 turns):

[assistant] ...
[tool] fs_read {'path': 'C:/Users/User/tmp/qwrepo/README.md'}
[tool] shell   {'command': 'wc -l C:/Users/User/tmp/qwrepo/README.md'}
[tool] fs_read {'path': '...', 'offset': 70}
result: tools_used = ["fs_read", "shell", "fs_read"] -> answer "total_lines = 79"

The model reads the real filesystem and runs real commands on the host: that is the "PC visible" part, without depending on the closed desktop client. {"code":"ok"}. **captcha_tokenmust be the whole 2captchasolutionobject serialised as a JSON string** — an object body gives 400,solution.dataalone gives 403human verification failed. 3. read the 6-digit code from the mailbox over IMAP (qwenwork mail, used_codes.txtguards against reusing someone else's code inside the same minute). 4.POST /auth/local/register {email, code, notification:false}->{"created":true,"user":{...}}, JWT lands in cookie token(403 chars). 5. Existing address ->409 email-exists; use POST /auth/local/login {email, code}`.

export QW_2CAP=~/.2cap_key QW_GMAIL=you@gmail.com QW_GMAIL_PASS=app-password
python farm.py you+qw1@gmail.com --register
python farm.py you+qw1@gmail.com --login      # if the address already exists

Shim

QW_POOL=./accounts.jsonl QW_PORT=48981 python qw_shim.py
curl -s localhost:48981/v1/chat/completions -H 'Content-Type: application/json' \
  -d '{"model":"qw-flash","messages":[{"role":"user","content":"hi"}]}'

402/401/403 from upstream puts the account on a 15-minute cooldown and the request is retried on the next account. mode is mapped from the OpenAI model name; unknown names -> 404.

Known blocker: credit hold

When a chat session is created, QwenWork blocks the whole remaining balance on that account (/user/billings -> {"type":"Blocked","amount":-699.83,"detail":{"title":"Credits blocked"}}) if the turn is not completed through the WebSocket session protocol. The hold is not released by DELETE /api/chat-sessions/{id}, PATCH, or any REST endpoint we found; REST sessions also keep end_time=null forever. Practically: one botched/half-read session zeroes the account.

Mitigation used here: wait for a real agent_message_chunk (not just result/prompt_response), close the session afterwards, and never issue a second session on an account whose previous turn returned no text. Proper fix is the /api/chat-ws protobuf session lifecycle.

Notes

  • qwenwork.cn has email login disabled (/auth/email-codes -> 404); CN entry goes through Alibaba fast-auth (needs a mainland account/phone).
  • Starter credits stopped being granted after ~2026-11-20 20:50 UTC in our tests; accounts created later report remaining 0, exceeded true and 402 INSUFFICIENT_RESOURCES on session start.
  • Google OAuth entry exists: /auth/google -> accounts.google.com, redirect_uri=/oauth-callback/google, client_id 376662729962-6p89qbb0nd7e2vqr2da3jd7315mbnvdn.