batch-api
하는 일
많은 파일에 한 번에 적용할 변환(번역, 재작성 등)을 계획하고, 실시간 가격의 절반인 배치 서비스에 제출합니다. 결과는 나중에 새 파일로 도착합니다. 몇 시간을 기다릴 수 있다면 더 저렴하게 대량 작업을 하려는 분들을 위한 스킬입니다.
사용하는 경우
- ✓같은 단일 턴 변경을 많은 파일에 적용해야 하고, 결과를 몇 시간 기다릴 수 있을 때.
- ✓대량의 콘텐츠를 번역, 재작성, 추출하면서 비용을 낮추고 싶을 때.
- ✓실시간 실행이 아니라 배치 가격을 명시적으로 원할 때.
스킬 링크
https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/batch-api/SKILL.md복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.
사용 방법
가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.
바로 붙여넣을 수 있는 메시지
Claude Code, Codex, Cursor용입니다. 프로젝트 폴더에서 실행하면 스킬이 설치됩니다.
SKILL.md를 다운로드해 에이전트의 스킬 폴더에 넣으세요.
AI에게 요청하는 예시
“제 제품 설명 파일을 모두 스페인어로 번역하고 싶어요. 더 저렴한 배치 옵션을 쓰고, 결과를 기다릴 수 있어요.”
매주 새 스킬 5개. 읽는 데 1분.
작동 방식
에이전트는 파일과 변환 내용을 설명하는 계획 파일을 준비하고, 명령이 작업을 제출합니다. 에이전트가 요청을 직접 작성하지 않으며, 결과는 새 파일로 돌아옵니다.
기술 내용 (원본 SKILL.md)
작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.
/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:
{
"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:
idmust 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-sidecustom_id.- Paths are relative to the curr
자주 묻는 질문
얼마나 저렴한가요?
배치 서비스는 이 요청들을 실시간 목록 가격의 절반으로 청구하며, 컨텍스트 캐시 혜택은 없습니다.
작업은 얼마나 걸리나요?
몇십 분에서 몇 시간이 걸릴 수 있으며, 완료 기간은 24시간 이상입니다.
배치 명령이 실패하면 어떻게 되나요?
에이전트는 무슨 일이 일어났는지 보고하고 멈춥니다. 몰래 실시간 가격으로 작업을 대신 하지 않습니다.
상세 정보
작성자의 원본 설명
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.
repo: QwenLM/qwen-code
인기도
- GitHub 스타
- 29k
- 순위
- #9776
- 라이선스
- Apache-2.0
- 업데이트
- 2026. 11. 2.
댓글
- …
이 저장소의 다른 스킬
codegraph
29k에이전트가 색인된 코드베이스를 호출 그래프, 의존성, 죽은 코드, 핫스팟, 의미 검색으로 분석하도록 돕습니다.
qwen-code-claw
29k에이전트가 코드베이스 이해, 버그 수정, 리팩터링, 새 프로젝트 생성 같은 코딩 작업을 Qwen Code에 맡기도록 돕습니다.
structured-debugging
29k에이전트가 어려운 버그를 디버깅하는 단계별 방법을 가르칩니다. 가설을 세우고, 대상 확인을 추가하고, 시험해서 실제 원인을 찾은 뒤 고칩니다.
tmux-real-user-testing
29k에이전트가 tmux 안에서 실제 사용자처럼 터미널 앱을 테스트하고, 각 동작마다 화면 캡처가 담긴 읽기 쉬운 로그를 저장하도록 돕습니다.