Aller au contenu
Skillpedia
Automatisations29k · #9776

batch-api

Ce qu’il fait

Elle prépare un plan pour transformer de nombreux fichiers en une seule étape, comme les traduire ou les réécrire, puis le soumet à un service par lots au demi-tarif du prix en temps réel. Les résultats arrivent plus tard sous forme de nouveaux fichiers. Elle s'adresse aux personnes qui peuvent attendre plusieurs heures pour un travail en volume moins coûteux.

Quand l’utiliser

  • ✓Quand vous devez appliquer la même modification à un seul tour à de nombreux fichiers et pouvez attendre plusieurs heures.
  • ✓Quand vous voulez traduire, réécrire ou extraire du contenu sur un grand ensemble de fichiers à moindre coût.
  • ✓Quand vous voulez explicitement la tarification par lots et non un traitement en temps réel.

Lien du skill

https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/batch-api/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/QwenLM/qwen-code/blob/main/packages/core/src/skills/bundled/batch-api/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Je voudrais traduire tous mes fichiers de descriptions de produits en espagnol avec l'option par lots, moins chère, et je peux attendre les résultats.”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'agent prépare un fichier de plan qui décrit les fichiers et la transformation, puis une commande soumet le travail. L'agent n'écrit pas lui-même les requêtes, et les résultats reviennent sous forme de nouveaux fichiers.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis 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:

  • 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 curr
Questions fréquentes

De combien est-ce moins cher ?

Le service par lots facture ces requêtes au demi-tarif du prix public en temps réel, sans bénéfice de cache de contexte.

Combien de temps dure un travail ?

Un travail peut prendre de quelques dizaines de minutes à plusieurs heures, avec une fenêtre d'exécution de 24 heures ou plus.

Que se passe-t-il si la commande par lots échoue ?

L'agent signale ce qui s'est passé et s'arrête. Il ne fait pas discrètement le travail au plein tarif en temps réel à la place.

Détails

Description originale de l’auteur

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

Popularité

Étoiles GitHub
29k
Position au classement
#9776
Licence
Apache-2.0
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires