> ## 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 as a Model Provider

> Point Claude Code, Codex, OpenCode, or any OpenAI/Anthropic SDK at NSR — every completion runs through the neuro-symbolic pipeline instead of a bare LLM.

# NSR as a Model Provider

The NSR server speaks three wire protocols besides its native
[`/v1/decisions`](/stateset-nsr-decisions) surface, so existing tools can point at it
**unchanged**. Every completion then runs through the neuro-symbolic pipeline — GSS grounding,
policy rules, safety gates, refuse-by-default — instead of a bare LLM.

| Protocol                | Endpoint                                               | Works with                                    |
| ----------------------- | ------------------------------------------------------ | --------------------------------------------- |
| Anthropic Messages      | `POST /v1/messages` (plus `/v1/messages/count_tokens`) | Claude Code, Anthropic SDKs                   |
| OpenAI Chat Completions | `POST /v1/chat/completions`                            | Codex, OpenCode, OpenAI SDKs, LangChain, …    |
| OpenAI Responses        | `POST /v1/responses` (plus `GET /v1/responses/{id}`)   | Codex (responses wire), Responses-API clients |

All three support **streaming (SSE)**, **tools**, and both auth styles — `x-api-key: <key>` or
`Authorization: Bearer <key>`.

## The model

The model is **`nazarae-1`**, with three mode variants:

| Model id                           | Mode                                    |
| ---------------------------------- | --------------------------------------- |
| `nazarae-1-safe`                   | Highest verification, refuse-by-default |
| `nazarae-1` / `nazarae-1-accurate` | The default                             |
| `nazarae-1-fast`                   | Fastest                                 |

Legacy `nsr-v2-*` ids remain served as aliases for existing configs.

`GET /v1/models` lists the aliases. **Unknown model names are accepted** and mapped by
heuristic — `*safe*` → safe, `*fast*` or `*mini*` → fast, anything else → accurate — so a config
naming another vendor's model still works.

<Note>
  Set `BASE` to your deployment (e.g. `https://api.stateset.ai`, or `http://127.0.0.1:8080`
  locally) and `MODEL_API_KEY` to your NSR API key in the examples below.
</Note>

## Claude Code

```bash theme={null}
export ANTHROPIC_BASE_URL="$BASE"
export ANTHROPIC_AUTH_TOKEN="$MODEL_API_KEY"
export ANTHROPIC_MODEL="nazarae-1-safe"
export ANTHROPIC_DEFAULT_OPUS_MODEL="nazarae-1-safe"
export ANTHROPIC_DEFAULT_SONNET_MODEL="nazarae-1-accurate"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="nazarae-1-fast"
export CLAUDE_CODE_SUBAGENT_MODEL="nazarae-1-accurate"
claude
```

Claude Code streams from `/v1/messages` and preflights token counts via
`/v1/messages/count_tokens`; both are served.

<Tip>
  The Messages surface also accepts **NSR extensions** — `facts`, `rules`, and
  `hydrate_org_context` — in the request body, so a turn can be policy-grounded without leaving
  the Anthropic wire format.
</Tip>

## Codex

`~/.codex/config.toml`:

```toml theme={null}
model = "nazarae-1-safe"
model_provider = "stateset-nsr"

[model_providers.stateset-nsr]
name = "StateSet NSR (verified decisions)"
base_url = "https://api.stateset.ai/v1"
env_key = "MODEL_API_KEY"
wire_api = "responses"
```

<Warning>
  `wire_api = "responses"` is **required** — recent Codex versions dropped `wire_api = "chat"`.
  The chat wire is still served for other OpenAI-compatible clients.
</Warning>

## OpenCode

```bash theme={null}
/bin/bash -c "$(curl -fsSL https://nsr.stateset.com/cli/install-opencode.sh)"
```

## Any OpenAI or Anthropic SDK

Point the SDK's `base_url` at your NSR deployment and use any NSR API key. Errors come back in
each provider's native error envelope, so existing error handling keeps working.

## What changes

The wire format is identical, but the behavior is not. Because every completion goes through
the neuro-symbolic pipeline, the model will **refuse** rather than guess when it cannot ground
an answer. Expect refusals where a bare LLM would have produced confident text — that is the
intended behavior, not a failure.

## Related

* [Verified Decisions API](/stateset-nsr-decisions) — the native surface
* [Neuro-Symbolic Architecture](/stateset-nsr)
