OpenAI Batch in five minutes
Move an OpenAI Batch workload onto Batchrouter. Keep your JSONL, upload it with POST /v1/files, quote it and create the batch. Download the Postman collection.
Not open yet
This is the short path from an OpenAI Batch habit to a Batchrouter batch. Your OpenAI Batch JSONL works as it is: Batchrouter takes standard OpenAI Batch lines as one of its two first-class input shapes. The longer pages linked below are the source of truth for each step.
If you already have an OpenAI SDK client and want to change only base_url and the API key, skip to Drop-in OpenAI SDK.
Five minutes, native API
-
Create an API key.
Send
Authorization: Bearer br_live_…on every call. Keys are shown once. See Authentication. -
Copy a real model id.
GET https://api.batchrouter.com/v1/catalog/modelsand use amodelvalue from that response (the catalog's own examples use ids such asgpt-5.4). Do not invent one. -
Keep your JSONL, swap the model.
Each line stays a standard OpenAI Batch request; only
body.modelbecomes the catalog id. Yourcustom_idcomes back on every result. Full rules: JSONL input format.{"custom_id":"request-1","method":"POST","url":"/v1/chat/completions","body":{"model":"gpt-5.4","messages":[{"role":"user","content":"Summarize: Batchrouter routes batch-AI workloads across providers."}]}}If many of your requests share a long system prompt, you can write the same requests as Batchrouter Sectioned v1 instead, which states the shared prompt once.
-
Upload the file.
POST /v1/fileswith the raw JSONL as the body andX-BatchRouter-Purpose: batch_input. Keep the returnedfile_id. Details: Files & large batches.curl -X POST https://api.batchrouter.com/v1/files \ -H "Authorization: Bearer $BATCHROUTER_API_KEY" \ -H "X-BatchRouter-Purpose: batch_input" \ -H "Content-Type: application/x-ndjson" \ -H "Content-Length: $(wc -c < batch.jsonl)" \ --data-binary @batch.jsonl -
Quote it. Quotes are free.
POST /v1/quotes/modelwithinput_file_idset to thatfile_id. Keep the returnedquote_id. Details: Quotes and pricing. -
Submit the batch.
POST /v1/batcheswith thatquote_id, the sameinput_file_id, and a requiredIdempotency-Keyof 8–128 characters. Then pollGET /v1/batches/{batch_id}. Results come back in the order of your file, each under yourcustom_id. Details: Submit a batch.
Every batch runs on the 24-hour SLA. Credits are reserved when the batch is created, not when you quote. A workspace with no credits gets 402.
For a handful of requests you can skip the file and send them inline as items on the quote and the create; see Inline items.
Try it in Postman
Download the collection and set batchrouterApiKey to your br_live_ key:
batchrouter-openai-batch.postman_collection.json
The Native batch folder is the inline version of the steps above: catalog, quote, create, poll, with the requests as inline items instead of an uploaded file. The OpenAI-compatible folder is the file-then-batch surface (POST /v1/openai/v1/files with multipart fields file and purpose=batch, then POST /v1/openai/v1/batches with input_file_id and endpoint).
Drop-in OpenAI SDK
Point an existing OpenAI Batch client at https://api.batchrouter.com/v1/openai/v1 and use your Batchrouter key as the bearer token. Request bodies and input files stay in OpenAI's shape (standard OpenAI Batch lines). See OpenAI compatibility.