Back to Automation

What Does a Request Actually Contain?

What Does a Request Actually Contain?
AI Tutorials Team 7 February 2026

A request is a small structured document. Knowing what each part does explains most of the behaviour that otherwise seems arbitrary.

What are the required parts?

  • The model. Which one should answer.
  • The messages. The conversation so far.
  • A maximum length. For the response.

What are messages made of?

A role and some content. The role says who is speaking, and the pattern alternates between the person and the assistant, building up a conversation the model reads as a whole.

What are the roles?

Broadly a user role for what you say, an assistant role for what the model said previously, and a system role or equivalent for standing instructions. Naming differs slightly between providers.

Why send previous messages back?

Because the model has no memory. A conversation exists only because you resend the history with each call, which is the single concept people most often misunderstand.

What does the maximum length control?

How much the model may generate, not how long the answer should be. Setting it high does not produce longer responses; it only allows them, and asking for a length in the prompt is what actually controls it.

What about the order of what you send?

More consequential than it looks. Material at the start and end of a long request is attended to more reliably than material in the middle, which is a documented pattern rather than a quirk.

The practical arrangement is stable instructions first, the variable material next, and the specific question last. That also happens to be the structure caching requires, so the two considerations point the same way.

What are the optional parameters?

Controls over randomness, stopping conditions, structured output and tools. Defaults are usually reasonable, and adjusting them without a specific reason tends to make things worse.

What about requests that are too large?

A failure worth handling rather than hoping to avoid. Applications processing user-supplied content will eventually receive something enormous, and the request will simply be rejected.

Checking length before sending, and either truncating with a note or splitting into parts, turns an error into a handled case. That is straightforward to build and it prevents the intermittent failures that are hardest to diagnose later.

What comes back?

The generated content, a reason for stopping, and usage counts. The stop reason matters: hitting your length limit and finishing naturally look identical in the text and differ in the response.

What about system instructions?

Where standing behaviour belongs, separate from the conversation. Putting instructions there rather than in each message is both cleaner and, with some providers, treated with more weight.

What is worth logging about requests?

The model used, the token counts and the stop reason, alongside whatever your application needs. Those three explain most of what you will later want to know about cost and truncation.

Storing the request identifier matters too. Providers include one in every response, and having it is what turns a support conversation about an odd result into something they can actually investigate.

What about sending the same thing repeatedly?

Worth noticing early, because it is charged every time. A system prompt, a set of examples and a reference document sent with every call are paid for on every call, which is invisible in testing and substantial at volume.

That is the arithmetic behind caching, and it is also an argument for keeping standing instructions tight. A system prompt twice as long as it needs to be costs twice as much on every request your application ever makes.

How large can a request be?

Bounded by the model's context limit, which covers everything: system instructions, the entire history and the response allowance together. That total is what constrains long conversations.

What is worth knowing early?

That everything you send is processed and charged every time. A conversation that grows costs more with each turn, which is the arithmetic behind most surprising bills.