DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to run a batch of OpenAI requests from a JSONL file with OpenAI CLI

Upload a JSONL file of requests, create a batch, wait for it and download the results.

Short answer: Prepare requests.jsonl (the batch guide includes a sample); then run openai files upload requests.jsonl --purpose batch and note the returned file ID; create the batch with openai batches create --input-file-id plus your file ID, --endpoint /v1/responses --completion-window 24h. All steps.

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

  1. Prepare requests.jsonl (the batch guide includes a sample)
  2. Run openai files upload requests.jsonl --purpose batch and note the returned file ID
  3. Create the batch with openai batches create --input-file-id plus your file ID, --endpoint /v1/responses --completion-window 24h
  4. Run openai batches wait batch_example --output-dir ./results with your batch ID
  5. 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

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer