System One
curl --request POST \
--url https://api.redpill.ai/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"state": {},
"questions": {},
"provider": {}
}
'import requests
url = "https://api.redpill.ai/v1/systemone"
payload = {
"model": "<string>",
"state": {},
"questions": {},
"provider": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', state: {}, questions: {}, provider: {}})
};
fetch('https://api.redpill.ai/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.redpill.ai/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'state' => [
],
'questions' => [
],
'provider' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.redpill.ai/v1/systemone"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.redpill.ai/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.redpill.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 \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\n}"
response = http.request(request)
puts response.read_body{
"answers": {},
"usage": {}
}Endpoints
System One
Ask a model typed questions about a state and get structured decisions.
POST
/
systemone
System One
curl --request POST \
--url https://api.redpill.ai/v1/systemone \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"model": "<string>",
"state": {},
"questions": {},
"provider": {}
}
'import requests
url = "https://api.redpill.ai/v1/systemone"
payload = {
"model": "<string>",
"state": {},
"questions": {},
"provider": {}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({model: '<string>', state: {}, questions: {}, provider: {}})
};
fetch('https://api.redpill.ai/v1/systemone', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.redpill.ai/v1/systemone",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'model' => '<string>',
'state' => [
],
'questions' => [
],
'provider' => [
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.redpill.ai/v1/systemone"
payload := strings.NewReader("{\n \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\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(string(body))
}HttpResponse<String> response = Unirest.post("https://api.redpill.ai/v1/systemone")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.redpill.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 \"model\": \"<string>\",\n \"state\": {},\n \"questions\": {},\n \"provider\": {}\n}"
response = http.request(request)
puts response.read_body{
"answers": {},
"usage": {}
}System One models answer typed questions about a piece of content instead of generating text. Each
answer is a calibrated probability, a choice among options, or a level on a scale, so software can
act on it directly. The endpoint follows the TypeSafe System One protocol, so the official TypeSafe
SDKs work with RedPill by changing the base URL.
System One models list
Other fields are not forwarded.
The SDKs append
The response carries
decisions in output_modalities in GET /v1/models.
They do not serve chat: a chat completion request to one returns 404 model_not_found. Responses are
never streamed.
POST https://api.redpill.ai/v1/systemone
Request body
string
required
Id of a model whose
output_modalities include decisions, for example jaredpalmer/kev-4b.string | object | array
required
The content the questions are about: a message, a document, or any JSON value.
object
required
Questions keyed by an id you choose. Each answer is returned under the same id. Every question
has a
type and usually instructions that state the question.Show question types
Show question types
object
A yes/no question.
criteria optionally describes what true and false mean.{ "type": "noul", "instructions": "Is this about billing?" }
object
Pick one option.
criteria maps each option to a description, or to null.{
"type": "choice",
"instructions": "What is the tone?",
"criteria": { "calm": null, "upset": null }
}
object
Rate on an ordered scale.
criteria lists the levels from lowest to highest.{
"type": "score",
"instructions": "How urgent is it?",
"criteria": ["low", "medium", "high"]
}
object
The same
provider routing block as chat completions. It is used for routing and is not sent to
the upstream.Example
curl https://api.redpill.ai/v1/systemone \
-H "Authorization: Bearer $REDPILL_AI_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "jaredpalmer/kev-4b",
"state": "I was charged twice this month. Please fix it today.",
"questions": {
"billing": { "type": "noul", "instructions": "Is this about billing?" },
"tone": {
"type": "choice",
"instructions": "What is the tone?",
"criteria": { "calm": null, "upset": null }
},
"urgency": {
"type": "score",
"instructions": "How urgent is it?",
"criteria": ["low", "medium", "high"]
}
}
}'
import os
from typesafe_sdk import Choice, Noul, Score, TypeSafeClient
client = TypeSafeClient(
api_key=os.environ["REDPILL_AI_API_KEY"],
base_url="https://api.redpill.ai",
model="jaredpalmer/kev-4b",
)
result = client.system_one(
state="I was charged twice this month. Please fix it today.",
questions={
"billing": Noul(instructions="Is this about billing?"),
"tone": Choice(instructions="What is the tone?", criteria={"calm": None, "upset": None}),
"urgency": Score(instructions="How urgent is it?", criteria=["low", "medium", "high"]),
},
)
print(result.nouls["billing"].noul, result.choices["tone"].choice, result.scores["urgency"].score)
import { TypeSafeClient, choice, noul, score } from "@typesafe-ai/sdk";
const client = new TypeSafeClient({
baseURL: "https://api.redpill.ai",
apiKey: process.env.REDPILL_AI_API_KEY,
});
const result = await client.systemOne({
model: "jaredpalmer/kev-4b",
state: "I was charged twice this month. Please fix it today.",
questions: {
billing: noul("Is this about billing?"),
tone: choice("What is the tone?", { calm: null, upset: null }),
urgency: score("How urgent is it?", ["low", "medium", "high"]),
},
});
console.log(result.answers.billing.noul, result.answers.tone.choice, result.answers.urgency.score);
/v1/systemone themselves, so set their base URL to https://api.redpill.ai
without /v1. Install them with pip install typesafe-sdk or npm install @typesafe-ai/sdk.
Response
{
"model": "jaredpalmer/kev-4b",
"answers": {
"billing": { "type": "noul", "noul": 0.8828 },
"tone": {
"type": "choice",
"choice": "upset",
"confidence": 0.4882,
"probabilities": { "calm": 0.2559, "upset": 0.7441 }
},
"urgency": {
"type": "score",
"score": 1.4055,
"legend": { "0": "low", "1": "medium", "2": "high" },
"probabilities": { "0": 0.1268, "1": 0.3408, "2": 0.5323 },
"confidence": 0.1083
}
},
"usage": { "input_tokens": 57, "output_tokens": 167, "cost": 0.000002394 }
}
object
One answer per question id, in the same type as the question:
noul:noulis the probability that the answer istrue.choice:choiceis the most likely option, withprobabilitiesper option and a 0 to 1confidence.score:scoreis the probability-weighted level index, withprobabilitiesper level,legendmapping each index to its level, and a 0 to 1confidence.
object
input_tokens, output_tokens, and cost, the charge for this request in USD.x-typesafe-request-id, which the SDKs read, and the gateway’s x-receipt-id
for receipt verification. Errors use the same error format as the other
endpoints.Was this page helpful?