Token-by-token or all at once: picking a delivery mode

Every model API offers two ways to receive an answer: wait for the complete response, or stream it piece by piece as the model generates it. Chat interfaces almost always stream, because watching text appear feels fast even when the model is slow. Pipelines and background jobs often do not, because a complete JSON response is simpler to handle. Many developers start with one mode everywhere and run into trouble later.
This comparison explains how each mode works, what it costs in complexity, how errors and limits behave, and which mode suits which kind of feature. Code examples use the OpenAI-compatible streaming format of the keyless endpoint on this site, which sends server-sent events and ends with data: [DONE].
Frequently asked questions
What is a streaming response?
It is a response delivered in many small chunks over one open connection while the model is still generating. Each chunk carries a few tokens. The client shows or processes them as they arrive.
What are server-sent events?
Server-sent events, or SSE, are a simple standard for streaming text over HTTP. The server sends lines starting with data:, separated by blank lines. OpenAI-style APIs put a JSON chunk in each data line and finish with data: [DONE].
Does streaming make the model faster?
No. Total generation time is the same. Streaming reduces the time until the user sees the first words, which makes the experience feel much faster.
How does error handling differ between the modes?
With a full response, you get a status code and either a complete answer or an error. With streaming, the request can start successfully and then fail midway, so you must handle interrupted streams and partial text.
Which is better for JSON output?
Usually a full response. You need the complete text to parse JSON, so streaming adds complexity without benefit unless you show progress to a user while waiting.
Can I get token usage when streaming?
Some providers include usage in the final chunk, sometimes only when you ask for it. If yours does not, estimate from the text or use non-streaming requests where exact counts matter.
Does streaming work with reasoning mode?
Yes, but the visible answer starts later because the model thinks first. On the free endpoint, set "reasoning": true and a max_tokens of at least 2,000, and consider showing a thinking indicator.
Which is better for voice or real-time interfaces?
Streaming. Text-to-speech and live captions can start on the first sentence instead of waiting for the full answer, which cuts the perceived delay dramatically.
How the two modes work
In full-response mode, the client sends a request and waits. When the model finishes, the server returns a single JSON object containing the whole answer, a finish reason and usage counts. It is a normal HTTP request, and every tool in your stack understands it.
In streaming mode, the client sets "stream": true. The server keeps the connection open and sends a sequence of events, each holding a small delta of text. The last event marks the end. The client assembles the answer from the deltas, displaying them along the way if it wants to.
Full response: simple and atomic
You get everything or nothing. Logging, caching, retries and parsing all work exactly as they do for any other API.
Streaming: incremental and open-ended
You get pieces over time. That enables live display but means your code has to deal with a process, not a single result.
The user experience argument
For any answer longer than a sentence or two, streaming changes how an app feels. A reply that takes ten seconds to generate feels like a ten-second wait in full-response mode, but like an instant answer with streaming, because the first words appear in under a second and the user starts reading.
That is why nearly every chat product streams. It also helps users decide quickly whether an answer is going in the wrong direction, so they can stop it and rephrase instead of waiting for the whole thing. If speed itself is the issue, measuring it properly is covered in diagnosing slow model output.
Perceived speed
Time to first visible text matters more to users than total time. Streaming optimises exactly that number.
Early cancellation
A stop button is only useful with streaming. Cancelling saves tokens and frustration when an answer misses the point.

Consuming a stream in the browser
The endpoint here has open CORS and needs no key, so you can stream directly from a web page. The example below uses the Fetch API and a stream reader to read events, parse each data line and append text to an element. It handles partial lines, which occur because network chunks do not align with event boundaries.
This is the core of a chat UI. A production version adds a stop button using an AbortController, error display and a retry option.
Buffer partial lines
Network chunks can split an event in the middle. Keep the unfinished part in a buffer and only parse complete lines.
Stop on the done marker
The data: [DONE] line ends the stream. Treat a connection that closes without it as an interrupted answer.
async function streamChat(prompt, onText) {
const res = await fetch("https://api.apiclaudekeyfree.com/v1/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
model: "free-ai",
stream: true,
max_tokens: 600,
messages: [{ role: "user", content: prompt }]
})
});
if (!res.ok) throw new Error("HTTP " + res.status);
const reader = res.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
while (true) {
const { value, done } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop(); // keep the incomplete line for next time
for (const line of lines) {
if (!line.startsWith("data: ")) continue;
const data = line.slice(6).trim();
if (data === "[DONE]") return;
const delta = JSON.parse(data).choices?.[0]?.delta?.content;
if (delta) onText(delta);
}
}
}
streamChat("Describe a quiet harbour at dawn.", t => document.body.append(t));Where streaming gets complicated
Streaming moves complexity from the server to the client and to everything in between. Errors are the biggest change. With a full response, a failure gives you a clean error status. With streaming, the request can return 200, send half an answer, then stop because of a timeout, a server restart or a network glitch. Your code has to notice and decide whether to show partial text, retry or both.
Infrastructure can interfere as well. Some reverse proxies, serverless platforms and corporate networks buffer responses, so the stream arrives all at once at the end and the benefit disappears. Others close long-lived connections after a fixed time.
Test through your real stack
A stream that works from your laptop may be buffered by your production proxy. Check the time to first chunk through every layer before launch.
Disable buffering explicitly
Many proxies have a setting or response header to turn off buffering for streaming routes. Look it up for the server you use.
- Mid-stream failures that leave partial text.
- Proxies or platforms that buffer the stream.
- Connection timeouts on long answers.
- Missing or delayed usage data.
- More complex logging and caching, since the answer is assembled client-side.

