Module 9 · Lesson 3 of 6

Cost and speed go together

Fewer tokens, faster and cheaper

Trimming the prompt cuts both the bill and the wait, while streaming only changes how soon the first words appear.

Scene 1 of 4 · Eight chunks

With 8 retrieved chunks, the prompt is 3,450 tokens, and the chunks are most of it.

Where the prompt's tokens go
  • Instructions200 tokens
  • 8 retrieved chunks (highlighted)3,200 tokens
  • Question50 tokens
Prompt tokens
3,450
Input cost (example prices)
$0.0104
Prefill time
138 ms
First words, streamed
not shown yet
Whole answer
not shown yet
  1. Eight chunks. With 8 retrieved chunks, the prompt is 3,450 tokens, and the chunks are most of it.
  2. Four chunks. Sending the best 4 instead makes it 1,850 tokens, about half.
  3. Cheaper and faster. Input cost falls from $0.0104 to $0.00555, and prefill from 138 to 74 ms.
  4. Streaming helps the feel. Streaming costs the same, but the first words show after 123 ms, not after the whole 14.8 s answer.
  5. Now you try. Change how many retrieved chunks go into the prompt. For example: 5,050 prompt tokens: $0.0152 of input and 202 ms of prefill per request. Each chunk adds tokens you pay for and wait for; the 300-token answer still takes about 14.9 s, so stream it.

Scene 1 of 4: Eight chunks. With 8 retrieved chunks, the prompt is 3,450 tokens, and the chunks are most of it.

Key points

  1. Retrieved chunks are often most of the prompt.
  2. Fewer prompt tokens cost less and read faster.
  3. Streaming does not cut the cost at all.
  4. It does show the first words long before the answer is done.

A longer takes longer to read, and a longer answer takes longer to write. So trimming saves time as well as money.

Streaming the answer does not make it cheaper. But users see the first words sooner, which makes the wait feel shorter.

Example. Illustrative: cutting retrieved context from 8 to 4 might halve the prompt, lowering both the bill and the .

In system design: Give each part of the prompt a token budget: the instructions, the retrieved chunks and the conversation so far.

Check yourself

Does streaming the answer make a request cheaper?