Cost, Speed and Streaming
Making AI apps practical.
A demo that works is not the same as a product that lasts. Real apps must be fast enough, cheap enough, and reliable. In this lesson, you will learn how to estimate cost, how to speed things up, and why streaming makes apps feel instant.

- Estimate the cost
- Make it faster
- Stream for a better feel
How pricing works
Most providers charge per token, with separate prices for input tokens, the text you send, and output tokens, the text you receive. Output usually costs more. A short question and answer costs a tiny fraction of a cent. But a long document, sent a thousand times a day, adds up. So estimate before you launch. Count the tokens in a typical request, multiply by the price, and by your expected number of users.
Speed and savings
There are many ways to save time, and money. Use a smaller model for easy tasks. Keep prompts short, and cut repeated instructions. Cache answers to common questions. Ask for shorter outputs, when long ones are not needed. And process big jobs in batches. A smart design can cut costs by an order of magnitude, with no loss of quality.
Streaming responses
Waiting for a full answer can take many seconds. Streaming fixes that feeling. Instead of waiting, the server sends the answer token by token, as it is produced, and your app shows each piece at once. The total time is the same, but the first words appear almost immediately, so the app feels fast. This is why chat tools type out their answers.
- Request sentthe user asks
- First token arriveswithin a moment
- Tokens keep flowingshown as they come
- Complete answerfeels fast throughout

Summary
Good. Costs depend on tokens, so estimate early. Save with smaller models, shorter prompts, caching, and batching. And stream replies, so apps feel instant. You can now build a real chatbot. Next, we give it knowledge of your own documents, with embeddings, and retrieval.
Key takeaways- Pay per token: input and output
- Smaller models, shorter prompts, caching
- Stream for a fast feel