Skip to content

Batch Request File Builder

Turn a request template and a CSV of rows into a validated JSONL batch file, with unique ids, correct escaping and your provider's limits checked.

Requests in the file
4

Every row became one line. The file was read back line by line the way the API reads it, and every custom_id came back unique.

Rows in your CSV
4
Rows rejected
0
File size
1,327 bytes
Largest single request
349 bytes
Estimated input tokens, whole file
≈ 331
What this assumes: each line is one JSON object with custom_id, method, url and body, which is the shape the batch endpoints of the large providers share. The limits are fields because they differ by provider and change: nothing about anyone's limits is shipped with this page, so type your own from their documentation. A {{value}} is escaped as JSON string content — quotes, backslashes and newlines in your data cannot break the JSON — and {{{value}}} is inserted raw, which is what you want for numbers and what will break the line if you use it on free text. The token figure is characters ÷ 4 across the whole file and is an estimate. Everything on this page runs in your browser. Nothing you paste is uploaded, logged or sent anywhere.

Batch endpoints are the cheapest way to run a large one-off job, and the file format is the entire interface. There is no partial acceptance: a single line that is not valid JSON, or a repeated custom_id, rejects the upload, and the error you get back usually names a byte offset rather than a row.

The escaping that decides whether this works

Every naive builder concatenates the value into the template and every one of them breaks on the first support ticket containing a quotation mark. The values here go through JSON string escaping before they are inserted, so an apostrophe, a newline, a tab or a backslash in your data ends up as valid JSON rather than a syntax error two thousand lines into a file. The triple-brace form exists for the opposite case — a number, a boolean, a nested object — and it deliberately does no escaping at all, which is why the page tells you which placeholders used it.

custom_id is not decoration

Results come back in whatever order the provider finished them, so the id is the only thing tying a result to the row it came from. Use something from your own data — a ticket number, a primary key — and not the row index, because the row index of a file you regenerate next week will point at a different record. Duplicates are reported here rather than deduplicated, because a duplicate means two of your rows are about to share an answer and only you know which one is wrong.

What the token estimate is for

It is a sanity check on scale, not a bill. Batch pricing is typically a discount on the synchronous rate and is applied to input and output separately, so the number that matters is the input tokens across the whole file plus whatever the model generates — which nothing here can know in advance. If the estimate is an order of magnitude away from what you expected, the template is probably carrying a system prompt you forgot is repeated on every one of these lines.

Batch Request File Builder · Multigrid