deeprelay batches
Submit and track off-peak batches
Submit and track off-peak batches
Synopsis
Submit a batch of requests now, and deeprelay runs it in the model's next off-peak window, billing each line at the rate in effect when it runs. On a model with a peak schedule a batch only runs off-peak, so every line bills at the off-peak rate, half of peak. Batch is offered on models with a peak schedule (today DeepSeek V4.1 Flash); a batch for any other model is refused at submit. deeprelay models get shows whether a model takes a batch and what a batch line bills at.
The API is OpenAI's Batch API (/v1/files and /v1/batches), so the OpenAI SDKs work unchanged. These commands drive the same endpoints.
The workflow. Write a JSONL file of requests, upload it with deeprelay files upload, submit it with deeprelay batches create, track it with deeprelay batches get, and download the results with deeprelay batches results (and any failed or unrun lines with deeprelay batches errors).
The input file. One request per line. Each line carries a custom_id you choose (unique within the file; results come back in no particular order, so this is how you match them), "method": "POST", the endpoint url, and the body you would send to that endpoint synchronously:
{"custom_id": "q-1", "method": "POST", "url": "/v1/chat/completions", "body": {"model": "deeprelay/deepseek-v4.1-flash", "messages": [{"role": "user", "content": "Name three prime numbers above 100."}], "max_tokens": 200}}
An Anthropic Messages request uses the same OpenAI line shape with "url": "/v1/messages":
{"custom_id": "m-1", "method": "POST", "url": "/v1/messages", "body": {"model": "deeprelay/deepseek-v4.1-flash", "max_tokens": 300, "messages": [{"role": "user", "content": "Write a haiku about tides."}]}}
/v1/responses lines work the same way. Anthropic's own Message Batches endpoint (/v1/messages/batches) is not supported; use the OpenAI shape above.
Rules.
- One model and one endpoint per batch. Every line's
urlmust match the batch's--endpoint, and every line must name the same model. Split a mixed file into one batch per model. - No
"stream": true, no server tools (web search), and no backup models: a line runs on its own model only. - The whole file is checked before anything runs. One bad line rejects the submit with the line numbers named; nothing is stored or billed.
- Up to 50,000 lines and 200 MB per input file by default.
deeprelay batches limitsshows every limit and where you are against it.
Scheduling. A batch for a model that is off-peak right now starts at once; otherwise it waits for the next off-peak window. Lines still queued when a window closes pause until the next one: the batch stays in_progress, and deeprelay batches get shows the pause reason and the next window. Batches never run at peak. completion_window is always 24h, and it is a target, not a promise. A batch expires 72 hours after submit; lines that have not run by then go to the error file unbilled.
Billing. Pay-as-you-go only: batch lines are never covered by a subscription plan and never count toward plan quota, even on a subscriber's key. They are debited from your prepaid balance as each line finishes. At submit, deeprelay estimates the cost (input tokens plus each line's max_tokens, at the batch rate) and checks it against your balance and spending limits. The estimate is not a reservation: each line is checked again when it runs, and a batch that runs out of balance mid-way pauses until you top up. Set max_tokens on your lines to keep the estimate close.
Retention. Input, output and error files are encrypted at rest and kept for 30 days after the batch finishes, then deleted. deeprelay files delete removes one sooner.
The full guide is the Batch API section of deeprelay.ai/docs/guides/serverless-inference.
deeprelay batches [command]
Examples
deeprelay files upload --file requests.jsonl
deeprelay batches create --input-file file-abc123 --endpoint /v1/chat/completions
deeprelay batches get batch_8f2c41d07a9be3615c0d2e7f
deeprelay batches results batch_8f2c41d07a9be3615c0d2e7f --out output.jsonl
Options
-h, --help help for batches
Options inherited from parent commands
--api-base string API base URL (override with DEEPRELAY_API_BASE env) (default "https://api.deeprelay.ai/v1")
--debug Enable debug logging to stderr
--no-preflight Skip the plan/credit check before inference requests (override with DEEPRELAY_NO_PREFLIGHT env)
-o, --output string Output format: table|json (default table on TTY, json otherwise) (default "table")
SEE ALSO
- deeprelay - deeprelay command-line interface
- deeprelay batches cancel - Cancel a batch; finished lines keep their results
- deeprelay batches create - Submit an uploaded JSONL file as a batch
- deeprelay batches errors - Download a batch's error file (JSONL)
- deeprelay batches get - Show a batch: status, counts, schedule and cost
- deeprelay batches limits - Show your batch limits and current usage
- deeprelay batches list - List your batches, newest first
- deeprelay batches results - Download a batch's output file (JSONL)