A system prompt is an application- or developer-provided instruction that tells a language model its role, rules, output format, and context independently of end-user messages. OpenAI, Anthropic, and Google each expose this control under different official API names, and none treat it as an unbreakable security boundary.
When builders compare a system prompt vs user prompt, the distinction comes down to who writes the text and what job that text performs inside an application. End users type requests into a chat box or form, while the software developer writes persistent guidance that shapes how the model responds across turns. Even though these instructions sit in separate fields or roles in an API request, the model still processes every character as part of the prompt and counts the text toward request tokens.
How does a system prompt differ from a user prompt?
A system prompt sets the operating rules, persona, formatting expectations, and background context from the developer, whereas a user prompt carries the end user’s immediate request or question. In a customer support chat, for example, the developer sets tone rules and escalation criteria before the session starts, while the customer asks about a billing error or shipping delay.
Separating developer guidance from end-user input helps keep application behavior consistent across different users. When you build an AI agent or structured workflow, system-level instructions work alongside tool definitions to shape how the model formats answers and invokes functions, while remaining distinct from the agent orchestration loop itself.
Instruction authority also separates the two roles, though the exact hierarchy depends on the model provider and API design rather than a single universal standard. OpenAI, Anthropic, and Google each document their own precedence rules and model support matrices, and none claim that developer instructions guarantee immunity against adversarial user text.
How OpenAI, Anthropic, and Google name the system prompt
OpenAI, Anthropic, and Google expose system-level instructions under different API fields and message roles because the AI ecosystem has no single standardized request schema. Every major provider gives developers a dedicated place to pass setup instructions ahead of user turns, yet the exact parameter names, allowed formats, and precedence rules vary by vendor and model generation as of November 2026.
| Provider | Official API name | Placement and format | Documented authority and scope |
|---|---|---|---|
| OpenAI (Chat Completions) | role: "system" or role: "developer" |
Message objects in messages array |
developer replaces system on o1 and newer; Model Spec ranks OpenAI system above developer, and developer above user when both appear |
OpenAI (gpt-oss Harmony) |
system and developer roles |
Five-role Harmony format | system sets reasoning effort and built-in tools; developer holds prompt instructions; hierarchy is system > developer > user > assistant > tool |
| Anthropic (Messages API) | Top-level system parameter; mid-conversation role: "system" |
Top-level string or text block array; optional messages role on listed models |
Operator-level priority over user messages; later system messages override earlier ones; mid-conversation role unsupported on Claude Sonnet 5 |
| Google (Gemini API) | system_instruction / systemInstruction |
Request-level field; currently text only | Developer-set preamble applied across turns; supported on all Gemini models except Gemini TTS models |
OpenAI: system messages, developer messages, and the Model Spec
OpenAI’s Chat Completions API reference defines both a system role and a developer role for application builders. For role: "system", the documentation states: “Developer-provided instructions that the model should follow, regardless of messages sent by the user. With o1 models and newer, use developer messages for this purpose instead.” For role: "developer", the reference explains that “With o1 models and newer, developer messages replace the previous system messages.”
OpenAI’s reasoning best practices guide notes that starting with o1-2024-12-17, reasoning models accept developer messages instead of system messages to match OpenAI’s chain of command. Historically, early reasoning releases such as o1-preview and o1-mini did not support system or developer messages at all, which makes checking model-specific API docs essential.
In the OpenAI Model Spec updated October 29, 2026, OpenAI distinguishes three conversation actors: system refers to “messages added by OpenAI,” developer refers to instructions “from the application developer,” and user refers to an end user of an OpenAI product or a third-party API application. The spec notes that OpenAI may insert system messages into the input to steer behavior, and API developers receive model outputs without necessarily knowing the existence or contents of those system messages. On authority, the spec treats user and developer messages almost interchangeably, “except that when both are present in a conversation, the developer messages have greater authority,” while OpenAI-added system sections and system messages sit higher in the chain of command.
OpenAI also documents the Harmony response format specifically for open-weight gpt-oss models. In Harmony, a system message configures reasoning effort, metadata like knowledge cutoff, and built-in tools, while a developer message “is used to provide information about the instructions for the model (what is normally considered the ‘system prompt’) and available function tools.” Harmony’s hierarchy runs system > developer > user > assistant > tool. Its documentation includes an illustrative identity line (“You are ChatGPT, a large language model trained by OpenAI”) for that format, which applies to the Harmony example and is separate from hosted ChatGPT’s production setup or hosted Chat Completions requirements.
Anthropic: top-level system parameter and mid-conversation roles
Anthropic’s Create a Message reference exposes a top-level Claude system parameter outside the messages array, defining it as: “System prompt. A system prompt is a way of providing context and instructions to Claude, such as specifying a particular goal or role.” Developers can pass either a plain string or an array of text blocks. In the original Messages HTTP API design, input turns inside messages had no "system" role, making the top-level system field the standard entry point.
Anthropic’s prompting best practices explain that “Setting a role in the system prompt focuses Claude’s behavior and tone for your use case. Even a single sentence makes a difference.” The guide illustrates this with a short example string: “You are a helpful coding assistant specializing in Python.” That snippet serves only as a demonstration of role prompting, leaving actual instructions up to each application.
For workflows that introduce new rules partway through a session, Anthropic documents mid-conversation system messages. On supported models as of November 2026 (Claude Fable 5.2, Mythos 5.2, Fable 5.1, Mythos 5.1, Fable 5, Mythos 5, Opus 5.5, Opus 5, Opus 4.8, Sonnet 5.5, and Haiku 5.5), developers can append {"role": "system"} directly inside messages. Anthropic explicitly notes: “This feature is not available on Claude Sonnet 5. Use the top-level system field there instead.”
Anthropic treats any system message as coming from the application operator, meaning it takes precedence when it conflicts with a user message. Later system messages override earlier ones, and mid-conversation system messages override the top-level system parameter for subsequent turns. Because of that operator authority, Anthropic warns that system messages are “Not a place for untrusted content,” advising builders to keep raw tool output, retrieved documents, and web content inside tool_result blocks rather than promoting them to system messages.
Google Gemini: system_instruction and systemInstruction
Google’s Gemini API text generation guide introduces system_instruction in SDK calls (“You can guide the behavior of Gemini models with system instructions. Pass a system_instruction parameter to configure the model’s behavior”), paired with a simple illustrative value: “You are a cat. Your name is Neko.” In the REST generateContent reference, the request field is named systemInstruction and described as “Optional. Developer set system instruction(s). Currently, text only.”
According to Firebase AI Logic and the Gemini Enterprise Agent Platform documentation, system instructions act as a preamble before the model reads end-user messages. Developers use them to set persona or role, output format, style and tone, task rules, and extra context like a knowledge cutoff. Once attached to a request, system instructions apply across the entire call and across multi-turn chats when included, and Firebase notes support across all Gemini models except Gemini TTS models. Google also reminds builders that “Though system instructions are separate from the contents of the prompt, they’re still part of your overall prompts and therefore subject to standard data use policies.”
Why keep a system prompt stable for prompt caching?
Developers keep a system prompt stable across turns and requests because placing unchanging instructions at the start of a request lets providers reuse a cached prefix instead of reprocessing identical setup text. Anthropic’s mid-conversation system-message guide spells out this trade-off directly: because the top-level system field sits ahead of every turn, editing that field mid-conversation invalidates the prefix for prompt caching for everything that follows.
Appending new instructions later in the conversation preserves the cached top-level prefix on supported Claude models. More broadly across APIs, keeping instructions concise and consistent also prevents unnecessary token growth, since developer instructions consume context capacity on every call.
Can a system prompt prevent prompt injection or hide secrets?
A system prompt guides ordinary model behavior, yet it cannot reliably block prompt injection, jailbreaks, or prompt extraction. Google states this limitation plainly in both its Firebase and Gemini Enterprise Agent Platform guides: “System instructions can help guide the model to follow instructions, but they don’t fully prevent jailbreaks or leaks. We recommend exercising caution around putting any sensitive information in system instructions.”
Anthropic’s documentation on reducing prompt leaks similarly treats system prompt confidentiality as a risk to mitigate rather than a guarantee. In my own API work, treating system instructions as behavioral configuration and keeping sensitive credentials or private business logic out of prompts is the cleanest way to avoid accidental exposure. Mixing untrusted external text into system messages is even riskier, because placing retrieved web pages or raw tool outputs into a system role grants that text operator-level priority. For teams deploying AI internally, protecting sensitive records requires proper access controls and data hygiene to use AI at work without leaking data.
What belongs inside a system prompt?
An effective system prompt states the model’s role, formatting requirements, behavioral rules, and static background context in clear language tailored to the application. Official vendor examples are intentionally short, such as Anthropic’s Python assistant sentence or Google’s cat persona snippet, because each app needs instructions calibrated to its own task.
Across OpenAI, Anthropic, and Google documentation, the common building blocks fit into four categories:
- Role and audience: Defining who the assistant is acting as and how it should address the user, such as tone and level of detail.
- Task goals and rules: Specifying what the model should prioritize, verify, or refuse within the application’s scope.
- Output format: Requesting plain prose, bulleted summaries, or structured schemas required by downstream code.
- Static context: Supplying reference facts, product boundaries, or a relevant knowledge cutoff that apply across turns.
Keeping those four elements clear and concise makes instructions easier to maintain, easier to cache, and less likely to conflict with later messages in a long conversation.
FAQ
Is a developer message the same thing as a system prompt?
In OpenAI’s Chat Completions API, a developer message serves the role developers traditionally expect from a system prompt on o1 models and newer. Starting with o1-2024-12-17, developer messages replaced system messages to match OpenAI’s Model Spec, where system refers to messages inserted by OpenAI itself and developer refers to instructions sent by the application builder.
Does the Claude system parameter allow system messages inside the conversation?
Anthropic’s Messages API originally placed all instructions in the top-level system parameter because input messages in the messages array had no "system" role. As of November 2026, Anthropic also supports mid-conversation {"role": "system"} messages on Claude Fable 5.2, Mythos 5.2, Fable 5.1, Mythos 5.1, Fable 5, Mythos 5, Opus 5.5, Opus 5, Opus 4.8, Sonnet 5.5, and Haiku 5.5, though Claude Sonnet 5 still requires the top-level field.
Do system prompts count toward token limits and billing?
System instructions, developer messages, and system prompt parameters are all sent as part of the prompt and consume tokens in the model’s context window. None of the major API references from OpenAI, Anthropic, or Google exempt system instructions from token counting, which means verbose rules take up space alongside conversation turns and retrieved context.
Can Google Gemini system instructions contain images or secrets?
Google’s generateContent API reference specifies that systemInstruction is currently text only, so non-text inputs belong in regular prompt contents. Google’s Firebase AI Logic and Enterprise Agent Platform documentation also cautions that system instructions do not fully prevent jailbreaks or leaks and remain subject to standard data use policies, advising developers to exercise caution before placing sensitive information inside them.
Why can a user message still override a system prompt?
A system prompt guides model behavior, yet models evaluate the full conversation text together and remain vulnerable to prompt injection and jailbreaks. Authority also depends on vendor design: OpenAI’s Model Spec gives developer messages greater authority when paired with user messages, while Anthropic gives operator-level priority to system messages, yet neither vendor presents instructions as an absolute technical barrier.
Sources
- OpenAI Chat Completions API Reference (“Create chat completion”)
- OpenAI Reasoning Best Practices
- OpenAI Model Spec (2026-10-29)
- OpenAI Harmony Response Format
- Anthropic Messages API (“Create a Message”)
- Anthropic Messages HTTP API
- Anthropic Prompting Best Practices (“Give Claude a role”)
- Anthropic Mid-Conversation System Messages and Tool Changes
- Anthropic Reduce Prompt Leak
- Google Gemini API Text Generation Guide
- Google Gemini API
generateContentReference - Firebase AI Logic: Use System Instructions to Steer the Behavior of a Model
- Google Cloud Gemini Enterprise Agent Platform: System Instructions Introduction



