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

# Perform inference using the NSR Machine

> Processes input sequences through the neural-symbolic reasoning pipeline, combining perception, parsing, and semantic computation to produce outputs…

Processes input sequences through the neural-symbolic reasoning pipeline,
combining perception, parsing, and semantic computation to produce outputs.
**Input Types**

* `text`: Natural language or symbolic commands (e.g., 'walk twice')
* `number`: Numeric values for mathematical operations
* `embedding`: Pre-computed vector embeddings
* `image`: Raw pixel data for visual inputs
* `composite`: Numeric grounded symbol vectors such as emulator UI-node fields
  **Example**

```bash theme={null}
curl -X POST 'https://api.nsr.stateset.com/api/v1/nsr/infer' \
-H 'X-API-Key: your-api-key' \
-H 'Content-Type: application/json' \
-d '&#123;'inputs': [&#123;'type': 'text', 'value': 'walk twice'&#125;]&#125;'
```

Perform inference with the NSR Machine.

**Required scope:** `write`

### Request body

`NSRInferRequest`

<ParamField body="inputs" type="GroundedInputRequest[]" required>
  Input sequence for inference
</ParamField>

<ParamField body="session_id" type="string">
  Optional session ID for context persistence
</ParamField>

### Response

`NSRInferResponse`

<ResponseField name="confidence" type="number (double)" required>
  Confidence score (0.0 to 1.0)
</ResponseField>

<ResponseField name="interpreted_confidence" type="number (double)">
  Confidence for the interpreted output (0.0 to 1.0)
</ResponseField>

<ResponseField name="interpreted_output" type="object">
  <Expandable title="interpreted_output">
    <ResponseField name="type" type="string" required />
  </Expandable>
</ResponseField>

<ResponseField name="interpreted_rationale" type="string">
  Short rationale for how the interpreted output was chosen
</ResponseField>

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

<ResponseField name="processing_time_ms" type="integer (int64)" required>
  Processing time in milliseconds
</ResponseField>

<ResponseField name="symbol_distributions" type="SymbolDistributionResponse[]">
  Symbol distributions for each input

  <Expandable title="SymbolDistributionResponse">
    <ResponseField name="argmax_log_prob" type="number (double)" required>
      Log probability of the argmax
    </ResponseField>

    <ResponseField name="argmax_symbol" type="integer (int64)" required>
      Symbol ID with highest probability
    </ResponseField>

    <ResponseField name="top_k" type="object[][]" required>
      Top-k symbols with their probabilities
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="symbols" type="integer (int64)[]" required>
  Symbol sequence identified
</ResponseField>

### Status codes

| Code  | Meaning                                             |
| ----- | --------------------------------------------------- |
| `200` | Inference successful                                |
| `400` | Invalid request - empty inputs or validation failed |
| `401` | Unauthorized — missing or invalid credentials       |
| `403` | Forbidden — the key/token lacks the required scope  |
| `429` | Rate limited — see Retry-After / X-RateLimit-Reset  |
| `500` | Internal server error - inference engine failure    |
| `504` | Reasoning budget exhausted before completion        |

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url 'https://api.nsr.stateset.com/api/v1/nsr/infer' \
    --header 'X-API-Key: YOUR_API_KEY' \
    --header 'Content-Type: application/json' \
    --data '{
    "inputs": [
      {
        "type": "text",
        "value": "walk twice"
      }
    ],
    "session_id": null
  }'
  ```
</RequestExample>

<ResponseExample>
  ```json 200 theme={null}
  {
    "confidence": 0.95,
    "output": {
      "type": "list",
      "value": [
        {
          "type": "string",
          "value": "WALK"
        },
        {
          "type": "string",
          "value": "WALK"
        }
      ]
    },
    "processing_time_ms": 12,
    "symbol_distributions": null,
    "symbols": [
      1,
      3,
      1
    ]
  }
  ```
</ResponseExample>
