Design an Asynchronous Batch Inference API With 24-Hour Completion Windows

Last updated: November 29, 2026

Quick Overview

Design an API where developers upload a file of thousands to millions of requests, the platform processes them at a discount using spare GPU capacity, and results are returned within 24 hours.

OpenAI
System Design
Software Engineer
OpenAI
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design an API where developers upload a file of thousands to millions of requests, the platform processes them at a discount using spare GPU capacity, and results are returned within 24 hours.

OpenAI's Batch API trades latency for lower prices by filling idle inference capacity. The interviewer is looking at job lifecycle design, how batch work yields to interactive traffic, and how partial failures and expiry are reported back.

What the Interviewer Expects
  • Define the job lifecycle: validating, in progress, finalizing, completed, failed, expired, canceled
  • Split a batch into shards that workers can lease and retry independently
  • Schedule batch work as low-priority filler that preempts cleanly for real-time traffic
  • Produce an output file and an error file keyed by each request's custom_id
  • Meter and bill at the batch discount, only for successful requests
Key Topics to Cover
job queues
leases
priority scheduling
object storage
idempotency
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • How do you make sure a batch submitted during peak hours still finishes in 24 hours?
  • How would you support cancellation of a batch that is half done?
  • How do you stop one customer's 10M-line batch from starving others?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Upload a JSONL file where each line is a request with custom_id; create a batch with an endpoint and 24h window.
  • Poll status with counts; download results and errors.
  • Lower price; no latency g...
High-Level Design
  • Files service stores the input in object storage.
  • Batch service validates the file (schema, model, token counts) and splits it into shards of, say, 1,000 lines, recording `shard(batch_id, ...

Submit Your Answer
Markdown supported