LLM API Requests and Responses
In this article
- Read a request to a hosted model: find its model name, system prompt, the role of each message and the output limit.
- Read a response: find the reply text, say from the stop reason why it ended, and tell whether it is complete.
- Explain why a follow-up in the same chat is a new request that carries every earlier turn again.
- Check whether a request and its reply fit in the context window, counted in tokens.
- Terms defined here: model API, message role, system prompt, stop reason, context window.
Overview
In the Eiffel chat, you typed "In which city is the Eiffel Tower?" and a chat assistant showed "Paris.". Between those two moments the application sent the model a request and got back a response, two pieces of text with a few named parts each. Read them and three everyday puzzles have plain answers: why a reply stops mid-sentence, why a follow-up costs more than the first question, and why a long chat eventually runs out of room.
One rule carries all of it. The request is everything the model will see. The response says what came back and why it stopped.
Sign in to keep reading
The rest of this article opens with an account. An account also keeps your progress and quiz results on every device, and lets you follow news for up to five topics.
Still to read in this article
- The request
- What the model reads
- The response
- The second turn
- The context window
- Sources
- Check yourself, 5 questions