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

# Nsr responses handler

> **Required scope:** write

**Required scope:** `write`

### Request body

`object`

<ParamField body="model" type="string" />

<ParamField body="input" type="string">
  A text string, a single input item object, or an array of input items.
</ParamField>

<ParamField body="instructions" type="string" />

<ParamField body="tools" type="object[]" />

<ParamField body="tool_choice" type="string">
  Tool selection mode (`auto`, `none`, `required`) or a specific function as `&#123;'type': 'function', 'function': &#123;'name': …&#125;&#125;`.
</ParamField>

<ParamField body="max_output_tokens" type="integer" />

<ParamField body="response_format" type="object" />

<ParamField body="text" type="object">
  OpenAI Responses-style text config; `format` takes the same shape as `response_format`.
</ParamField>

<ParamField body="session_id" type="string" />

<ParamField body="goal" type="string" />

<ParamField body="target" type="string" />

<ParamField body="facts" type="object[]" />

<ParamField body="rules" type="object[]" />

<ParamField body="decompositions" type="object[]" />

<ParamField body="hydrate_org_context" type="boolean" />

<ParamField body="kb_limits" type="object" />

<ParamField body="max_depth" type="integer" />

<ParamField body="max_iterations" type="integer" />

<ParamField body="confidence_threshold" type="number" />

<ParamField body="stream" type="boolean">
  When true, emit an SSE stream instead of a JSON body.
</ParamField>

<ParamField body="stream_options" type="object" />

<ParamField body="previous_response_id" type="string" />

<ParamField body="store" type="boolean" />

<ParamField body="metadata" type="object" />

<ParamField body="include_nsr_metadata" type="boolean">
  When true, include the full recursive payload under `x_nsr`.
</ParamField>

### Response

`object`

<ResponseField name="id" type="string" required />

<ResponseField name="object" type="string" required />

<ResponseField name="created_at" type="integer" required>
  Unix timestamp (seconds).
</ResponseField>

<ResponseField name="status" type="string" required />

<ResponseField name="model" type="string" required />

<ResponseField name="output" type="object[]" required>
  <Expandable title="output">
    <ResponseField name="type" type="string" required />

    <ResponseField name="id" type="string" required />

    <ResponseField name="status" type="string" required />

    <ResponseField name="role" type="string">
      Present on `message` items.
    </ResponseField>

    <ResponseField name="content" type="object[]">
      Present on `message` items.

      <Expandable title="content">
        <ResponseField name="type" type="string" />

        <ResponseField name="text" type="string" />

        <ResponseField name="annotations" type="object[]" />
      </Expandable>
    </ResponseField>

    <ResponseField name="call_id" type="string">
      Present on `function_call` items.
    </ResponseField>

    <ResponseField name="name" type="string">
      Present on `function_call` items.
    </ResponseField>

    <ResponseField name="arguments" type="string">
      JSON-encoded arguments string. Present on `function_call` items.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="output_text" type="string">
  Convenience concatenation of the output text. Omitted when there is none.
</ResponseField>

<ResponseField name="usage" type="object" required>
  <Expandable title="usage">
    <ResponseField name="input_tokens" type="integer" required />

    <ResponseField name="output_tokens" type="integer" required />

    <ResponseField name="total_tokens" type="integer" required />
  </Expandable>
</ResponseField>

<ResponseField name="metadata" type="object">
  Echoed request metadata. Omitted when absent.
</ResponseField>

<ResponseField name="previous_response_id" type="string">
  Omitted when absent.
</ResponseField>

<ResponseField name="x_nsr" type="object">
  Full recursive NSR payload. Present only when `include_nsr_metadata` is true.
</ResponseField>

### Status codes

| Code  | Meaning                                                                                           |
| ----- | ------------------------------------------------------------------------------------------------- |
| `200` | OpenAI-compatible response object. With `stream: true` the body is a `text/event-stream` instead. |
| `401` | Unauthorized — missing or invalid credentials                                                     |
| `403` | Forbidden — the key/token lacks the required scope                                                |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset                                                |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/v1/responses' \
    --header "X-API-Key: $STATESET_NSR_API_KEY" \
    --header 'Content-Type: application/json' \
    --data '{
    "model": "string",
    "input": "string",
    "instructions": "Two-person tent, green — replacement for damaged pole set.",
    "tools": [
      {}
    ],
    "tool_choice": "string",
    "max_output_tokens": 1,
    "response_format": {
      "type": "standard",
      "json_schema": {
        "name": "Two-Person Tent",
        "schema": {},
        "strict": true
      }
    },
    "text": {
      "format": {}
    },
    "session_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "goal": "string",
    "target": "string",
    "facts": [
      {}
    ],
    "rules": [
      {}
    ],
    "decompositions": [
      {}
    ],
    "hydrate_org_context": true,
    "kb_limits": {},
    "max_depth": 1,
    "max_iterations": 8,
    "confidence_threshold": 7.5,
    "stream": true,
    "stream_options": {
      "include_usage": true
    },
    "previous_response_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "store": true,
    "metadata": {},
    "include_nsr_metadata": true
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "object": "string",
    "created_at": 1,
    "status": "pending",
    "model": "string",
    "output": [
      {
        "type": "standard",
        "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "status": "pending",
        "role": "string",
        "content": [],
        "call_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
        "name": "Two-Person Tent",
        "arguments": "string"
      }
    ],
    "output_text": "string",
    "usage": {
      "input_tokens": 1,
      "output_tokens": 1,
      "total_tokens": 1
    },
    "metadata": {},
    "previous_response_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
    "x_nsr": {}
  }
  ```
</ResponseExample>
