Process thousands of requests asynchronously at half the cost. Perfect for bulk operations, data processing, and nightly jobs.
Half the cost of synchronous API calls
Up to 100,000 requests per batch
Results within 24 hours, often faster
from mythicdot import MythicDot
client = MythicDot()
# Step 1: Upload the batch input file
batch_file = client.files.create(
file=open("requests.jsonl", "rb"),
purpose="batch"
)
# Step 2: Create the batch
batch = client.batches.create(
input_file_id=batch_file.id,
endpoint="/v1/chat/completions",
completion_window="24h"
)
print(f"Batch created: {batch.id}")
# Step 3: Check status
batch = client.batches.retrieve(batch.id)
print(f"Status: {batch.status}")
print(f"Completed: {batch.request_counts.completed}")
# Step 4: Download results when complete
if batch.status == "completed":
results = client.files.content(batch.output_file_id)
with open("results.jsonl", "wb") as f:
f.write(results.content)
Queue your bulk operations for significant savings.