Article

Why Modern LLM APIs Use a List of Messages Instead of One Big String

Published 2026-09-14

The old way: one continuous string

Earlier generations of language model APIs took a single block of text and simply continued it — there was no built-in concept of "who said what." Any structure, like distinguishing instructions from a user's actual question, had to be faked with hand-written formatting conventions inside that one string.

The problem this caused

Without a real structural boundary, a clever or malicious user input could sometimes be crafted to look like it came from "the system" instead of "the user," since it was all just text to the model. It also made a genuine multi-turn conversation awkward to represent cleanly.

The fix: role-tagged messages

Modern chat-completion style APIs instead take a list of discrete messages, each explicitly tagged with a role — typically "system" (instructions for how the model should behave), "user" (what the person is asking), and "assistant" (the model's own prior replies in a conversation). This gives the model a real, structural signal about who's saying what, rather than relying on hoping the model correctly interprets informal text-based conventions.

Try it yourself

Our Prompt Formatter takes a system prompt and user message and formats them into this messages-array structure (or a simple XML-tagged alternative), ready to drop into your API request.

Ready to try it yourself?
Open the Prompt Formatter →