API
Session Affinity
Send conversation history and keep related turns in one logical session.
Send the history you need
The chat completions endpoint is stateless from the caller's point of view. Include the relevant earlier messages on each turn. Remove old messages or summarize them before the request exceeds the model's context window.
Add a session ID
Send a stable X-Session-Id for every turn in the same conversation. This improves continuity and can improve cache reuse. Use a different value for each conversation.
-H "X-Session-Id: 1c777887-8f89-4c24-934f-d21eeaaf5390"
Use an opaque UUID. Keep it at 256 characters or fewer. Do not put an email address, customer name, prompt text, API key, or other sensitive data in this header.
A session ID does not store the conversation for you. Your application remains responsible for message history, access control, retention, and deletion.
