> ## Documentation Index
> Fetch the complete documentation index at: https://docs.anonalabs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# One line, keep your OpenAI SDK

> Point a stock OpenAI client at Anona. Every call recalls what matters and stores what is new. No rewrite.

[← All use cases](/use-cases/overview)

<div className="uc-examples"><a href="https://github.com/anonalabs/Anona-Memory-SDK/blob/main/examples/drop_in_proxy.py">drop\_in\_proxy.py</a></div>

## 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

```python theme={null}
llm = OpenAI(
    api_key=os.environ["ANONA_API_KEY"],          # your Anona key, not an OpenAI key
    base_url="https://api.anonalabs.com/v1",
    default_headers={"X-Anona-Space-Id": "support"},
)
```

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

```python theme={null}
first = llm.chat.completions.create(
    model="balanced",
    messages=[{"role": "user", "content": "My cat is named Miso and she only eats salmon."}],
)
```

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

## Step 3 — A new conversation still knows

```python theme={null}
second = llm.chat.completions.create(
    model="balanced",
    messages=[{"role": "user", "content": "What is my cat's name?"}],
)
```

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](/use-cases/events-not-polling).

`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](/use-cases/prove-memory-helps).
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`](https://github.com/anonalabs/Anona-Memory-SDK/blob/main/examples/drop_in_proxy.py).
