Agent skill

Batch API Planner

by QwenLM in QwenLM/qwen-code

Prepares many-file, single-turn transforms such as translating or rewriting as a plan, then submits it to the asynchronous, half-price DashScope Batch API through the qwen batch CLI.

Apache-2.0Auto-check passedProductivity & Automation

Install Batch API Planner

skills CLI
$ npx skills add QwenLM/qwen-code --skill batch-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install QwenLM/qwen-code batch-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/QwenLM/qwen-code.git skills-src && mkdir -p .claude/skills && cp -r skills-src/packages/core/src/skills/bundled/batch-api .claude/skills/batch-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
batch-api
GitHub stars
28k
Token cost
~2.2k tokens
SKILL.md length
1,254 words
Files
2
Skills in repo
41
Repo updated
First seen
Licence
Apache-2.0

At a glance

Prepares many-file, single-turn transforms such as translating or rewriting as a plan, then submits it to the asynchronous, half-price DashScope Batch API through the qwen batch CLI.

  • Works in 6 steps: Check readiness before anything else → Decide suitability honestly — this is… → Prepare lightly → …
  • Translating or rewriting many files when results can wait hours
  • SKILL.md covers 0. Check readiness before…, 1. Decide suitability honestly…, 2. Prepare lightly and 3. Write the plan file, plus 2 more sections
  • Runs TypeScript scripts from its folder

What it does

Invoked explicitly with /batch-api, the skill trades latency for price: batch requests are billed at 50% of the realtime list price and jobs take tens of minutes to hours, with a completion window of 24h or more. The agent turns the task into a small plan file that the deterministic executor, qwen batch run, submits. It never writes request JSONL by hand and never calls the Batch API directly.

A readiness step comes first: confirm the CLI has the batch subcommands with batch --help, then run batch check to prove that credentials, endpoint and the Batch route work and to show the model settings a run would freeze, without a billed request. If any batch command fails or the task is unsuitable, the agent reports briefly and stops. It never falls back to doing the transform itself, though it may offer a realtime run at full price. Results arrive as new files, so it does not suit in-place edits or tasks that need tool feedback.

When your agent uses it

  • Translating or rewriting many files when results can wait hours
  • Extracting structured data from a large set of documents at half price
  • Checking Batch API readiness with qwen batch check

Example prompts

  • “/batch-api translate every markdown file in docs/ into Spanish and write the results to docs-es/.”
  • “Prepare a batch plan to extract titles and summaries from the files in ./articles.”
  • “Check whether my Qwen setup can use the Batch API before I plan a large rewrite.”

Requirements

  • The `qwen` CLI with batch subcommands
  • DashScope Batch API credentials and endpoint, not Qwen OAuth

Workflow steps

6 steps, taken from the step headings in SKILL.md.

  1. Check readiness before anything else
  2. Decide suitability honestly — this is your main job
  3. Prepare lightly
  4. Write the plan file
  5. Submit through the executor
  6. Wait in the background, then report

What it can do on your machine

Read from SKILL.md and the folder at commit 55ee50d. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves nothing: there is no allowed-tools line, so your agent's usual permission prompts apply.

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Ships script files (TypeScript), which the agent can run.

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Batch API Planner loads about 2.2k tokens when it runs. Until then it costs about 61 tokens; SKILL.md has 1,254 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~61
When it runs · the whole SKILL.md, loaded when a task matches
~2.2k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from QwenLM/qwen-code at commit 55ee50d, republished under its Apache-2.0 licence (© QwenLM). 1,254 words, ~2,224 tokens.

