Docs

Create an API key in the console, point an OpenAI SDK at https://batchrate.ai/v1, and submit a JSONL batch. Results are ready within 24 hours, usually within hours.

Quickstart

Install the official SDK. No Batchrate package is required.

pip install openai
from openai import OpenAI

client = OpenAI(
    api_key="br_live_...",
    base_url="https://batchrate.ai/v1",
)

batch_file = client.files.create(file=open("batch.jsonl", "rb"), purpose="batch")
batch = client.batches.create(
    input_file_id=batch_file.id,
    endpoint="/v1/chat/completions",
    completion_window="24h",
)

while batch.status not in ("completed", "failed", "cancelled", "expired"):
    batch = client.batches.retrieve(batch.id)

if batch.output_file_id:
    print(client.files.content(batch.output_file_id).text)

JavaScript is the same idea: new OpenAI({ apiKey, baseURL: "https://batchrate.ai/v1" }).

Authentication

Send Authorization: Bearer br_live_.... Keys are shown once at creation and are not shown again. Revoked keys stop working immediately. The console can also call these routes while you are signed in.

Files

POST /v1/files

Multipart form with purpose=batch and file. The body must be valid batch JSONL within the size and line limits. Response:

{
  "id": "file-...",
  "object": "file",
  "bytes": 120,
  "created_at": 1710000000,
  "filename": "batch.jsonl",
  "purpose": "batch",
  "status": "processed",
  "status_details": null
}

GET /v1/files/{id}

Returns the same file object if you own it.

GET /v1/files/{id}/content

Returns the raw bytes. Use this for input, output, and error files.

DELETE /v1/files/{id}

Deletes a file you own and removes the object from storage immediately.

{
  "id": "file-...",
  "object": "file",
  "deleted": true
}

If the input file is still used by a batch in validating, in_progress, finalizing, or cancelling, the API returns file_in_use and names that batch. Cancel the batch first. A batch that is still cancelling stays blocked until it reaches a terminal status. Output and error files can be deleted at any time. Deleting a file does not remove the batch or its billing record. Reading a deleted file returns file_not_found.

File retention

Input files are deleted 7 days after every batch that used them reaches a terminal state (completed, cancelled, failed, or expired). An input file that is never used is deleted 7 days after upload. Output and error files are deleted 30 days after they are created. You can delete sooner with DELETE /v1/files/{id} or the console. Automatic deletion removes the file. Credit records stay for accounting.

Batches

POST /v1/batches

{
  "input_file_id": "file-...",
  "endpoint": "/v1/chat/completions",
  "completion_window": "24h",
  "metadata": { "dataset": "support-queue" }
}

endpoint must be /v1/chat/completions. completion_window must be 24h. The batch moves to in_progress after validation. If the available credit balance is below the estimate, the API returns insufficient_quota.

GET /v1/files/{id}/estimate

Returns a cost estimate for an uploaded file. Output tokens are always an estimate. They come from each line's max_tokens or max_completion_tokens. A line that omits both uses the default output length, up to the maximum used for estimates. warning is set when free tokens plus the available balance will not cover the estimated price. The same object is included as estimate on the file. A created batch stores the quote used for its hold. Output tokens on that quote are still an estimate.

GET /v1/batches and GET /v1/batches/{id}

List responses use object: "list", data, first_id, last_id, and has_more. Pass limit and after to page. A batch includes request_counts, output_file_id, error_file_id, usage, and estimate.

POST /v1/batches/{id}/cancel

Queued lines are cancelled. Lines already running can still finish. When nothing is left in flight, the batch becomes cancelled and any completed lines are still billed and downloadable.

Statuses: validating, in_progress, finalizing, completed, failed, cancelling, cancelled, expired.

Models

GET /v1/models

Lists enabled models. Qwen3.6 35B is available as qwen3.6-35b-a3b. Prices are not on this route. Read /api/pricing or the pricing page.

JSONL format

{"custom_id":"req-1","method":"POST","url":"/v1/chat/completions","body":{"model":"qwen3.6-35b-a3b","messages":[{"role":"user","content":"Summarize this ticket."}]}}

Output lines follow the OpenAI batch result shape:

{"id":"batch_req_...","custom_id":"req-1","response":{"status_code":200,"request_id":"req_...","body":{"id":"chatcmpl-...","object":"chat.completion","choices":[{"message":{"role":"assistant","content":"..."}}],"usage":{"prompt_tokens":10,"completion_tokens":20,"total_tokens":30}}},"error":null}

Failed lines go to the error file with response: null and an error object of code and message.

Errors

{"error":{"message":"...","type":"invalid_request_error","param":null,"code":"invalid_file"}}

Common codes: invalid_api_key, invalid_file, insufficient_quota, rate_limit_exceeded, file_not_found, file_in_use, batch_not_found.

Billing

Credits are prepaid. Checkout is Stripe-hosted. Credits appear in your balance after Stripe confirms the payment. The rate for Qwen3.6 35B (qwen3.6-35b-a3b) is $0.05 / M input and $0.40 / M output. The minimum top-up is $10 and the billing page starts at $25. Verified accounts also receive a one-time token credit, spent before the dollar balance. The calculator at /pricing#estimator posts to POST /api/estimate and shows reference prices, each marked with its as-of date (2026-10-10).