Logo : Batch Api

Batch Api

OrganisationPopulaire
QwenLM
batch-api

Préparez une transformation portant sur de nombreux fichiers en un seul tour (traduire, réécrire, extraire) sous forme de plan, puis soumettez-la à l’API DashScope Batch asynchrone, à moitié prix ; les résultats sont livrés sous forme de nouveaux fichiers quelques heures plus tard. Lancez explicitement avec /batch-api.

Présentation

ÉditeurQwenLM
Dépôtqwen-code
Nom de la compétencebatch-api
Étoiles
28.4K
Forks
3.2K
Fichiers inclus
1
LicenceApache-2.0
Liens
  • Instructions en Markdown

    Un fichier SKILL.md que le modèle charge à la demande : il ne consomme donc des tokens que lorsqu’une demande correspond réellement à la compétence.

  • Compatible avec tous les LLM

    Les compétences IA sont rédigées en Markdown et non sous forme de code propre à un fournisseur. Elles fonctionnent donc avec GPT, Claude, Gemini, Grok ou un modèle local.

  • Fichiers inclus : 1

    Des scripts, des gabarits et des références que le modèle peut consulter pendant son travail. Les fichiers sont en lecture seule et ne sont jamais exécutés.

  • Open source

    Publiée par QwenLM sur GitHub. Consultez les sources avant de l’installer.

Installation

Installez la compétence IA Batch Api dans TypingMind pour l’utiliser avec n’importe quel LLM, ou ajoutez-la à un autre agent capable de lire SKILL.md.

1

Installer dans TypingMind

TypingMind installe une compétence directement depuis son dossier GitHub : l’application lit SKILL.md, regroupe les fichiers de ressources et enregistre le tout localement.

  1. Ouvrez l’application et accédez à Plugins → Compétences.
  2. Choisissez « Installer depuis GitHub ».
  3. Copiez l’URL ci-dessous, qui pointe vers le dossier de la compétence, puis collez-la et confirmez.
    https://github.com/QwenLM/qwen-code/tree/main/packages/core/src/skills/bundled/batch-api
  4. Activez la compétence dans chaque discussion où vous souhaitez pouvoir l’utiliser.
Plugins → Compétences → Ajouter une compétence → Via une URL GitHub, puis collez l’URL du dossier et appuyez sur Continuer.
2

Installer dans un autre agent

Tout agent capable de lire le format Agent Skills peut utiliser cette compétence : copiez le dossier dans le répertoire des compétences de cet agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/QwenLM/qwen-code.git /tmp/qwen-code
mkdir -p .claude/skills
cp -r /tmp/qwen-code/packages/core/src/skills/bundled/batch-api .claude/skills/batch-api
Redémarrez Claude Code après la copie pour que la nouvelle compétence soit prise en compte.

Utilisez cette compétence dans TypingMind

Activez Batch Api dans n’importe quelle discussion TypingMind et le modèle s’occupe du reste. Le nom et la description de la compétence figurent dans le prompt système. Dès qu’une demande correspond, le modèle charge lui-même l’intégralité des instructions : vous n’avez jamais à l’invoquer manuellement, et elle ne consomme aucun token tant qu’elle n’est pas utilisée.

Le modèle charge automatiquement Batch Api dès qu’une demande correspond à cette compétence.

Compatible avec tous les modèles IA

Les compétences IA sont de simples instructions Markdown, et non du code propre à un fournisseur. Ainsi, la compétence Batch Api n’est pas liée au modèle pour lequel elle a été conçue. Installez-la une seule fois dans TypingMind et utilisez-la avec GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama ou un modèle local que vous exécutez vous-même, le tout avec vos propres clés API.

  • Chargée uniquement en cas de besoin

    Le prompt système ne contient que le nom et la description. Les instructions sont récupérées à la première demande correspondante : une compétence inutilisée ne coûte donc rien.

  • Changez de modèle en cours de discussion

    La compétence étant constituée d’instructions et non de code, elle reste fonctionnelle lorsque vous changez de modèle : le nouveau modèle lit le même fichier SKILL.md.

