Skip to main content
← All use cases

The scenario

You already have working code against the OpenAI SDK. You want memory, and you do not want to restructure the app, learn a retrieval API, or hand-assemble a prompt. Change the base URL.

Step 1 — Repoint the client

The header is set once and applies to every call, which is the point — a stock SDK has default_headers and no other hook.

Step 2 — Use it exactly as before

The turn is recalled into the prompt and recorded back, in the background of the call.

Step 3 — A new conversation still knows

A brand-new message list, no history passed, and the answer is right. That is the whole product in two calls.

Step 4 — Tune per call, or per space

Every option has a header, so a stock SDK can set it: X-Anona-User-Id, X-Anona-Memory-Limit, X-Anona-Memory (off), X-Anona-Auto-Record, X-Anona-Block-Order. Set them once on the space instead with chat settings. X-Anona-User-Id per end user turns a single-tenant app multi-tenant with no call-site change at all.

Evals

  1. Run two conversations as above. The second must answer from the first.
  2. Set X-Anona-Memory: false and confirm it does not — that comparison is your A/B.
  3. Set X-Anona-User-Id to two different values and confirm they do not share.

Guardrails

  • Extraction is not instant. A question asked immediately after the fact was mentioned may miss it; the example sleeps for this reason.
  • model is ours, not OpenAI’s. Use a tier alias like balanced or an id from GET /v1/models. An unknown name is a 400, not a silent fallback.
  • Anthropic and Responses shapes work too, on /v1/messages and /v1/responses, with the same headers. x-api-key is accepted anywhere Authorization is, because the Anthropic SDK never sets the latter.

The script

Complete and runnable: drop_in_proxy.py.