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

# Responses

> The OpenAI Responses API shape, with the same automatic memory.

`POST /v1/responses` serves the OpenAI Responses API shape over the same memory wrapper
as [Chat](https://docs.memory.anonalabs.com/api-reference/chat.md): relevant memories are recalled and injected before the
model runs, and the turn is stored back afterwards.

```bash cURL theme={null}
curl https://api.anonalabs.com/v1/responses \
  -H "Authorization: Bearer anona_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Anona-Space-Id: support-bot" \
  -d '{
    "model": "gpt-oss",
    "instructions": "Answer in one sentence.",
    "input": "What plan am I on?"
  }'
```

```python Python theme={null}
from openai import OpenAI

client = OpenAI(
    api_key="anona_live_YOUR_KEY",
    base_url="https://api.anonalabs.com/v1",
    default_headers={"X-Anona-Space-Id": "support-bot"},
)

resp = client.responses.create(
    model="gpt-oss",
    instructions="Answer in one sentence.",
    input="What plan am I on?",
)
print(resp.output_text)
```

```typescript TypeScript theme={null}
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: "anona_live_YOUR_KEY",
  baseURL: "https://api.anonalabs.com/v1",
  defaultHeaders: { "X-Anona-Space-Id": "support-bot" },
});

const resp = await client.responses.create({
  model: "gpt-oss",
  instructions: "Answer in one sentence.",
  input: "What plan am I on?",
});
console.log(resp.output_text);
```

## Request

```bash theme={null}
POST https://api.anonalabs.com/v1/responses
Authorization: Bearer anona_live_...
Content-Type: application/json
```

```json theme={null}
{
  "model": "gpt-oss",
  "space_id": "support-bot",
  "instructions": "Answer in one sentence.",
  "input": "What plan am I on?",
  "max_output_tokens": 512
}
```

| Field | Type | Default | Description |
| - | - | - | - |
| `input` | string or array | required | A string, or the array form `[{ "role": ..., "content": ... }]` where `content` is a string or a list of typed parts. |
| `instructions` | string | none | Becomes the system prompt. The memory block is prepended to it. |
| `model` | string | deployment default | Optional. Omit to use whatever model this deployment serves. |
| `stream` | boolean | `false` | Emit the typed Responses event stream. |
| `max_output_tokens` | integer | none | Optional. |
| `temperature` | float | none | Optional. |

All [memory tunables](https://docs.memory.anonalabs.com/api-reference/chat.md#memory-tunables) apply here, in the body or as
`X-Anona-*` headers. Content parts without text (images, tool results) are skipped
when building the memory query.

## Response

```json theme={null}
{
  "id": "resp_...",
  "object": "response",
  "status": "completed",
  "model": "openai.gpt-oss-120b-1:0",
  "output": [
    {
      "id": "msg_...",
      "type": "message",
      "status": "completed",
      "role": "assistant",
      "content": [{ "type": "output_text", "text": "You're on the Scale plan.", "annotations": [] }]
    }
  ],
  "output_text": "You're on the Scale plan.",
  "usage": { "input_tokens": 42, "output_tokens": 9, "total_tokens": 51 },
  "memories_injected": 3,
  "space_id": "support-bot"
}
```

`memories_injected` and `space_id` are the Anona additions, and also arrive as the
`X-Anona-Memories-Injected` and `X-Anona-Space-Id` response headers.

> [!NOTE]
>
> `status` is always `completed` and `incomplete_details` always `null` on this
> endpoint: there is no `finish_reason` here, and a reply cut off at the token limit is
> not distinguishable from one that finished. Use the
> [chat proxy](https://docs.memory.anonalabs.com/api-reference/chat.md#response), whose `finish_reason` reads `length`, if
> your client needs to detect truncation.

## Streaming

`"stream": true` emits the typed Responses event sequence, each event numbered with
`sequence_number`:

```
response.created
response.in_progress
response.output_item.added
response.content_part.added
response.output_text.delta      ← one per token
response.output_text.done
response.content_part.done
response.output_item.done
response.completed
```

```bash cURL theme={null}
curl -N https://api.anonalabs.com/v1/responses \
  -H "Authorization: Bearer anona_live_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "X-Anona-Space-Id: support-bot" \
  -d '{"model": "gpt-oss", "input": "What plan am I on?", "stream": true}'
```

```python Python theme={null}
with client.responses.stream(
    model="gpt-oss",
    input="What plan am I on?",
) as stream:
    for event in stream:
        if event.type == "response.output_text.delta":
            print(event.delta, end="")
```

```typescript TypeScript theme={null}
const stream = await client.responses.create({
  model: "gpt-oss",
  input: "What plan am I on?",
  stream: true,
});
for await (const event of stream) {
  if (event.type === "response.output_text.delta") process.stdout.write(event.delta);
}
```

The final `response.completed` event carries the full response object, including token
usage. As on Chat, a failure before the first token is a normal JSON error with a real
status code; the turn is recorded and billed after the stream ends.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.