add qw_agent.py: OpenAI-compatible tool-use loop with local PC access (fs_*, shell)
This commit is contained in:
@@ -1,37 +1,35 @@
|
||||
# qwenwork-autoreg
|
||||
|
||||
Autoreg + private API reverse for **qwenwork.ai** (Qwen Work): HTTP-only account farm, OpenAI-compatible shim, full protocol notes.
|
||||
No browser needed except captcha, which is solved through 2captcha.
|
||||
## Tool use / local PC access
|
||||
|
||||
```
|
||||
farm.py autoreg / login -> accounts.jsonl {email, jwt}
|
||||
qw_shim.py OpenAI-compatible gateway (:48981 /v1/chat/completions)
|
||||
api.md reverse-engineered API reference
|
||||
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`.
|
||||
|
||||
```bash
|
||||
# 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"
|
||||
```
|
||||
|
||||
## Models (server catalog, `GET /api/chat-modes`)
|
||||
Proof run (local router, `deepseek-v4.1-flash-1017`, 3 turns):
|
||||
|
||||
| mode key | price_factor | notes |
|
||||
|---|---|---|
|
||||
| `kimi-k3.1-pro` | 2.6 | vision, 1M ctx |
|
||||
| `qwen3.8-max` | 1.9 | vision |
|
||||
| `qwen4-max` | 1.4 | vision, anthropic-format |
|
||||
| `glm-5.3` | 1.3 | |
|
||||
| `gpt-6.1-sol` | 1.0 | vision |
|
||||
| `deepseek-v4.1-flash`, `deepseek-flash` | 0.2 | |
|
||||
| `glm-5.3-flash` | 0.2 | vision |
|
||||
| `minimax-m3.1-flash` | 0.2 | vision, anthropic-format |
|
||||
| `qwen3.8-flash` | 0.1 | default |
|
||||
| `flash` / `advanced` / `pro` | aliases | rank tiers |
|
||||
```
|
||||
[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"
|
||||
```
|
||||
|
||||
Measured turn price from `/user/billings`: **0.016 – 0.044 credit** for `flash`.
|
||||
Free tier advertises 500 starter + 200 daily credits -> tens of thousands of turns in theory.
|
||||
|
||||
## Autoreg flow (plain HTTP, no JS)
|
||||
|
||||
1. **Captcha** — Aliyun Captcha v3, solved with 2captcha task type `AlibabaTaskProxyless`
|
||||
(`sceneId=l47rwlyt`, `prefix=13n1x6`, `region=ga`, `apiGetLib=https://o.alicdn.com/captcha-frontend/aliyunCaptcha/AliyunCaptcha.js?t=2035`).
|
||||
2. `POST /auth/email-codes {email, purpose:"registration", captcha_token}` — 200 `{"code":"ok"}`.
|
||||
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_token` must be the whole 2captcha `solution` object serialised as a JSON string** —
|
||||
an object body gives 400, `solution.data` alone gives 403 `human verification failed`.
|
||||
3. read the 6-digit code from the mailbox over IMAP (qwenwork mail, `used_codes.txt` guards against
|
||||
|
||||
Reference in New Issue
Block a user