퀵스타트
첫 번째 타입이 지정된 의사결정
아래 예제는 계약(contract) 형태를 보여 줍니다. 이 템플릿을 사용하려면 승인된 API 키가 필요합니다. 이메일 링크 또는 Google로 로그인한 뒤 대시보드에서 키를 만들고, 초대 코드를 사용하거나 EUR 1부터 충전하세요.
DECISIONMODELS_API_KEY에 대시보드에서 발급한 키를 설정하세요. 실제 API 키를 소스 관리나 브라우저 번들에 넣지 마세요.
먼저 셸에서 키를 설정하세요. 아래의 모든 curl 예제는 이 값을 읽어 사용합니다.
export DECISIONMODELS_API_KEY="paste-your-key-here"텍스트 번들
하나의 state에 대해 최대 세 가지 질문하기
s1-pro와 reax-1은 같은 questions 맵에 이름을 붙인 텍스트 질문을 최대 세 개까지 받습니다. 공유되는 텍스트는 한 번만 과금되며, 질문을 추가할 때마다 프롬프트 토큰이 더해집니다. 과금 대상 총량은 모델 토크나이저가 결정하며 모델의 입력 한도로 제한됩니다(모델에 따라 state를 포함해 질문당 8,000~8,192 토큰, 한도 표 참고). 각 질문은 별도로 평가되며, 번들로 묶어도 속도 향상은 보장되지 않습니다.
s1-fast, s1-vision, quyet-1-large는 질문을 하나만 받습니다. 처리 용량이 가득 찬 경우 번들 요청은 재시도 가능한 503 model_unavailable 또는 capacity_limit을 반환할 수 있습니다. EU 요청이 우선 처리됩니다. 같은 멱등성 키를 다시 사용하면 추가 과금 없이 최초의 사용량 영수증을 반환하며, 원래의 답변은 보관되지 않습니다.
01 / 요청과 응답
샘플 의사결정을 직접 살펴보기
각 샘플에는 타입이 지정된 질문이 하나씩 들어 있습니다. s1-pro와 reax-1은 최대 세 개, s1-fast, s1-vision, quyet-1-large는 한 개를 지원합니다. 샘플을 선택하면 요청 본문과 응답 형태를 볼 수 있습니다.
{
"model": "s1-fast",
"state": "Mia owns a red bicycle.",
"questions": {
"color": {
"type": "choice",
"instructions": "Which color is the bicycle?",
"criteria": {"red": null, "blue": null}
}
}
}{
"id": "dec_example",
"model": "s1-fast",
"answers": {
"color": { "type": "choice", "choice": "red", "confidence": 0.91,
"probabilities": { "red": 0.91, "blue": 0.09 } }
},
"usage": { "input_tokens": 328, "output_tokens": 0, "decisions": 1 },
"tier": "eu"
}{"model":"s1-fast","state":{"message":"I need to update my invoice address.","account_type":"business"},"questions":{"route":{"type":"choice","instructions":"Choose the support queue that best fits the request.","criteria":{"billing":null,"technical":null,"account":null}}}}{"id":"dec_route","model":"s1-fast","answers":{"route":{"type":"choice","choice":"billing","confidence":0.87,"probabilities":{"billing":0.87,"technical":0.09,"account":0.04}}},"usage":{"input_tokens":351,"output_tokens":0,"decisions":1},"tier":"eu"}{"model":"s1-fast","state":{"action":"delete_workspace","actor_role":"viewer"},"questions":{"allowed":{"type":"noul","instructions":"Is this action allowed under the stated role policy?"}}}{"id":"dec_guard","model":"s1-fast","answers":{"allowed":{"type":"noul","noul":0.04}},"usage":{"input_tokens":298,"output_tokens":0,"decisions":1},"tier":"eu"}{"model":"s1-pro","state":{"draft":"Short release note draft","rubric":"Clarity and factual support"},"questions":{"quality":{"type":"score","instructions":"Rate the draft against the rubric.","criteria":["low","medium","high"]}}}{"id":"dec_score","model":"s1-pro","answers":{"quality":{"type":"score","score":1.57,"confidence":0.71,"legend":{"0":"low","1":"medium","2":"high"},"probabilities":{"0":0.05,"1":0.33,"2":0.62}}},"usage":{"input_tokens":512,"output_tokens":0,"decisions":1},"tier":"eu"}02 / 내 스택에서 호출하기
복사해서 쓸 수 있는 7개 언어 예제
모든 샘플은 동일한 요청을 보냅니다. EU 티어의 s1-fast에 choice 질문 하나를 보내는 요청입니다. 키는 환경 변수에 보관하세요.
curl https://api.decisionmodels.io/v1/systemone \
-H "Authorization: Bearer $DECISIONMODELS_API_KEY" \
-H "Content-Type: application/json" \
-H "S1-Region: eu" \
-d '{ "model": "s1-fast", "state": "Mia owns a red bicycle.", "questions": { "color": { "type": "choice", "instructions": "Which color is the bicycle?", "criteria": {"red": null, "blue": null} } }}'import os
import requests
response = requests.post(
"https://api.decisionmodels.io/v1/systemone",
headers={
"Authorization": f"Bearer {os.environ['DECISIONMODELS_API_KEY']}",
"Content-Type": "application/json",
"S1-Region": "eu",
},
json={
"model": "s1-fast",
"state": "Mia owns a red bicycle.",
"questions": {
"color": {
"type": "choice",
"instructions": "Which color is the bicycle?",
"criteria": {"red": None, "blue": None},
}
},
},
timeout=30,
)
print(response.json())const response = await fetch("https://api.decisionmodels.io/v1/systemone", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DECISIONMODELS_API_KEY,
"Content-Type": "application/json",
"S1-Region": "eu",
},
body: JSON.stringify({
model: "s1-fast",
state: "Mia owns a red bicycle.",
questions: {
color: { type: "choice", instructions: "Which color is the bicycle?",
criteria: { red: null, blue: null } },
},
}),
});
if (!response.ok) throw new Error("HTTP " + response.status);
const result = await response.json();
console.log(result.answers.color);type DecisionAnswer = {
type: "noul" | "choice" | "score";
choice?: string;
noul?: number;
score?: number;
confidence?: number;
legend?: Record<string, string>;
probabilities?: Record<string, number>;
};
type DecisionResponse = {
id: string;
model: string;
answers: Record<string, DecisionAnswer>;
usage: { input_tokens: number; output_tokens: number; decisions: number };
tier: "eu" | "global";
};
const response = await fetch("https://api.decisionmodels.io/v1/systemone", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DECISIONMODELS_API_KEY,
"Content-Type": "application/json",
"S1-Region": "eu",
},
body: JSON.stringify({
model: "s1-fast",
state: "Mia owns a red bicycle.",
questions: {
color: { type: "choice", instructions: "Which color is the bicycle?",
criteria: { red: null, blue: null } },
},
}),
});
if (!response.ok) throw new Error("HTTP " + response.status);
const result = (await response.json()) as DecisionResponse;
console.log(result.answers.color);// cargo add reqwest --features json
// cargo add tokio --features full
// cargo add serde_json
#[tokio::main]
async fn main() -> Result<(), reqwest::Error> {
let client = reqwest::Client::new();
let body = serde_json::json!({
"model": "s1-fast",
"state": "Mia owns a red bicycle.",
"questions": {
"color": { "type": "choice",
"instructions": "Which color is the bicycle?",
"criteria": { "red": null, "blue": null } }
}
});
let response = client
.post("https://api.decisionmodels.io/v1/systemone")
.bearer_auth(std::env::var("DECISIONMODELS_API_KEY").expect("DECISIONMODELS_API_KEY"))
.header("S1-Region", "eu")
.json(&body)
.send().await?;
println!("{}", response.text().await?);
Ok(())
}using System.Net.Http.Json;
var client = new HttpClient();
client.DefaultRequestHeaders.Add("Authorization",
"Bearer " + Environment.GetEnvironmentVariable("DECISIONMODELS_API_KEY"));
client.DefaultRequestHeaders.Add("S1-Region", "eu");
var body = new {
model = "s1-fast",
state = "Mia owns a red bicycle.",
questions = new {
color = new { type = "choice",
instructions = "Which color is the bicycle?",
criteria = new { red = (string?)null, blue = (string?)null } }
}
};
var response = await client.PostAsJsonAsync(
"https://api.decisionmodels.io/v1/systemone", body);
response.EnsureSuccessStatusCode();
Console.WriteLine(await response.Content.ReadAsStringAsync());import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
public class DecisionModelsQuickstart {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String body = """
{"model":"s1-fast","state":"Mia owns a red bicycle.",
"questions":{"color":{"type":"choice",
"instructions":"Which color is the bicycle?",
"criteria":{"red":null,"blue":null}}}}""";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.decisionmodels.io/v1/systemone"))
.header("Authorization", "Bearer " + System.getenv("DECISIONMODELS_API_KEY"))
.header("Content-Type", "application/json")
.header("S1-Region", "eu")
.POST(HttpRequest.BodyPublishers.ofString(body))
.build();
System.out.println(client.send(request,
HttpResponse.BodyHandlers.ofString()).body());
}
}아직 크레딧이 없나요? API는 EUR 1부터 충전할 수 있는 링크와 함께 402 insufficient_credit로 응답합니다.
응답은 계약 형태를 보여 주는 예시이며, 실제로 측정한 모델 출력이 아닙니다. 사용량 영수증에는 실제 입력 토큰 수가 담기며, 과금이 활성화된 경우 정확한 정수 나노(nanos) 청구 금액도 포함됩니다.
03 / 이미지 의사결정
s1-vision으로 이미지 한 장에 대해 결정하기
모델 s1-vision, state, 질문 하나와 함께 PNG, JPEG 또는 WebP 이미지를 정확히 한 장 보내세요. base64 데이터 URL 또는 공개 HTTPS URL을 사용할 수 있으며, 디코딩 후 최대 4 MiB, 2,000,000 픽셀입니다. 이미지는 모델이 실제로 읽는 입력 토큰으로 계산됩니다(보통 약 300~450). 이미지가 포함된 요청은 모든 입력 토큰(텍스트와 이미지 위치)에 s1-vision 이미지 요율이 적용되고, 텍스트만 있는 s1-vision 요청에는 s1-vision 텍스트 요율이 적용됩니다. HTTPS URL은 게이트웨이가 한 번만 가져오며 저장하지 않습니다.
IMG=$(base64 -w0 photo.jpg)
curl https://api.decisionmodels.io/v1/multimodal \
-H "Authorization: Bearer $DECISIONMODELS_API_KEY" \
-H "Content-Type: application/json" \
-H "S1-Region: eu" \
-d '{
"model": "s1-vision",
"state": "Customer return request: item arrived damaged.",
"questions": {
"damage": {
"type": "choice",
"instructions": "What does the photo show?",
"criteria": {"visible_damage": null, "no_damage": null, "not_the_product": null}
}
},
"images": ["data:image/jpeg;base64,'"$IMG"'"]
}'import base64, os, requests
with open("photo.jpg", "rb") as f:
image = "data:image/jpeg;base64," + base64.b64encode(f.read()).decode()
response = requests.post(
"https://api.decisionmodels.io/v1/multimodal",
headers={
"Authorization": f"Bearer {os.environ['DECISIONMODELS_API_KEY']}",
"S1-Region": "eu",
},
json={
"model": "s1-vision",
"state": "Customer return request: item arrived damaged.",
"questions": {
"damage": {
"type": "choice",
"instructions": "What does the photo show?",
"criteria": {"visible_damage": None, "no_damage": None, "not_the_product": None},
}
},
"images": [image],
},
timeout=10,
)
response.raise_for_status()
print(response.json()["answers"]["damage"])import { readFile } from "node:fs/promises";
const image = "data:image/jpeg;base64," + (await readFile("photo.jpg")).toString("base64");
const response = await fetch("https://api.decisionmodels.io/v1/multimodal", {
method: "POST",
headers: {
Authorization: "Bearer " + process.env.DECISIONMODELS_API_KEY,
"Content-Type": "application/json",
"S1-Region": "eu",
},
body: JSON.stringify({
model: "s1-vision",
state: "Customer return request: item arrived damaged.",
questions: {
damage: {
type: "choice",
instructions: "What does the photo show?",
criteria: { visible_damage: null, no_damage: null, not_the_product: null },
},
},
images: [image],
}),
});
if (!response.ok) throw new Error("HTTP " + response.status);
console.log((await response.json()).answers.damage);https://api.system1models.ai도 계속 사용할 수 있습니다.