AI Interviews · Question

System design: design the OpenAI Playground.

System design question reported at OpenAI (2026). Sources, confidence and an answer card.

Researched · updated

eng-069 AI Engineer Practical LLM-plumbing code System design Low confidence
On this page

What they’re really asking

If you only remember one thing, say this in the first minute: “A playground is a page where you edit a prompt and model settings, press Run, and watch the answer stream in. Underneath, I’d treat it as the front door to the model platform. Saving creates a fixed version, and every run records which version it ran. Limits and costs are counted in tokens, reserved when a run starts and refunded from actual usage. If the stream breaks before the first word, I retry once; after the first word I show the partial answer with an error and a retry button. And I’d show token counts and cost on every run, because this is where users learn what their production calls will cost.”

The rest of this page explains each part of that answer.

A playground is a web app where a user edits a prompt (the instructions and text sent to a large language model, or LLM) and the model’s settings, runs it, watches the output stream in, and saves what worked.

It looks like a simple CRUD app with a text box. Three things make it harder than that:

  1. Runs cost wildly different amounts. Models are priced by tokens, small pieces of text of roughly ¾ of a word. One run sends 100 tokens; another sends 100,000. Limits and costs have to count tokens, not clicks.
  2. Output streams for seconds. The answer arrives piece by piece. If the connection breaks halfway, the user has already seen part of it, so a silent retry would show them a different answer glued to the first.
  3. The same input doesn’t give the same output. A saved preset reproduces what went in, not what came out.

Underneath, it is the same problem as the Anthropic prompt-playground question: fixed versions, runs tied to a version, streaming, retries, and per-user limits and cost. Ask which part they want first.

The report is a title only, “Design the OpenAI Playground”, on an aggregator list with no answer guidance (Aced (formerly Exponent)aggregator), so confidence is low.

Clarify first

Say your assumptions out loud:

  • Who uses it? “Developers testing prompts. I’ll assume authenticated users in an organisation with its own budget.”
  • What is saved? “Prompt text, system message, tools, model and sampling settings, as a shareable preset.” The system message is the fixed block of instructions at the top of the prompt.
  • Scope of models. “Many models, with different context limits and capabilities.”
  • Traffic. Unknown. “Assume interactive and bursty, with long-lived streams.”
  • Collaboration? “Sharing, not live co-editing.”

Answer

The picture

Browser
   │  POST /runs  (prompt, settings, idempotency key)
   ▼
API service ── authenticate; check the org's token limits and budget
   │           reserve input + max_tokens
   ▼
Gateway / inference layer ── model runs; tokens stream back
   │
   ▼
API service ── relays each token to the browser over server-sent events
   │
   ▼
On stream end ── refund unused tokens; write run, version id, usage, cost

The browser posts a run with an idempotency key (a unique value it picks, so a retried post returns the same run). The API service checks the organisation’s limits in tokens and reserves the worst case. The inference layer runs the model. Tokens flow back over server-sent events (SSE), one long HTTP response the server keeps writing to. When the stream ends, the run, its settings and its token usage are written.

Follow one run through it

A developer saves a preset for a support reply, with a 1,500-token prompt and max_tokens (the cap on the reply’s length) set to 1,000, and presses Run.

MomentWhat happensWhat to say in the interview
SaveThe preset becomes version p-3f9a, a content hash of prompt, tools, model and settings.”A version never changes, so a shared result always shows its exact inputs.”
RunAPI reserves 1,500 + 1,000 = 2,500 tokens against the user and the org.”Reserve the worst case; we don’t know the reply’s length yet.”
StreamThe first token arrives and is relayed; 300 tokens follow.”Once the first token is shown, no silent retry.”
EndThe model wrote 300 tokens. Refund 700. The UI shows tokens and cost for the run.”Refunds matter: without them we’d admit 28% fewer runs under the same limit.”
RerunSame version, slightly different answer.”The UI should say plainly that a rerun may differ.”

Versions

Saving creates a fixed preset version whose id is a content hash of prompt, tools, model and settings. A run records the version id it executed, so “share this result” always reproduces the inputs. The output may still differ on a rerun, and the UI should say so plainly.

Limits and cost

Limits are in tokens: reserve input plus max_tokens when the run starts and refund from actual usage, per user and per organisation. Show token counts and cost per run in the UI. Say it like this: “The playground is where users learn what their production calls will cost.”

The arithmetic behind the numbers (for a Staff-level follow-up)
Reserve and refund
reserve = input + max_tokens;  refund = max_tokens − actual_output
max_tokens
the output cap the user set
Worked example

Input 1,500, max_tokens 1,000, output 300: reserve 2,500, refund 700. Never refunding admits 28% fewer requests under the same tokens-per-minute limit.

The 28%: under any tokens-per-minute limit L, counting every run at 2,500 admits L ÷ 2,500 runs; counting the true 1,800 admits L ÷ 1,800. 1,800 ÷ 2,500 = 0.72, so 28% fewer.

Streaming and failures

If the stream breaks before the first token, retry once on the same model, within a retry budget (a cap on retries as a share of traffic). After the first token, show the partial output with an error and a “retry” button that creates a new attempt. If the user closes the tab, cancel the upstream call, so nobody pays for an answer nobody will read.

Model capability map

Models differ in their maximum prompt length (the context length), tool support and JSON output mode. The UI offers only settings the chosen model supports, and the server enforces the same map, so a hand-made API call can’t get around it.

Senior vs Staff

Playground

Senior

  • Streams with a clear retry boundary, versions presets immutably, limits in tokens and shows cost per run.

Staff

  • Treats the playground as the front door of the platform: the same versions, limits and capability map serve the API, so what works in the playground behaves the same in production.

In plain words: a Senior answer builds a correct playground. A Staff answer makes sure the playground and production share the same versions, limits and capability map, so nothing that works in one surprises you in the other.

Small-team version

Don’t build a playground at a 50–500 person company; provider consoles and tracing tools already offer one. What you build is the part that makes it useful internally:

  • prompts stored as versions (in git or a small table);
  • an eval run on each version, meaning a fixed set of real examples graded before the version ships;
  • a way to replay a production trace with a new version.

If product people need a UI, a thin internal page over your gateway with per-user budgets is enough.

Size the budget. An assumed 50 internal users running 100 runs a day each costs about $1,100 a month. A per-user cap of $5 a day bounds a runaway script at $250 a day across all 50. Build your own only when you need replay of production traces that the vendor tools can’t do.

The arithmetic behind the numbers (for a Staff-level follow-up)
  • Per run: an assumed 3,000 input and 400 output tokens on Claude Sonnet 5 at $2 / $10 per million (Anthropic pricing, fetched 2026-10-11) = $0.010.
  • Per month: 50 users × 100 runs × $0.010 × 22 working days = $1,100.
  • Cap: 50 users × $5 = $250 a day.

Pitfalls

  • Designing a chat UI and skipping the platform. Versions, limits and cost are the actual design.
  • Request-count limits. Runs vary from 100 to 100,000 tokens, so counting clicks protects nothing.
  • Retrying after tokens have streamed. The user sees two different answers glued together.
  • Claiming a saved version reproduces the output exactly. It reproduces the inputs; the output can differ.

Go deeper

Family