Instructions de la compétence

Voici le contenu de SKILL.md que le modèle charge. Lisez-le avant l’installation : une compétence contient des instructions que votre modèle suivra.

/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.

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).

Fichiers inclus

Le modèle lit ces fichiers à la demande lorsque la compétence est chargée. Ils sont accessibles en lecture et ne sont jamais exécutés.

Foire aux questions

À quoi sert la compétence IA Batch Api ?

Préparez une transformation portant sur de nombreux fichiers en un seul tour (traduire, réécrire, extraire) sous forme de plan, puis soumettez-la à l’API DashScope Batch asynchrone, à moitié prix ; les résultats sont livrés sous forme de nouveaux fichiers quelques heures plus tard. Lancez explicitement avec /batch-api.

Pourquoi utiliser Batch Api sur TypingMind ?

Parce que vous l’installez une seule fois pour l’utiliser avec n’importe quel modèle. Batch Api se compose de simples instructions en Markdown plutôt que de code propre à un fournisseur. La même compétence fonctionne donc avec GPT-5, Claude, Gemini, Grok ou un modèle local, et vous pouvez changer de modèle en cours de discussion sans perturber son fonctionnement. TypingMind utilise vos propres clés API : vous payez donc directement les fournisseurs plutôt qu’un abonnement par siège, et vos compétences et discussions restent dans votre propre espace de stockage.

Comment installer Batch Api dans TypingMind ?

Dans TypingMind, ouvrez Plugins → Compétences → Installer depuis GitHub et collez https://github.com/QwenLM/qwen-code/tree/main/packages/core/src/skills/bundled/batch-api. TypingMind lit le fichier SKILL.md, regroupe les fichiers associés et installe le tout sous forme de compétence que vous pouvez activer pour chaque discussion.

Quels modèles d’IA peuvent utiliser Batch Api ?

N’importe quel modèle que vous connectez dans TypingMind. Les compétences IA sont de simples instructions en Markdown, et non du code propre à un fournisseur. GPT, Claude, Gemini, Grok et les modèles locaux peuvent donc tous charger cette compétence lorsqu’une demande lui correspond.

Combien de modèles d’IA puis-je utiliser avec Batch Api ?

Autant que vous le souhaitez. Vous pouvez utiliser Batch Api avec tout modèle qui prend en charge les compétences : GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama et bien d’autres, le tout dans TypingMind avec vos propres clés API.

La compétence IA Batch Api est-elle gratuite ?

Oui. Cette compétence est publiée sur GitHub par QwenLM sous licence Apache-2.0. Vous ne payez que votre propre fournisseur d’IA pour les tokens utilisés.

Que sont les compétences IA ?

Une compétence IA est un ensemble d’instructions réutilisables qui apprend à un modèle d’IA à accomplir une tâche précise. Elle suit le format ouvert Agent Skills : un fichier SKILL.md contenant un nom et une description, ainsi que les éventuels scripts, gabarits ou fichiers de référence dont le modèle peut avoir besoin. Le modèle ne lit les instructions que lorsque votre demande correspond à la compétence. Une compétence installée ne coûte donc rien tant qu’elle n’est pas utilisée.

En quoi les compétences IA diffèrent-elles des plugins ou des serveurs MCP ?

Un plugin ou un serveur MCP fournit au modèle de nouveaux outils à appeler : du code qui s’exécute quelque part et renvoie un résultat. Une compétence IA lui apporte plutôt des connaissances et une méthode : comment aborder une tâche, quelles étapes suivre et à quoi ressemble un bon résultat. Les compétences sont de simples instructions en Markdown. Elles ne nécessitent donc ni serveur, ni clé API, ni environnement d’exécution, et fonctionnent avec n’importe quel modèle.

Tout voir

Créez votre propre espace de travail IA dès maintenant

Abonnez-vous à notre newsletter pour être informé des nouvelles fonctionnalités et des prochains cadeaux à gagner 👇