> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.milliseconds.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.milliseconds.ai/_mcp/server.

# TypeSafe-compatible typed questions

POST https://api.milliseconds.ai/v1/systemone
Content-Type: application/json

Drop-in for TypeSafe's `POST /v1/systemone` with `model: "decision-machine-1"`. One `state` (string, object or array), a map of named questions of type `noul`, `choice` or `score`, and one typed answer per question with the model's own probabilities. Each question runs as the matching capability (yes-no, classify, rate) on the same text and counts as one request against the rate limit. No image input on this route.

Reference: https://docs.milliseconds.ai/api/typesafe/system-one

## Authentication

- `Authorization` header (bearer token, required) — A milliseconds API key, test\_sk-\{namespace}-\{entropy} or prod\_sk-\{namespace}-\{entropy}. Every /v1 route requires it.

## Request

### Body (application/json)

This endpoint expects a SystemOneRequest.

- `state` (JsonContent, required) — A string, or an object or array rendered to text.
- `questions` (map from string to SystemOneQuestion, required)
- `model` (string, optional)

## Response

### 200

One answer per question

- `model` (string, required)
- `answers` (map from string to SystemOneResponseAnswers, required)
- `usage` (SystemOneResponseUsage, required)

## Errors

### 400 Bad Request Error

Invalid request

- `error` (ErrorError, required)

### 404 Not Found Error

Unknown model

- `error` (ErrorError, required)

## Types

### JsonContent

A string, or an object or array rendered to text.

- string
- double
- boolean
- map from string to any
- list of any

### SystemOneQuestion

- SystemOneQuestion0
- SystemOneQuestion1
- SystemOneQuestion2

### SystemOneResponseAnswers

- SystemOneResponseAnswers0
- SystemOneResponseAnswers1
- SystemOneResponseAnswers2

### SystemOneResponseUsage

- `input_tokens` (integer, required)
- `output_tokens` (integer, required)

### ErrorError

- `code` (string, required)
- `message` (string, required)

### SystemOneQuestion0

- `type` ("noul", required)
- `instructions` (JsonContent, required) — A string, or an object or array rendered to text.
- `criteria` (SystemOneQuestionOneOf0Criteria, optional) — What makes the answer true or false.

### SystemOneQuestion1

- `type` ("choice", required)
- `instructions` (JsonContent, required) — A string, or an object or array rendered to text.
- `criteria` (map from string to JsonContent, required) — Option name -> description (null for none).

### SystemOneQuestion2

- `type` ("score", required)
- `instructions` (JsonContent, required) — A string, or an object or array rendered to text.
- `criteria` (list of JsonContent, required) — Level descriptions, low to high.

### SystemOneResponseAnswers0

- `type` ("noul", required)
- `noul` (double, required)

### SystemOneResponseAnswers1

- `type` ("choice", required)
- `choice` (string, required)
- `probabilities` (map from string to double, required)
- `confidence` (double, required)

### SystemOneResponseAnswers2

- `type` ("score", required)
- `score` (double, required)
- `legend` (map from string to JsonContent, required)
- `probabilities` (map from string to double, required)
- `confidence` (double, required)

### SystemOneQuestionOneOf0Criteria

What makes the answer true or false.

- `true` (JsonContent, optional) — A string, or an object or array rendered to text.
- `false` (JsonContent, optional) — A string, or an object or array rendered to text.

## Examples

**Request**

```json
{
  "state": "Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?",
  "questions": {
    "department": {
      "criteria": {
        "billing": "Charges, invoices, payment problems",
        "returns": "Exchanges, refunds, wrong or damaged items",
        "shipping": "Delivery status, delays, lost packages"
      },
      "instructions": "Which team should handle this?",
      "type": "choice"
    },
    "double_charge": {
      "criteria": {
        "false": "No duplicate charge is mentioned",
        "true": "The customer says they were charged more than once"
      },
      "instructions": "Does the customer report a duplicate charge?",
      "type": "noul"
    },
    "urgency": {
      "criteria": [
        "can wait",
        "this week",
        "today"
      ],
      "instructions": "How urgent is this ticket?",
      "type": "score"
    }
  },
  "model": "decision-machine-1"
}
```

**Response**

