Converter tool

CSV to LLM Batch Request JSONL

Fill a prompt template from every CSV row and download one batch request line per row, in an OpenAI-style or Anthropic-style layout. Runs in your browser.

Both layouts follow each provider's public documentation at the time of writing. Field names and limits change, so check the current batch documentation before you submit. This page writes nothing to localStorage, sessionStorage or IndexedDB.

Preview

Output Preview

Load a CSV and write a prompt template to preview the first request lines here.

CSV to LLM Batch Request JSONL

Operator: Abdulla Al Fahad. How tools are built and checked

Sending a thousand product descriptions through a language model one call at a time is slow to script and awkward to retry. Batch interfaces take a single file instead: one JSON request per line, each tagged with an id so the answers can be matched back later. When the inputs live in a spreadsheet, the missing piece is a way to turn each row into one of those request lines. This page does that from a prompt template: write the message once, mark the columns with double braces, and every row fills it in.

The tool does not call any model and never sees an API key. It only writes the request file. You choose the layout (an OpenAI-style line with a body, or an Anthropic-style line with params), the model name, the output limit and an optional temperature, then upload the file wherever you intend to run it.

Key features

  • Prompt and optional system templates with {{column}} placeholders
  • Header list shown on screen; unknown placeholders rejected with the available names
  • custom_id from a column, or generated as row-1, row-2 and so on
  • Checks for empty, duplicate and badly formed ids, with spreadsheet row numbers
  • OpenAI-style and Anthropic-style layouts
  • Model name, max tokens and optional temperature set once for the whole file
  • Preview of the first three lines and an estimated input size per request
  • Single .jsonl download, one request per line

Template placeholders and the two request layouts

Each CSV column becomes a name you can use in a template, so the first line must hold distinct, meaningful headers. Quoted cells may hold commas and line breaks. A NUL byte near the start gets the file refused, and a UTF-16 file needs its byte-order mark. Limits: 25 MB and 100,000 data rows.

Placeholders are written {{column}} and must match a header exactly, apart from spaces just inside the braces. A cell's text is inserted as it appears, untrimmed and unescaped, and JSON escaping is applied afterwards, so quotes and line breaks in a cell are safe. An empty cell inserts nothing. A placeholder that names no header is an error that lists the headers you do have.

The OpenAI-style line is {"custom_id", "method":"POST", "url":"/v1/chat/completions", "body":{"model", "messages", "max_tokens"}} with temperature added inside body when you fill it in. The Anthropic-style line is {"custom_id", "params":{"model", "max_tokens", "system", "messages"}}, again with optional temperature, and system present only if you wrote a system template. Both follow the providers' public documentation as it stood when this page was written. Those documents change, so check the current version before submitting a large file.

custom_id values must be unique, and this page also requires letters, digits, underscore and hyphen only, up to 64 characters. Your provider may allow more or less, so confirm its rule.

How it works

The CSV is parsed with the site's own parser. Before any line is written, the templates are scanned for placeholders and compared with the header, the model name and max tokens are validated, and the custom_id values are collected. If anything fails, the page shows every problem at once and writes nothing. This catches common mistakes only; it does not predict what a provider will accept.

Id checks use spreadsheet row numbers, where the header is row 1. An empty id cell, an id with a space or a dot, and an id longer than 64 characters are each reported with the rows they occur on. Duplicates are grouped by value, so "q-7" repeated on rows 4 and 9 appears as one message naming both rows.

Each line is built with JSON.stringify, so it contains no raw line break and the file can be split on newline characters. The user message is the prompt template with every placeholder replaced by that row's cell. The system message, if any, is filled the same way.

The size shown beside the preview adds the system and user text of each request and guesses tokens from character and word counts. It leaves out the reply and the framing a provider adds, so it is a rough guide only.

Common use cases

  • Running one classification prompt over every support ticket in an export
  • Asking for a short summary of each product description in a catalogue sheet
  • Translating a column of interface strings with a system template that fixes the tone
  • Generating alt text candidates for a list of image captions
  • Re-running only the rows that failed last time, by filtering the CSV to those ids first

