---
title: "System prompt"
type: "glossary term"
url: "https://aifordevs.org/glossary#system-prompt"
markdown: "https://aifordevs.org/glossary/system-prompt.md"
publisher: "AI for Devs"
license: "https://aifordevs.org/reuse"
attribution: "Credit AI for Devs and link to https://aifordevs.org/glossary#system-prompt"
---

# System prompt

A system prompt is a set of instructions placed before the conversation that sets the model's role, rules, and output format for every turn. Keeping it stable makes it a good candidate for prompt caching.

APIs name it differently: Anthropic uses a top-level system parameter, and OpenAI's Responses API uses instructions or developer messages, which take priority over user messages. Keep secrets and permission checks out of it, and enforce those in the code that runs tools.

## Example

Put a 5,000-token system prompt first and the user's question last. A timestamp at the top of the prompt changes the prefix on every request and prevents a cache hit.

## Source

[OpenAI docs: Text generation](https://developers.openai.com/api/docs/guides/text)

## Related terms

- [Context engineering](https://aifordevs.org/glossary#context-engineering)
- [Prompt caching](https://aifordevs.org/glossary#prompt-caching)

## Read the article

[Context engineering: budget and order the context window](https://aifordevs.org/articles/context-engineering)

## Cite this term

AI for Devs. "System prompt." https://aifordevs.org/glossary#system-prompt

- Page: https://aifordevs.org/glossary#system-prompt
- Markdown: https://aifordevs.org/glossary/system-prompt.md
- Reuse: Quote or summarize with a link to this page. Terms: https://aifordevs.org/reuse
- Publisher: AI for Devs
