Batchrouter Docs

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

Sign-up is not open yet. The API routes for batches, chat completions and the OpenAI-compatible endpoints are not yet available.

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

  1. Create an API key.

    Send Authorization: Bearer br_live_… on every call. Keys are shown once. See Authentication.

  2. Copy a real model id.

    GET https://api.batchrouter.com/v1/catalog/models and use a model value from that response (the catalog's own examples use ids such as gpt-5.4). Do not invent one.

  3. Keep your JSONL, swap the model.

    Each line stays a standard OpenAI Batch request; only body.model becomes the catalog id. Your custom_id comes 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.

  4. Upload the file. POST /v1/files with the raw JSONL as the body and X-BatchRouter-Purpose: batch_input. Keep the returned file_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
  5. Quote it. Quotes are free. POST /v1/quotes/model with input_file_id set to that file_id. Keep the returned quote_id. Details: Quotes and pricing.

  6. Submit the batch. POST /v1/batches with that quote_id, the same input_file_id, and a required Idempotency-Key of 8–128 characters. Then poll GET /v1/batches/{batch_id}. Results come back in the order of your file, each under your custom_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.