Who it is forA data engineer who needs to send thousands of prompts and can wait up to a day for cheaper batch processing.
The problemSubmitting and polling the Batch API by hand takes several scripts and careful ID tracking.
The outcomeA finished batch with its result files downloaded to a local folder.
What you need first
- An OpenAI API key (OPENAI_API_KEY); admin endpoints need OPENAI_ADMIN_KEY
- Homebrew, Go 1.26 or later, or a prebuilt binary from GitHub Releases
- Optional: jq for parsing JSON output
Steps
- Prepare requests.jsonl (the batch guide includes a sample)
- Run
openai files upload requests.jsonl --purpose batchand note the returned file ID - Create the batch with
openai batches create --input-file-idplus your file ID,--endpoint /v1/responses --completion-window 24h - Run
openai batches wait batch_example --output-dir ./resultswith your batch ID - Check the result files and the failed requests section of the batch guide
Prompt for your agent
Use openai/openai-cli to upload <requests.jsonl> with `--purpose batch`, create a batch on /v1/responses with a 24h window, wait for it with `openai batches wait`, and save results to ./results. Report how many requests failed.
Caveat.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for openai/openai-cli and "Run a batch of OpenAI requests from a JSONL file"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer