Comparison Beginner · 3 min read

What is the difference between system and user prompt

Quick answer
A system prompt sets the AI's overall behavior and context before interaction, guiding tone and constraints. A user prompt is the actual input or question the user wants the AI to respond to during the conversation.

VERDICT

Use system prompts to define AI behavior and context; use user prompts for specific user queries and instructions.
Prompt typePurposeWhen usedExample roleTypical content
system promptSet AI behavior and contextAt conversation start or resetSystemInstructions, tone, constraints
user promptUser's question or commandDuring conversationUserQueries, tasks, requests

Key differences

The system prompt defines the AI's role, style, and rules before any user input. It acts as a guiding framework for the entire session. The user prompt is the actual input from the user that the AI responds to, such as questions or commands. System prompts are typically set once per session, while user prompts occur repeatedly during interaction.

Side-by-side example

Example of using system and user prompts together in OpenAI's gpt-4o chat API:

python
from openai import OpenAI
import os

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "system", "content": "You are a helpful assistant that responds formally."},
        {"role": "user", "content": "Explain the difference between system and user prompts."}
    ]
)

print(response.choices[0].message.content)
output
The system prompt sets the assistant's formal tone and behavior, while the user prompt asks the specific question to answer.

User prompt equivalent

Using only a user prompt without a system prompt results in default AI behavior. Here is the same question asked without system instructions:

python
from openai import OpenAI
import os

client = OpenAI(api_key=os.environ["OPENAI_API_KEY"])

response = client.chat.completions.create(
    model="gpt-4o",
    messages=[
        {"role": "user", "content": "Explain the difference between system and user prompts."}
    ]
)

print(response.choices[0].message.content)
output
User prompts are the inputs you give to the AI, while system prompts set the AI's behavior and context.

When to use each

Use system prompts to establish AI personality, tone, or constraints before user interaction. Use user prompts to ask questions, give commands, or provide data during the conversation.

Prompt typeUse caseExample
system promptSet tone and rules"You are a friendly assistant."
user promptAsk questions or commands"Summarize the latest news."

Pricing and access

Both system and user prompts count toward token usage in API calls. They are part of the same message array in chat completions, so pricing is identical.

OptionFreePaidAPI access
OpenAI chat APIYes, limited tokensYes, pay per tokenYes
Anthropic ClaudeYes, limited tokensYes, pay per tokenYes
Google GeminiCheck pricingYes, pay per tokenYes
Open-source modelsYes, fully freeNoNo API

Key Takeaways

  • Use system prompts to control AI behavior and conversation context globally.
  • Use user prompts for specific user inputs and queries during interaction.
  • Both prompt types are required for effective AI conversations and count toward token usage.
Verified 2026-04 · gpt-4o, claude-3-5-sonnet-20241022
Verify ↗