/major-ai-skills:batch-api-job-processingfrom major-ai-skills
Organize asynchronous evaluation, audit, or dataset workloads for a provider's batch API when immediate responses are unnecessary.
Ships in major-ai-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
When engineering teams run non-real-time agentic workloads (e.g., overnight test suite generation, security audits across 2,000 files, or bulk customer feedback classification), executing sequential synchronous HTTP requests (/v1/chat/completions or /v1/messages) is financially wasteful and prone to HTTP 429 Rate Limit Errors.
Leading AI providers (OpenAI, Anthropic) offer Asynchronous Batch APIs that process requests within a 24-hour SLA at an automatic 50% flat discount on all input and output tokens, while providing dedicated, massive rate limit pools.
The Asynchronous Batch Processing Protocol automates the packaging, dispatch, and ingestion of bulk LLM tasks.
┌─────────────────────────────────────────────────────────────┐
│ Workload Routing Comparison │
│ │
│ Synchronous HTTP Loop (1,000 Items): │
│ • 1,000 individual REST calls │
│ • Hits TPM/RPM rate limits $\rightarrow$ HTTP 429 retries │
│ • Standard Pricing: $100.00 │
│ • Requires dedicated worker process to remain alive │
│ │
│ Asynchronous Batch API Pipeline (1,000 Items): │
│ 1. Pack 1,000 requests into a single `requests.jsonl` file │
│ 2. Dispatch via Batch API (OpenAI / Anthropic) │
│ 3. Automatic 50% Flat Discount: $50.00 │
│ 4. Dedicated batch compute pool (Zero 429 rate limits) │
│ 5. Retrieve completed `results.jsonl` via webhook or cron │
└─────────────────────────────────────────────────────────────┘
import json
import time
from pathlib import Path
from openai import OpenAI
client = OpenAI()
def create_batch_job(items: list, system_prompt: str, output_jsonl: Path) -> str:
"""Packages prompts into JSONL and dispatches an OpenAI Batch Job."""
with output_jsonl.open("w", encoding="utf-8") as f:
for idx, item in enumerate(items):
task = {
"custom_id": f"task-{idx}-{item['id']}",
"method": "POST",
"url": "/v1/chat/completions",
"body": {
"model": "gpt-4o-mini",
"messages": [
{"role": "system", "content": system_prompt},
{"role": "user", "content": item["content"]}
],
"temperature": 0.0
}
}
f.write(json.dumps(task) + "\n")
# 1. Upload the batch file
batch_file = client.files.create(
file=output_jsonl.open("rb"),
purpose="batch"
)
# 2. Create the batch job
batch_job = client.batches.create(
input_file_id=batch_file.id,
endpoint="/v1/chat/completions",
completion_window="24h"
)
print(f"Batch Job Dispatched: {batch_job.id} (Status: {batch_job.status})")
return batch_job.id
def download_batch_results(batch_id: str, results_path: Path) -> None:
"""Polls batch status and downloads completed output file."""
while True:
job = client.batches.retrieve(batch_id)
print(f"Current Status: {job.status} (Completed: {job.request_counts.completed}/{job.request_counts.total})")
if job.status == "completed":
content = client.files.content(job.output_file_id).text
results_path.write_text(content, encoding="utf-8")
print(f"Results saved to {results_path}")
break
elif job.status in ["failed", "expired", "cancelled"]:
raise RuntimeError(f"Batch Job Failed with status: {job.status}")
time.sleep(30)
| Workload Type | Optimal Route | Why |
|---|---|---|
| Interactive User Chat / CLI Prompting | Synchronous Streaming | User is actively waiting for response. |
| Nightly Security Code Scan (2,000 files) | Asynchronous Batch API | 50% discount; results needed by morning. |
| Offline Test Case Generation | Asynchronous Batch API | Bypasses standard TPM quotas. |
| Model Evaluation / Benchmark Scoring | Asynchronous Batch API | Eliminates 429 throttling on large test datasets. |
MANDATORY: Any autonomous background task, benchmark evaluation, or bulk file transformation spanning $> 50$ items that does not require an immediate interactive user response MUST be packaged as an Asynchronous Batch Job.
What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub alivirgo/major-ai-skills --plugin major-ai-skills412 skills in this plugin
/3d-slicerAutomate 3D Slicer research workflows with MRML, VTK/ITK, DICOM data, and Segment Editor. Use for software workflows, not clinical interpretation./abbreviated-git-statusInspect Git branch, staging, and working-tree changes with short or porcelain status output when a compact repository check is needed./ableton-liveAutomate Ableton Live sessions with Python MIDI Remote Scripts, Max for Live, AbletonOSC, and Link synchronization./act-as-a-personal-tutorExplain a subject step by step, assess prior knowledge, and use short exercises to check understanding before advancing.