Conversation api with changing system prompt

Im trying to understand how the conversation api handles changes to the developer prompt. In the docs there is a simple example given of adding a new input like:

response = openai.responses.create(
  model="gpt-4.1",
  input=[{"role": "user", "content": "What are the 5 Ds of dodgeball?"}]
  conversation: "conv_689667905b048191b4740501625afd940c7533ace33a2dab"
)

But of course in many applications there is a system prompt which might have variable context that changes over time.

Can you also pass the system prompt repeatedly with the conversation api?

You have a parameter field “instructions” on that responses.create(), a string that you can and must run every call. You can also then change the content of that injected “instructions” (a “developer” message), with the side effect that it can break a cache discount when it changes.

You can add a “developer” message to “conversation” when creating it, with your first input that becomes part of the conversation (upgraded to “system” on non-reasoning models), but if you allow the conversation to grow too large, and allow “truncation”: “auto” so that turns will start being discarded instead of an error at the maximum length, then that first message crucial to “running the application” can be pushed out and lost.

Also working but far from anyone’s favorite: “Prompts” (a type of presets or settings template on the Responses API). When you create a “prompt” ID, which is a bit like an “assistant” was on the Assistants endpoint, only create-able in the playground UI, all the messages that were in the left panel become “instructions” that are run on any future call using that stored settings ID (that also has API parameters).

Don’t keep adding system or developer messages to “input” or to conversations, as they’ll become part of the permanent server-side turn-based record.

Best: completely manage your own conversation list with “store”: false set on the API.

Does that help understanding?

1 Like