```json
{
  "model": "decision-machine-1",
  "answers": {
    "department": {
      "choice": "billing",
      "confidence": 0.438,
      "probabilities": {
        "billing": 0.625,
        "returns": 0.242,
        "shipping": 0.133
      },
      "type": "choice"
    },
    "double_charge": {
      "noul": 0.592,
      "type": "noul"
    },
    "urgency": {
      "confidence": 0.658,
      "legend": {
        "0": "can wait",
        "1": "this week",
        "2": "today"
      },
      "probabilities": {
        "0": 0.602,
        "1": 0.112,
        "2": 0.286
      },
      "score": 0.684,
      "type": "score"
    }
  },
  "usage": {
    "input_tokens": 394,
    "output_tokens": 0
  }
}
```

**SDK Code**

```python typesafe_systemOne_example
import requests

url = "https://api.milliseconds.ai/v1/systemone"

payload = {
    "state": "Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?",
    "questions": {
        "department": {
            "criteria": {
                "billing": "Charges, invoices, payment problems",
                "returns": "Exchanges, refunds, wrong or damaged items",
                "shipping": "Delivery status, delays, lost packages"
            },
            "instructions": "Which team should handle this?",
            "type": "choice"
        },
        "double_charge": {
            "criteria": {
                "false": "No duplicate charge is mentioned",
                "true": "The customer says they were charged more than once"
            },
            "instructions": "Does the customer report a duplicate charge?",
            "type": "noul"
        },
        "urgency": {
            "criteria": ["can wait", "this week", "today"],
            "instructions": "How urgent is this ticket?",
            "type": "score"
        }
    },
    "model": "decision-machine-1"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript typesafe_systemOne_example
const url = 'https://api.milliseconds.ai/v1/systemone';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"state":"Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?","questions":{"department":{"criteria":{"billing":"Charges, invoices, payment problems","returns":"Exchanges, refunds, wrong or damaged items","shipping":"Delivery status, delays, lost packages"},"instructions":"Which team should handle this?","type":"choice"},"double_charge":{"criteria":{"false":"No duplicate charge is mentioned","true":"The customer says they were charged more than once"},"instructions":"Does the customer report a duplicate charge?","type":"noul"},"urgency":{"criteria":["can wait","this week","today"],"instructions":"How urgent is this ticket?","type":"score"}},"model":"decision-machine-1"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go typesafe_systemOne_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.milliseconds.ai/v1/systemone"

	payload := strings.NewReader("{\n  \"state\": \"Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?\",\n  \"questions\": {\n    \"department\": {\n      \"criteria\": {\n        \"billing\": \"Charges, invoices, payment problems\",\n        \"returns\": \"Exchanges, refunds, wrong or damaged items\",\n        \"shipping\": \"Delivery status, delays, lost packages\"\n      },\n      \"instructions\": \"Which team should handle this?\",\n      \"type\": \"choice\"\n    },\n    \"double_charge\": {\n      \"criteria\": {\n        \"false\": \"No duplicate charge is mentioned\",\n        \"true\": \"The customer says they were charged more than once\"\n      },\n      \"instructions\": \"Does the customer report a duplicate charge?\",\n      \"type\": \"noul\"\n    },\n    \"urgency\": {\n      \"criteria\": [\n        \"can wait\",\n        \"this week\",\n        \"today\"\n      ],\n      \"instructions\": \"How urgent is this ticket?\",\n      \"type\": \"score\"\n    }\n  },\n  \"model\": \"decision-machine-1\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby typesafe_systemOne_example
require 'uri'
require 'net/http'

url = URI("https://api.milliseconds.ai/v1/systemone")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"state\": \"Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?\",\n  \"questions\": {\n    \"department\": {\n      \"criteria\": {\n        \"billing\": \"Charges, invoices, payment problems\",\n        \"returns\": \"Exchanges, refunds, wrong or damaged items\",\n        \"shipping\": \"Delivery status, delays, lost packages\"\n      },\n      \"instructions\": \"Which team should handle this?\",\n      \"type\": \"choice\"\n    },\n    \"double_charge\": {\n      \"criteria\": {\n        \"false\": \"No duplicate charge is mentioned\",\n        \"true\": \"The customer says they were charged more than once\"\n      },\n      \"instructions\": \"Does the customer report a duplicate charge?\",\n      \"type\": \"noul\"\n    },\n    \"urgency\": {\n      \"criteria\": [\n        \"can wait\",\n        \"this week\",\n        \"today\"\n      ],\n      \"instructions\": \"How urgent is this ticket?\",\n      \"type\": \"score\"\n    }\n  },\n  \"model\": \"decision-machine-1\"\n}"

response = http.request(request)
puts response.read_body
```

