HomeChallengesRepsProblemsLeaderboardTake a challenge

AI Streaming Endpoint

Proxy Claude and stream tokens to the browser as they arrive, not after the whole answer lands.

Advanced25 min on the clock8 graded checks · 100 pointsASP.NET Core RefactorPro

See alsoStream the AnswerThe same streaming concept, graded in a second track.

Graded by reading your code against the checklist below.

What you build

  • Expose the token stream as IAsyncEnumerable<string> with yield return
  • Set the Server-Sent Events response headers and disable buffering
  • Write each token as a data: frame and flush immediately
  • Thread a CancellationToken all the way to the upstream call
  • Rate-limit the endpoint so one caller cannot drain your API budget

Done means

The browser receives tokens progressively rather than one response at the end.

How it is graded

Published in full, before you start — every point is one of these and there is nothing else.

  1. Return IAsyncEnumerable<string>+25Streaming responses
  2. Yield each token as it arrives+10Streaming responses
  3. Set the Server-Sent Events headers+15Streaming responses
  4. Write data: frames and flush each one+10Streaming responses
  5. Parse the streaming delta events+5Streaming responses
  6. Thread a CancellationToken through+15Rate limiting and cancellation
  7. Rate-limit the endpoint+10Rate limiting and cancellation
  8. Call the Anthropic Messages API correctly+10Calling a model API

What it teaches

The rest of ASP.NET Core Refactor