curl --request POST \
--url 'https://api.nsr.stateset.com/v1/chat/completions' \
--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.",
"tool_calls": [],
"tool_call_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"tools": [
{}
],
"tool_choice": "string",
"temperature": 1.5,
"max_tokens": 1,
"response_format": {
"type": "standard",
"json_schema": {
"name": "Two-Person Tent",
"schema": {},
"strict": true
}
},
"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
},
"n": 1,
"include_nsr_metadata": true,
"api_surface": "string"
}'
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"object": "string",
"created": 1,
"model": "string",
"choices": [
{
"index": 1,
"message": {
"role": null,
"content": null,
"tool_calls": null
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"system_fingerprint": "string",
"x_nsr": {}
}
OpenAI-compatible chat completions endpoint backed by the recursive v2
solver. Required scope: write
POST
/
v1
/
chat
/
completions
curl --request POST \
--url 'https://api.nsr.stateset.com/v1/chat/completions' \
--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.",
"tool_calls": [],
"tool_call_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"tools": [
{}
],
"tool_choice": "string",
"temperature": 1.5,
"max_tokens": 1,
"response_format": {
"type": "standard",
"json_schema": {
"name": "Two-Person Tent",
"schema": {},
"strict": true
}
},
"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
},
"n": 1,
"include_nsr_metadata": true,
"api_surface": "string"
}'
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"object": "string",
"created": 1,
"model": "string",
"choices": [
{
"index": 1,
"message": {
"role": null,
"content": null,
"tool_calls": null
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"system_fingerprint": "string",
"x_nsr": {}
}
solver.
Required scope:
write
Request body
object
string
Model identifier. Selects the NSR v2 mode when it matches
nsr-v2-fast, nsr-v2-accurate, or nsr-v2-safe.object[]
required
Conversation messages in OpenAI format.
object[]
Tool/function definitions. Used to filter which
tool_calls are returned.string
Tool selection mode (
auto, none, required) or a specific function as {'type': 'function', 'function': {'name': …}}.number
Sampling temperature. Accepted for compatibility, ignored by NSR v2.
integer
Maximum tokens for the response. Accepted for compatibility.
object
Deterministic structured output contract layered on top of the recursive answer.
string
Optional caller-supplied session identifier forwarded to the recursive solver.
string
Optional explicit root goal for the recursive solver.
string
Optional target hint for the recursive solver.
object[]
Request-scoped facts injected into the recursive working set.
object[]
Request-scoped rules injected into the recursive working set.
object[]
Request-scoped planner overrides for explicit recursive decompositions.
boolean
When false, skip org knowledge-base hydration.
object
Optional per-request hydration limits for the org context.
integer
Optional recursion depth override.
integer
Optional iteration budget override.
number
Optional confidence threshold override.
boolean
When true, emit OpenAI-style SSE chunks.
object
Optional stream controls.
integer
Accepted for compatibility. NSR always returns a single choice.
boolean
When true, include the full recursive v2 payload under
x_nsr.string
Internal surface label forwarded to the recursive solver for metering.
Response
object
string
required
string
required
integer
required
Unix timestamp (seconds).
string
required
object[]
required
string
required
Stable fingerprint of the backend configuration that served this request. Lets clients detect backend changes.
object
Full recursive NSR payload. Present only when
include_nsr_metadata is true.Status codes
| Code | Meaning |
|---|---|
200 | OpenAI-compatible chat completion. With stream: true the body is a text/event-stream of OpenAI-style chunks 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 |
curl --request POST \
--url 'https://api.nsr.stateset.com/v1/chat/completions' \
--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.",
"tool_calls": [],
"tool_call_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
],
"tools": [
{}
],
"tool_choice": "string",
"temperature": 1.5,
"max_tokens": 1,
"response_format": {
"type": "standard",
"json_schema": {
"name": "Two-Person Tent",
"schema": {},
"strict": true
}
},
"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
},
"n": 1,
"include_nsr_metadata": true,
"api_surface": "string"
}'
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"object": "string",
"created": 1,
"model": "string",
"choices": [
{
"index": 1,
"message": {
"role": null,
"content": null,
"tool_calls": null
},
"finish_reason": "string"
}
],
"usage": {
"prompt_tokens": 1,
"completion_tokens": 1,
"total_tokens": 1
},
"system_fingerprint": "string",
"x_nsr": {}
}
Last modified on August 31, 2026