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

# Responses

> Call OpenAI models through the Responses API with your memory attached

```
POST /openapi/memorylake/router/openai/v1/responses
```

OpenAI Responses. With `boundary_id`, memories from that Boundary are added to the input before the model is called. Without it, the request goes to the model as is.

Set `stream` to `true` to receive server-sent events in the OpenAI format. Parameters not listed below are passed to the model unchanged.

### Query Parameters

<ParamField query="boundary_id" type="string">
  The Boundary whose memory this request uses. Omit it to call the model without memory.
</ParamField>

### Headers

<ParamField header="x-memorylake-api-key" type="string">
  Your MemoryLake API key, when you call the model with your own provider key. The provider key then goes in the provider's usual key header. Your provider key is forwarded to the provider and never stored.
</ParamField>

<ParamField header="traceparent" type="string">
  W3C trace context. When present, the request joins your trace and the same trace id comes back in `X-Trace-ID`.
</ParamField>

### Request Body

<ParamField body="input" type="string | array" required>
  Text, or an array of input items
</ParamField>

<ParamField body="model" type="string" required>
  Model name, as listed under Available Models in the console
</ParamField>

<ParamField body="instructions" type="string">
  System instructions for the model
</ParamField>

<ParamField body="max_output_tokens" type="integer">
  Maximum tokens to generate, reasoning included
</ParamField>

<ParamField body="stream" type="boolean" default="false">
  Stream the response as server-sent events
</ParamField>

<RequestExample>
  ```bash cURL theme={null}
  curl -X POST 'https://app.memorylake.ai/openapi/memorylake/router/openai/v1/responses?boundary_id=bnd-xxxxxx' \
    -H 'Authorization: Bearer sk_xxxxxx' \
    -H 'Content-Type: application/json' \
    -d '{
      "input": "What did I say my favourite city was?",
      "model": "gpt-4o-mini"
    }'
  ```
</RequestExample>

### Response

<ResponseField name="created_at" type="integer">Creation time, Unix seconds</ResponseField>
<ResponseField name="id" type="string">Response id</ResponseField>
<ResponseField name="model" type="string">Model that answered</ResponseField>
<ResponseField name="object" type="string">Always `response`</ResponseField>
<ResponseField name="output" type="array">Output items, such as messages and tool calls</ResponseField>
<ResponseField name="status" type="string">`completed`, `incomplete` or `failed`</ResponseField>

<ResponseField name="usage" type="object">
  Tokens used

  <Expandable title="Usage object">
    <ResponseField name="input_tokens" type="integer">Tokens in the input</ResponseField>
    <ResponseField name="output_tokens" type="integer">Tokens generated</ResponseField>
    <ResponseField name="total_tokens" type="integer">Input and output together</ResponseField>
  </Expandable>
</ResponseField>

<ResponseExample>
  ```json Success (200) theme={null}
  {
    "created_at": 1760000000,
    "id": "resp_abc123",
    "model": "gpt-4o-mini",
    "object": "response",
    "output": [
      {
        "content": [
          {
            "text": "You said your favourite city is Lisbon.",
            "type": "output_text"
          }
        ],
        "role": "assistant",
        "type": "message"
      }
    ],
    "status": "completed",
    "usage": {
      "input_tokens": 412,
      "output_tokens": 11,
      "total_tokens": 423
    }
  }
  ```
</ResponseExample>


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