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 Respan dashboard (Settings → Providers). Respan credits cannot be used for batch processing.
Respan parameters
You can pass Respan tracking parameters via the X-Data-Respan-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
-
input_file_id string required: ID of the uploaded JSONL file containing batch requests. Get this from the upload file endpoint.
Example
-
endpoint string required: The API endpoint to be used for all requests in the batch.
Supported values:
-
"/v1/chat/completions" - For chat completion requests
Example
-
completion_window string required: Time frame for batch processing completion.
Supported values:
-
"24h" - 24-hour completion window (only supported value)
Example
-
metadata object: Optional custom key-value pairs for tracking and organization.
Example
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