Batches
Create batch
POST
Create a new batch job for asynchronous processing of multiple LLM requests. Batch processing offers 50% cost savings compared to synchronous API calls, with results delivered within 24 hours.
Supported parameters:
Prerequisites: You must first upload an input file using the Files API before creating a batch.
Customer credentials required: This endpoint requires your own OpenAI API key configured in Keywords AI dashboard (Settings → Providers). Keywords AI credits cannot be used for batch processing.
Keywords AI parameters
You can pass Keywords AI tracking parameters via theX-Data-Keywordsai-Params header:
customer_identifier- User/customer identifier for trackingenvironment- Environment label (e.g., “production”, “staging”)custom_identifier- Custom identifier for your use casethread_identifier- Thread/conversation identifiermetadata- Additional key-value metadata
Request body
string
required
ID of the uploaded JSONL file containing batch requests. Get this from the upload file endpoint.
Example
Example
string
required
The API endpoint to be used for all requests in the batch.Supported values:
"/v1/chat/completions"- For chat completion requests
Example
Example
string
required
Time frame for batch processing completion.Supported values:
"24h"- 24-hour completion window (only supported value)
Example
Example
object
Optional custom key-value pairs for tracking and organization.
Example
Example
Response
Returns a batch object with status information. The batch starts invalidating status and progresses through various states until completion.
Status values:
validating- Input file is being validatedfailed- Validation failedin_progress- Batch is processingfinalizing- Batch processing complete, output file being createdcompleted- Batch successfully completedexpired- Batch expired before completioncancelling- Cancellation in progresscancelled- Batch was cancelled