```java typesafe_systemOne_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.milliseconds.ai/v1/systemone")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"state\": \"Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?\",\n  \"questions\": {\n    \"department\": {\n      \"criteria\": {\n        \"billing\": \"Charges, invoices, payment problems\",\n        \"returns\": \"Exchanges, refunds, wrong or damaged items\",\n        \"shipping\": \"Delivery status, delays, lost packages\"\n      },\n      \"instructions\": \"Which team should handle this?\",\n      \"type\": \"choice\"\n    },\n    \"double_charge\": {\n      \"criteria\": {\n        \"false\": \"No duplicate charge is mentioned\",\n        \"true\": \"The customer says they were charged more than once\"\n      },\n      \"instructions\": \"Does the customer report a duplicate charge?\",\n      \"type\": \"noul\"\n    },\n    \"urgency\": {\n      \"criteria\": [\n        \"can wait\",\n        \"this week\",\n        \"today\"\n      ],\n      \"instructions\": \"How urgent is this ticket?\",\n      \"type\": \"score\"\n    }\n  },\n  \"model\": \"decision-machine-1\"\n}")
  .asString();
```

```php typesafe_systemOne_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.milliseconds.ai/v1/systemone', [
  'body' => '{
  "state": "Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?",
  "questions": {
    "department": {
      "criteria": {
        "billing": "Charges, invoices, payment problems",
        "returns": "Exchanges, refunds, wrong or damaged items",
        "shipping": "Delivery status, delays, lost packages"
      },
      "instructions": "Which team should handle this?",
      "type": "choice"
    },
    "double_charge": {
      "criteria": {
        "false": "No duplicate charge is mentioned",
        "true": "The customer says they were charged more than once"
      },
      "instructions": "Does the customer report a duplicate charge?",
      "type": "noul"
    },
    "urgency": {
      "criteria": [
        "can wait",
        "this week",
        "today"
      ],
      "instructions": "How urgent is this ticket?",
      "type": "score"
    }
  },
  "model": "decision-machine-1"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp typesafe_systemOne_example
using RestSharp;

var client = new RestClient("https://api.milliseconds.ai/v1/systemone");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"state\": \"Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?\",\n  \"questions\": {\n    \"department\": {\n      \"criteria\": {\n        \"billing\": \"Charges, invoices, payment problems\",\n        \"returns\": \"Exchanges, refunds, wrong or damaged items\",\n        \"shipping\": \"Delivery status, delays, lost packages\"\n      },\n      \"instructions\": \"Which team should handle this?\",\n      \"type\": \"choice\"\n    },\n    \"double_charge\": {\n      \"criteria\": {\n        \"false\": \"No duplicate charge is mentioned\",\n        \"true\": \"The customer says they were charged more than once\"\n      },\n      \"instructions\": \"Does the customer report a duplicate charge?\",\n      \"type\": \"noul\"\n    },\n    \"urgency\": {\n      \"criteria\": [\n        \"can wait\",\n        \"this week\",\n        \"today\"\n      ],\n      \"instructions\": \"How urgent is this ticket?\",\n      \"type\": \"score\"\n    }\n  },\n  \"model\": \"decision-machine-1\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift typesafe_systemOne_example
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "state": "Shoes arrived two weeks late and in the wrong size. Also I see two charges on my card. What are you going to do about this?",
  "questions": [
    "department": [
      "criteria": [
        "billing": "Charges, invoices, payment problems",
        "returns": "Exchanges, refunds, wrong or damaged items",
        "shipping": "Delivery status, delays, lost packages"
      ],
      "instructions": "Which team should handle this?",
      "type": "choice"
    ],
    "double_charge": [
      "criteria": [
        "false": "No duplicate charge is mentioned",
        "true": "The customer says they were charged more than once"
      ],
      "instructions": "Does the customer report a duplicate charge?",
      "type": "noul"
    ],
    "urgency": [
      "criteria": ["can wait", "this week", "today"],
      "instructions": "How urgent is this ticket?",
      "type": "score"
    ]
  ],
  "model": "decision-machine-1"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.milliseconds.ai/v1/systemone")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```