79 lines
3.9 KiB
Markdown
79 lines
3.9 KiB
Markdown
# 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.
|
||
|
||
```
|
||
farm.py autoreg / login -> accounts.jsonl {email, jwt}
|
||
qw_shim.py OpenAI-compatible gateway (:48981 /v1/chat/completions)
|
||
api.md reverse-engineered API reference
|
||
```
|
||
|
||
## Models (server catalog, `GET /api/chat-modes`)
|
||
|
||
| 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 |
|
||
|
||
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"}`.
|
||
**`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
|
||
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}`.
|
||
|
||
```bash
|
||
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
|
||
|
||
```bash
|
||
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`. |