Skip to main content
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.
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 the X-Data-Keywordsai-Params header:
Supported parameters:
  • customer_identifier - User/customer identifier for tracking
  • environment - Environment label (e.g., “production”, “staging”)
  • custom_identifier - Custom identifier for your use case
  • thread_identifier - Thread/conversation identifier
  • metadata - Additional key-value metadata

Request body

string
required
ID of the uploaded JSONL file containing batch requests. Get this from the upload file endpoint.
string
required
The API endpoint to be used for all requests in the batch.Supported values:
  • "/v1/chat/completions" - For chat completion requests
string
required
Time frame for batch processing completion.Supported values:
  • "24h" - 24-hour completion window (only supported value)
object
Optional custom key-value pairs for tracking and organization.

Response

Returns a batch object with status information. The batch starts in validating status and progresses through various states until completion. Status values:
  • validating - Input file is being validated
  • failed - Validation failed
  • in_progress - Batch is processing
  • finalizing - Batch processing complete, output file being created
  • completed - Batch successfully completed
  • expired - Batch expired before completion
  • cancelling - Cancellation in progress
  • cancelled - Batch was cancelled