How to use this tool

  1. Load the CSV, or press Use sample data for three questions with ids.
  2. Write the prompt template, using the column names shown above it, for example Answer briefly: {{question}}.
  3. Optionally add a system template. It can use placeholders too.
  4. Pick the layout, the column that supplies custom_id (or generate ids), the model name and the max tokens.
  5. Fix anything the page lists in amber, then check the three preview lines.
  6. Press Download .jsonl and upload the file through your provider's batch interface.

Example

questions.csv with template "Answer briefly: {{question}}", OpenAI-style, max tokens 100

id,question
q-001,What is the capital of Australia?
q-002,Why is the sky blue?

questions-batch.jsonl (2 lines, model name typed by you)

{"custom_id":"q-001","method":"POST","url":"/v1/chat/completions","body":{"model":"your-model-name","messages":[{"role":"user","content":"Answer briefly: What is the capital of Australia?"}],"max_tokens":100}}
{"custom_id":"q-002","method":"POST","url":"/v1/chat/completions","body":{"model":"your-model-name","messages":[{"role":"user","content":"Answer briefly: Why is the sky blue?"}],"max_tokens":100}}

Tips for best results

  • Use the id column from your source system as custom_id; it makes joining the answers back to your data a plain lookup.
  • Keep the instruction in the template and the data in the cells. Mixing them makes it harder to change the wording later.
  • Start with a CSV of five rows and check the preview lines against your provider's documentation before generating the full file.
  • Set max tokens deliberately: a limit that is too low cuts replies off, one that is too high may reserve more capacity than you need.
  • Leave temperature empty if you are unsure; the line then carries no such field and the provider default applies.

Edge cases to watch

Cell text is inserted verbatim. A cell that contains instructions of its own, such as a customer message that says to ignore the rest, becomes part of the prompt.

A placeholder with different capitalisation than the header, such as {{Question}} for a column named question, is treated as unknown.

Ids that look fine in a spreadsheet may carry a trailing space or a non-breaking space. The id is trimmed, but a hidden character inside it fails the pattern and is listed.

Numbers in cells that a spreadsheet program reformatted, such as long ids turned into 1.2E+11, are already damaged in the CSV; fix them at the source.

The page checks structure only. It cannot know whether the model name exists or whether your account allows batches.

Common errors and how to fix them

The prompt template uses {{name}}, which is not in the CSV header.
Compare the name with the list of columns printed above the template, and retype it exactly as written there. The message also repeats the header names.
custom_id "q-7" is repeated on rows 4 and 9.
Make the ids unique in the CSV, or choose Generate row-1, row-2 so the page numbers the rows for you.
custom_id may use only letters, digits, underscore and hyphen.
Replace spaces, dots, slashes and similar characters in the id column, or generate ids and keep the original in a separate column of your own.
Enter a model name.
Type the model identifier exactly as your provider's documentation lists it. The page does not offer a list because names change.

Best practices

  • Store the CSV, the template text and the model settings together so a run can be reproduced.
  • Remove personal data from cells that the model does not need.
  • Compare the preview with a request you know works before uploading the full file.
  • Keep the generated file; its custom_id values are your key for matching results.

A worked size estimate

Take a template of 6 words plus a cell of 44 words, 50 words in all and about 300 characters. By characters that is 75 tokens, by words 67, so the page reports roughly 71 per request. For 2,000 rows of that size the total is about 142,000 input tokens. Type your provider's price per million tokens into your own calculator if you need money; this page deliberately shows no prices.

Frequently asked questions

Does this page send my data to an AI service?

No. It builds the request text in this tab and offers it for download. It makes no call to any model, and your CSV is not uploaded by this tool. Rows are held in memory while the page is open and are not written to localStorage, sessionStorage or IndexedDB.

Why are there two layouts?

Different providers name the fields differently. Pick the one that matches the documentation of the service you will upload to, and recheck it before large runs because formats evolve.

Can I use the same column twice in a template?

Yes. Every occurrence of {{column}} is replaced.

Can I put a literal {{ in a prompt?

Only text of the exact form {{name}} is treated as a placeholder, and it must match a header. A stray "{{" or "}}" without a matching pair is rejected with a message, and complete braces around an unknown name are reported as an unknown column, so rephrase such text or remove the braces.