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

# Anthropic-compatible Messages endpoint backed by the recursive NSR solver.

> **Required scope:** write

**Required scope:** `write`

### Request body

`object`

**model** `string`

Model identifier (e.g. `claude-3-5-sonnet`, or an `nsr-v2-*` alias). Used to select the NSR solver mode.

**messages** `object[]` *required*

Conversation turns.

**system** `string`

Optional top-level system prompt (string or array of text blocks).

**max\_tokens** `integer`

Maximum tokens to generate; honored as a truncation budget on the generated text.

**tools** `object[]`

Tool definitions (Anthropic shape: `&#123;name, description, input_schema&#125;`).

**tool\_choice** `object`

Tool selection: `&#123;'type': 'auto'|'any'|'tool', 'name'?&#125;`.

**stop\_sequences** `string[]`

If the generated text contains one, generation reports `stop_reason = 'stop_sequence'`.

**temperature** `number`

Accepted for compatibility; the solver is deterministic so it does not affect output.

**top\_p** `number`

Accepted for compatibility.

**top\_k** `integer`

Accepted for compatibility.

**stream** `boolean`

When true, emit the Anthropic SSE event stream.

**metadata** `object`

Opaque request metadata (passed through, not interpreted).

**hydrate\_org\_context** `boolean`

When false, skip org knowledge-base hydration.

**kb\_limits** `object`

Optional per-request hydration limits.

**facts** `object[]`

Request-scoped facts injected into the working set.

**rules** `object[]`

Request-scoped rules injected into the working set.

**max\_depth** `integer`

Recursion depth override.

**max\_iterations** `integer`

Iteration budget override.

**confidence\_threshold** `number`

Confidence threshold override.

**include\_nsr\_metadata** `boolean`

When true, attach the full recursive payload under `x_nsr`.

### Response

`object`

**id** `string` *required*

**type** `string` *required*

**role** `string` *required*

**content** `object[]` *required*

**content**

**type** `string` *required*

**text** `string`

Present on `text` blocks.

**id** `string`

Present on `tool_use` blocks.

**name** `string`

Present on `tool_use` blocks.

**input** `object`

Present on `tool_use` blocks.

**model** `string` *required*

**stop\_reason** `string` *required*

**stop\_sequence** `string` *required*

**usage** `object` *required*

**usage**

**input\_tokens** `integer` *required*

**output\_tokens** `integer` *required*

**x\_nsr** `object`

Full recursive NSR payload. Present only when `include_nsr_metadata` is true.

### Status codes

| Code | Meaning |
| - | - |
| `200` | Anthropic-compatible message. With `stream: true` the body is an Anthropic SSE 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 |

```bash cURL theme={null}
curl --request POST \
  --url 'https://api.nsr.stateset.com/v1/messages' \
  --header "X-API-Key: $STATESET_NSR_API_KEY" \
  --header 'Content-Type: application/json' \
  --data '{
  "model": "string",
  "messages": [
    {
      "role": "string",
      "content": "Two-person tent, green — replacement for damaged pole set."
    }
  ],
  "system": "string",
  "max_tokens": 1,
  "tools": [
    {}
  ],
  "tool_choice": {
    "type": "standard",
    "name": "Two-Person Tent"
  },
  "stop_sequences": [
    "string"
  ],
  "temperature": 1.5,
  "top_p": 1.5,
  "top_k": 1,
  "stream": true,
  "metadata": {},
  "hydrate_org_context": true,
  "kb_limits": {},
  "facts": [
    {}
  ],
  "rules": [
    {}
  ],
  "max_depth": 1,
  "max_iterations": 8,
  "confidence_threshold": 7.5,
  "include_nsr_metadata": true
}'
```

```json 200 theme={null}
{
  "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "type": "standard",
  "role": "string",
  "content": [
    {
      "type": "standard",
      "text": "Two-person tent, green — replacement for damaged pole set.",
      "id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
      "name": "Two-Person Tent",
      "input": {}
    }
  ],
  "model": "string",
  "stop_reason": "string",
  "stop_sequence": "string",
  "usage": {
    "input_tokens": 1,
    "output_tokens": 1
  },
  "x_nsr": {}
}
```


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