A blank Session ID starts a new chat on every run, which is why a chat model "forgets". Reuse the same session:
On a model page: open Show advanced configurations, fill in Session ID (and User ID), and keep them the same for follow-up messages.
Run API: send the same
session_id(up to 256 bytes, no line breaks) anduser_idon every run. To continue after a tool call, send the earlier task'ssocketaccesstokenaspreviousTaskTokenwith the samesession_id.LLM Gateway: Chat Completions and Anthropic Messages don't store history, so resend earlier messages each time; Cursor, VS Code, Cline and Claude Code do this for you. The Responses API continues with
previous_response_idfrom the same project and model, for a limited time and up to 32 responses in a chain.
The whole conversation must fit the model's context_length in /v1/models. Details: chat sessions, tool calls, Responses and our LLM Gateway guide.
