curl --request POST 'https://restapi.scalingtensor.com/api/chat/completion' \
--header 'apiKey: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
"state": {
"ticket": "I was charged twice and would like a refund."
},
"questions": {
"refund_requested": {
"type": "noul",
"instructions": "Does the ticket explicitly request a refund?"
}
},
"model": "typesafe/jev-1.13"
}'
const response = await fetch("https://restapi.scalingtensor.com/api/chat/completion", {
method: "POST",
headers: {
apiKey: process.env.SCALINGTENSOR_API_KEY,
"Content-Type": "application/json",
},
body: JSON.stringify({
"state": {
"ticket": "I was charged twice and would like a refund."
},
"questions": {
"refund_requested": {
"type": "noul",
"instructions": "Does the ticket explicitly request a refund?"
}
},
"model": "typesafe/jev-1.13"
}),
});
const result = await response.json();
if (!response.ok || result.code !== 0) {
throw new Error(result.msg || `Request failed: ${response.status}`);
}
console.log(result.data); // Read content, tokensIn, tokensOut and costMicros
import os
import requests
payload = {
"state": {
"ticket": "I was charged twice and would like a refund.",
},
"questions": {
"refund_requested": {
"type": "noul",
"instructions": "Does the ticket explicitly request a refund?",
},
},
"model": "typesafe/jev-1.13",
}
response = requests.post(
"https://restapi.scalingtensor.com/api/chat/completion",
headers={"apiKey": os.environ["SCALINGTENSOR_API_KEY"]},
json=payload,
timeout=60,
)
result = response.json()
if result["code"] != 0:
raise RuntimeError(result["msg"])
print(result["data"]) # Read content, tokensIn, tokensOut and costMicros