
Batch API
Prepare a many-file, single-turn transform (translate, rewrite, extract) as a plan and...
Install
npx skills add QwenLM/qwen-code --skill batch-api -g -a claude-code -y- Repository
- QwenLM/qwen-code28.9k
- Category
- Writing
- Updated
- 3d ago
- License
- Apache-2.0
- Context cost
- Mediumabout 2,129 tokens
- Runs scripts
- Yes, review before use
What it does
Prepare a many-file, single-turn transform (translate, rewrite, extract) as a plan and submit it to the asynchronous, half-price DashScope Batch API; results are delivered as new files hours later. Invoke explicitly with /batch-api.
/batch-api, Agent-prepared Batch API workflow
Hard rule for this whole skill: if any qwen batch … command fails, or
the task turns out to be unsuitable, report what happened in a few lines and
stop (the one exception, a plan-field error from run, is in §4). Never fall back to doing the transform yourself in this session, the
user chose the half-price asynchronous path explicitly, and silently doing
the work at full realtime price is exactly what they opted out of. Offering
it as a choice ("I can do this realtime instead, at full price") is fine;
doing it without being asked is not.
The user explicitly chose async batch mode by typing /batch-api. This mode
trades latency for price: the provider bills Batch requests at 50% of the
realtime list price (with no context-cache benefit), and a job takes tens of
minutes to hours to finish (completion window 24h or more). Your job is to
turn the user's task into a small plan file that the deterministic
executor (qwen batch run) submits. You never write request JSONL by hand
and never call the Batch API yourself.
0. Check readiness before anything else
Run every qwen batch … command with the shell tool as
"${QWEN_CODE_CLI:-qwen}" batch …, QWEN_CODE_CLI names the CLI running
this session, so a plain qwen on PATH (possibly an older install without
these subcommands) is only the fallback. First make sure the CLI you reach
has them. Help output never calls a model:
"${QWEN_CODE_CLI:-qwen}" batch --help
If the output does not list batch run <plan>, the qwen it reached is an
older install without these subcommands, say so (the session's CLI is not on
PATH as qwen) and stop. Do not run any other batch command there: an older
CLI treats batch check as a prompt and answers it with a billed model call.
Then:
"${QWEN_CODE_CLI:-qwen}" batch check