Download SKILL.mdSave it as .claude/skills/batch-api/SKILL.md (or your agent's skills folder). This skill also uses 1 other file; get the full folder from GitHub.
name
batch-api
description
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.
argument-hint
<task>
disable-model-invocation
true

/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

It proves the credentials, endpoint and Batch route work and shows the model, thinking mode and output limit a run would freeze from the user's current settings — without a billed request. settings.batch.model can select a separate modelProviders entry; its endpoint, envKey and generationConfig are used without changing the conversation model. Do not edit authentication or settings to work around a failed check. If it fails (for example Qwen OAuth, which has no Batch route), relay its message and stop: do not read files or draft a plan the executor cannot submit. Pass its note: lines on to the user.

1. Decide suitability honestly — this is your main job

Suitable: many independent, single-turn transforms whose input materials are fully available right now. Examples: translate a set of documents under a fixed style guide, rewrite files to a new format, summarize or extract structured data from each file of a set.

Unsuitable:

  • Work that needs iterative feedback — debugging, run-test-fix loops, exploratory refactors. The next step there depends on results that do not exist yet.
  • Chained tasks where one item's output is another item's input.
  • A handful of items, or a task the user needs answered soon. Batch's wait buys nothing there.

If the task is unsuitable, say so in one short paragraph and stop.

2. Prepare lightly

The whole point is saving money, so do not burn the savings in preparation:

  • Discover the target files with glob.
  • Read only a small sample (2–3 files) to understand structure and edge cases. Do NOT deeply read every file — the executor reads and embeds the full contents mechanically at submission time.
  • Draft the shared rules once: terminology, style, format constraints, and the exact output contract. The model that runs the batch sees only your plan — spell out everything it needs, including "return ONLY the complete transformed document, no commentary".

3. Write the plan file

Write one JSON file to .qwen/batch/plans/<slug>.json (<slug> = short kebab-case task name) with the write_file tool:

json
{
  "version": 1,
  "name": "<slug>",
  "kind": "document-transform",
  "shared": {
    "system": "optional role/system prompt",
    "instructions": "the shared transform rules, terminology, output contract"
  },
  "items": [
    {
      "id": "intro",
      "source": "docs/zh/intro.md",
      "target": "docs/en/intro.md"
    }
  ]
}

Rules:

  • id must match [A-Za-z0-9][A-Za-z0-9_-]{0,59} (1–60 characters) and be unique per item; it becomes part of the provider-side custom_id.
  • Paths are relative to the current working directory. Every target must be unique and must not overwrite an existing file — pick fresh output paths inside the project and outside any hidden path such as .git/, .github/ or .qwen/, at any depth (refused). Results that arrive to a changed source or an occupied target are held, not written.
  • Optional fields: completionWindow (default 24h, max 14d), maxOutputTokens (set it when outputs can be long — a truncated item can only be retried with a larger limit), expectedOutputTokensPerItem (improves the cost estimate), maxCostUsd (run and retry refuse to submit when the worst case at the request caps exceeds it; it needs unit prices from check, a maxOutputTokens, and thinking off or a thinking_budget — otherwise the run is refused, so only set it when the user asked for a hard budget).
  • Do NOT set enableThinking unless the user asked for a thinking mode: the executor freezes the thinking mode, sampling parameters and output limit from the user's current settings, so Batch runs the same way their realtime session does. Changing it silently changes both cost and quality.
  • If you are unsure about model, prices, or provider limits, leave them to the executor — do not invent numbers.
Show full SKILL.md (408 more words)Show less

4. Submit through the executor

First preview the batch — it assembles every request and prints the item count, the frozen model/thinking/output-limit line, the cost estimate and a snapshot digest, but uploads nothing and bills nothing:

"${QWEN_CODE_CLI:-qwen}" batch run .qwen/batch/plans/<slug>.json --dry-run

Show the user those lines verbatim, plus any [batch] note. Then submit exactly that snapshot, with the digest the preview printed:

"${QWEN_CODE_CLI:-qwen}" batch run .qwen/batch/plans/<slug>.json --expect <digest>

Approving this command is the user's decision to spend, made with the preview in front of them — never submit without a preview in the same turn, and never drop --expect. If it reports that the batch changed since the preview, run the preview again and show the new one. If either command fails, relay its error and stop. The single exception: when the error names a field of the plan file itself (an invalid id, a duplicate target, an unknown field), fix that field once and preview again.

5. Wait in the background, then report

Right after a successful submission, start the waiter with the shell tool and is_background: true:

"${QWEN_CODE_CLI:-qwen}" batch collect <task-id> --wait

It polls the provider over HTTP — no model call while the batch queues and runs — and when the batch settles it collects, writes the target files and exits; you are then notified once with its output. Tell the user the task is submitted and that you will report when results arrive, then end your turn. Do not poll or wait for the batch yourself in the foreground, and never loop on status.

When the waiter's notification arrives, read the summary at the end of its output and report it: which targets were delivered, which items are held or failed and why. Then do the follow-up the user asked for in their original request (for example, review the delivered files), and nothing else:

  • Never retry automatically — every retry is a new billed request. Offer qwen batch retry <task-id> for failed items and for items held because their source changed; truncated items need qwen batch retry <task-id> --max-output-tokens <n>.
  • Never redo a failed item yourself in this session.
  • A target conflict (held: target exists) is resolved by the user; then qwen batch collect <task-id> delivers it without a new request.
  • Estimates never include what this session spent preparing; do not describe the Batch estimate as the task's total cost or as a saving.

If the session closes before the batch settles, nothing is lost: an interactive session collects the task automatically the next time qwen starts in this project (general.batchAutoCollect: false turns this off).

© QwenLM, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

SKILL.md and 1 other file in packages/core/src/skills/bundled/batch-api of QwenLM/qwen-code.

  • SKILL.md
  • SKILL.test.ts

Open the folder on GitHubat commit 55ee50d

Compare with similar skills

Batch API Planner next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Batch API Planner compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Batch API Planner this skillQwenLM/qwen-code28k—~2.2kAutomated safety check: PassApache-2.0
Fastgpt Workflow GeneratorYYH211/Claude-meta-skill282—~5.5kAutomated safety check: PassMIT
Agents Onboardingfazer-ai/agents118—~4.4kAutomated safety check: PassApache-2.0
SupercompressSupercompress/Supercompress107—~519Automated safety check: PassMIT
SupercompressSupercompress/Supercompress107—~366Automated safety check: PassMIT
Uipath API WorkflowUiPath/skills168—~7.5kAutomated safety check: NotesMIT

Similar skills

  • Fastgpt Workflow Generator

    YYH211/Claude-meta-skill

    Generates production-ready FastGPT workflow JSON from natural language requirements.

    282 GitHub stars~5.5k tokensUpdated 4 mo ago
    Productivity & AutomationAuto-check passed
  • Agents Onboarding

    fazer-ai/agents

    Conduz a jornada de onboarding 'do zero ao agente de atendimento' do fazer.ai agents num VPS, escolhendo o orquestrador de deploy (Tier A Coolify, B Portainer, C compose genérico para VM crua ou…

    118 GitHub stars~4.4k tokensUpdated today
    Productivity & AutomationAuto-check passed
  • Supercompress

    Supercompress/Supercompress

    Always-on context compression for Grok Build. An agent skill from Supercompress/Supercompress.

    107 GitHub stars~519 tokensUpdated 2 days ago
    Productivity & AutomationAuto-check passed
  • Supercompress

    Supercompress/Supercompress

    Always-on context compression for OpenClaw. An agent skill from Supercompress/Supercompress.

    107 GitHub stars~366 tokensUpdated 2 days ago
    Productivity & AutomationAuto-check passed
  • Uipath API Workflow

    UiPath/skills

    UiPath API Workflow assistant — author, run, validate, package, publish, deploy, and troubleshoot JSON workflows for uip api-workflow.

    168 GitHub stars~7.5k tokensUpdated today
    Productivity & AutomationAuto-check: notes
  • N8n Agents

    sickn33/agentic-awesome-skills

    Design n8n AI agents, chains, classifiers, extractors, tool calling, memory, RAG, structured output, and human-review flows.

    47k GitHub starsUsed in 1 repo~6k tokens
    Productivity & AutomationAuto-check passed

More from QwenLM/qwen-code

All 41 skills in this repo
  • Reproduces a feature from Codex or Claude Code in Qwen Code by running the reference agent under capture, reading the traces, then implementing matching behavior.

    28k GitHub stars~1.5k tokensUpdated today
    Auto-check passed
  • Qwen Code E2E Testing

    QwenLM/qwen-code

    Guides end-to-end testing of the Qwen Code CLI in headless mode with real model calls, MCP test servers and inspection of raw API traffic.

    28k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Scheduled CI skill that scans a repository for small, certain docs, test and code hygiene issues and fixes them on one branch with a commit per finding.

    28k GitHub stars~1.7k tokensUpdated today
    Auto-check passed
  • Builds a rebranded Qwen Code desktop package from the Tauri shell using only a brand id and a logo, with sensible derived defaults.

    28k GitHub stars~2.1k tokensUpdated today
    Auto-check passed
  • Walks through capturing and comparing V8 heap snapshots to find memory leaks in the Qwen Code Node.js CLI, using tmux and the chrome-devtools CLI.

    28k GitHub stars~1.3k tokensUpdated today
    Auto-check passed
  • tmux Real User Testing

    QwenLM/qwen-code

    Drives Qwen Code in a real tmux session the way a user would and saves a readable step-by-step transcript of each screen for maintainers to review.

    28k GitHub stars~2.3k tokensUpdated today
    Auto-check passed

Questions about Batch API Planner

What does Batch API Planner do?

Prepares many-file, single-turn transforms such as translating or rewriting as a plan, then submits it to the asynchronous, half-price DashScope Batch API through the qwen batch CLI. Invoked explicitly with /batch-api, the skill trades latency for price: batch requests are billed at 50% of the realtime list price and jobs take tens of minutes to hours, with a completion window of 24h or more. The agent turns the task into a small plan file that the deterministic executor, qwen batch run, submits.

When should I use Batch API Planner?

Batch API Planner fits situations like: translating or rewriting many files when results can wait hours; extracting structured data from a large set of documents at half price; checking Batch API readiness with qwen batch check.

How do I install Batch API Planner in Claude Code?

Run `npx skills add QwenLM/qwen-code --skill batch-api -a claude-code`. Or copy the skill folder (packages/core/src/skills/bundled/batch-api in QwenLM/qwen-code) into .claude/skills/batch-api in your project. Claude Code loads it when a task matches its description.

How do I install Batch API Planner in Codex?

Run `npx skills add QwenLM/qwen-code --skill batch-api -a codex`. Or copy the skill folder (packages/core/src/skills/bundled/batch-api in QwenLM/qwen-code) into .agents/skills/batch-api in your project. Codex loads it when a task matches its description.

Can I use Batch API Planner in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add QwenLM/qwen-code --skill batch-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/batch-api, .gemini/skills/batch-api, .github/skills/batch-api and .opencode/skills/batch-api in your project.

What does Batch API Planner need to run?

Going by SKILL.md and its folder, Batch API Planner needs TypeScript for the scripts in its folder. Our summary lists: The `qwen` CLI with batch subcommands; DashScope Batch API credentials and endpoint, not Qwen OAuth.

Does Batch API Planner access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Batch API Planner safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Batch API Planner use?

Batch API Planner is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Batch API Planner use?

About 2.2k tokens (SKILL.md is roughly 8.9k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Batch API Planner?

Skills that share tags, products or a category with Batch API Planner: Fastgpt Workflow Generator (YYH211/Claude-meta-skill, 282 stars), Agents Onboarding (fazer-ai/agents, 118 stars), Supercompress (Supercompress/Supercompress, 107 stars) and Supercompress (Supercompress/Supercompress, 107 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Batch API Planner?

QwenLM (a GitHub organization) maintains it in QwenLM/qwen-code, which has 28,370 GitHub stars. The repository holds 41 skills in this directory. The repository was last updated on October 9, 2026.

Source: QwenLM/qwen-code on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.