Skip to main content

Introduction

The Batches API allows you to process large volumes of API requests asynchronously at half the cost of standard API calls. Perfect for bulk operations, data processing pipelines, and overnight jobs that donโ€™t require immediate responses.

Save 50% with Batch Processing

Batch API offers 50% cost savings compared to standard synchronous API calls. Process thousands of requests efficiently while you sleep!

Key Benefits

  • ๐Ÿ’ฐ 50% Cost Reduction: Significantly lower costs for bulk processing
  • โšก Async Processing: Submit jobs and retrieve results when ready
  • ๐Ÿ“Š Progress Tracking: Monitor completion status in real-time
  • ๐Ÿ”„ Automatic Retries: Built-in retry logic for failed requests
  • ๐Ÿ“ Organized Results: Separate output files for successes and errors
  • โฑ๏ธ 24-Hour Window: All batches complete within 24 hours

How It Works

  1. Upload a JSONL file containing your requests
  2. Create a batch job referencing the uploaded file
  3. Monitor progress as requests are processed asynchronously
  4. Download results from output files when complete

API Endpoints

Create Batch

Start a new batch job for asynchronous request processing

Get Batch

Check the status and progress of a batch job

Cancel Batch

Cancel a running batch job before completion

List Batches

View all your batch jobs with filtering and pagination

Supported Endpoints

Batch processing is available for the following endpoints:

Chat Completions

/v1/chat/completionsProcess conversations at scale

Embeddings

/v1/embeddingsGenerate embeddings in bulk

Responses

/v1/responsesBatch response generation

Quick Start

Step 1: Prepare Your Input File

Create a JSONL file with your requests:

Step 2: Upload the File

Response:

Step 3: Create the Batch

Response:

Step 4: Monitor Progress

Step 5: Download Results

Once the batch status is completed:

Batch Status Lifecycle

Tier Limitations

Free Tier: Batch API is not available on the Free tier. Upgrade to Basic or higher to unlock batch processing.

Best Practices

Balance between batch size and completion time. Larger batches (1000+ requests) maximize cost savings, while smaller batches complete faster. Consider your use case requirements.
Assign meaningful custom_id values to each request. This helps you map results back to your original data when processing output files.
Always check both output and error files. Some requests may succeed while others fail. Implement retry logic for failed requests if needed.
Stay within your tierโ€™s concurrent batch limit. Queue additional batches to start after current ones complete.
All batches complete within 24 hours. For time-sensitive operations, consider using standard API calls instead.
Ensure your JSONL file is properly formatted before creating a batch. Invalid format will cause immediate failure during validation.

Output File Format

Successful results are returned in JSONL format:
example.jsonl
Error file format:
Response error

Use Cases

Data Labeling

Classify or label thousands of text samples for ML training datasets

Content Moderation

Analyze large volumes of user-generated content for policy compliance

Translation

Translate documentation or content into multiple languages at scale

Sentiment Analysis

Process customer feedback, reviews, or social media posts in bulk

Embeddings Generation

Create vector embeddings for entire document collections or knowledge bases

Report Generation

Generate hundreds of personalized reports from structured data

Error Handling

Common batch errors and solutions:

Rate Limits

Batch processing has different rate limits than standard API calls:
  • Concurrent Jobs: Based on your tier (see table above)
  • Requests per Batch: No hard limit, but recommend 10,000 max for optimal performance
  • File Size: Maximum 100MB per input file
  • Processing Time: All batches complete within 24 hours
For processing more than 50,000 requests or custom concurrent limits, contact our enterprise team for a custom plan.
Last modified on December 4, 2025