Where full responses win
For anything a machine consumes rather than a person reads, full responses are usually the better choice. Classification, extraction, structured JSON output, tool arguments and batch processing all need the complete text before anything useful can happen. Streaming them adds code without adding value.
Full responses also make retries simpler. If a request fails, you resend it. There is no partial state to clean up and no question of whether the user already saw half an answer.
Structured output
JSON cannot be parsed until it is complete. Use full responses, validate the result and retry on malformed output.
Exact usage
Non-streaming responses reliably include token counts, which simplifies metering and budgeting.
Hybrid patterns
Many products mix both. A chat app streams the visible reply but uses full responses for background tasks such as generating a conversation title, classifying the message or extracting follow-up suggestions. An agent may stream its explanation to the user while calling tools with full responses.
Another hybrid is streaming structured output to show progress. The UI displays a spinner or partial preview while the JSON arrives, then parses it once the stream ends. It gives users feedback without trying to parse incomplete data.
Stream the human part
Stream whatever a person reads in real time; use full responses for everything that feeds code.
Progress without parsing
When streaming JSON, show a character count or a progress indicator, and parse only after the done marker.

Limits, retries and cost
Streaming does not change rate limits or token usage. On the free endpoint, a streamed request counts the same as a full one toward the per-IP limits of one request per second, two in parallel and the daily caps of 10,000 requests or 10,000,000 tokens. A long stream does hold one of your two concurrent slots for its whole duration, which matters if you run other requests at the same time.
When a stream fails midway, the tokens generated so far are usually still counted by paid providers. Decide whether to resume by sending the partial answer back and asking the model to continue, or to start over. Resuming saves tokens; starting over is simpler and avoids awkward joins.
Concurrency slots
Long streams occupy parallel slots longer. If your UI streams and also makes background calls, budget the concurrency between them.
Provider differences and portability
OpenAI-style streams, used by the free endpoint and many providers, send data lines with chunk objects and end with data: [DONE]. Anthropic's native Messages API streams named events instead. If your app supports several backends, normalise all streams into one internal event shape. The details are in OpenAI format vs the Messages API.
The endpoint here serves free-ai, an independent open-weight model of about 35B parameters that typically generates over 100 tokens per second; it is not Claude, and this site is not affiliated with Anthropic. For demanding answers a top commercial model will usually be stronger, and streaming is equally important there, because larger models are often slower per token.
One internal event type
Convert every provider's stream into simple events such as text and done. The UI then never needs to know which backend answered.
Decide per feature
Make streaming a per-feature choice in your code rather than a global switch, so each feature uses the mode that fits it.

A decision guide
If you are unsure which mode to use for a feature, ask two questions. Will a person watch the output appear? And does any code need the complete text before it can act? If a person watches and no code waits, stream. If code waits and nobody watches, use a full response. If both apply, use a hybrid: stream for display and parse at the end.
Revisit the decision when a feature changes. A background summary that later becomes visible in the interface may deserve streaming, and a chat reply that starts feeding an automation may need a full response alongside it. Writing that choice down next to each feature also helps new team members understand the code.
Default for chat
Stream user-facing chat replies, add a stop button, and handle interrupted streams by keeping the partial text visible with a retry option.
Default for pipelines
Use full responses for jobs, tools and structured data, validate the result and retry on failure. It keeps the code short and the logs clear.
Send a test request to the keyless, OpenAI-compatible endpoint on the home page and see how it fits your project.