HTTP 與 curl
用任意語言直調 POST /v1/systemone:curl、Python requests、Node fetch 與 Go 範例,附精確的 JSON 請求/回應結構。
端點
每次判定就是對 https://api.easyjev.online/v1/systemone 的一次 POST,帶 Bearer sk- 金鑰。認證標頭:Authorization: Bearer sk-...。JSON 請求體必須含 model、state、questions——未知欄位原樣透傳上游。
四種語言範例
curl -X POST "https://api.easyjev.online/v1/systemone" \ -H "Authorization: Bearer sk-your-key" \ -H "Content-Type: application/json" \ -d '{ "model": "typesafe/jev-latest", "state": "User asks: can I get a refund for order #1024?", "questions": { "refund": {"type": "noul", "instructions": "Is this a refund request?"} } }'
import requests resp = requests.post( "https://api.easyjev.online/v1/systemone", headers={"Authorization": "Bearer sk-your-key"}, json={ "model": "typesafe/jev-latest", "state": "User asks: can I get a refund for order #1024?", "questions": { "refund": {"type": "noul", "instructions": "Is this a refund request?"} }, }, timeout=30, ) resp.raise_for_status() print(resp.json()["answers"]["refund"]["noul"]) # e.g. 0.97
const resp = await fetch("https://api.easyjev.online/v1/systemone", { method: "POST", headers: { Authorization: "Bearer sk-your-key", "Content-Type": "application/json", }, body: JSON.stringify({ model: "typesafe/jev-latest", state: "User asks: can I get a refund for order #1024?", questions: { refund: { type: "noul", instructions: "Is this a refund request?" }, }, }), }); const data = await resp.json(); console.log(data.answers.refund.noul); // e.g. 0.97
package main import ( "bytes" "encoding/json" "fmt" "net/http" ) func main() { payload, _ := json.Marshal(map[string]any{ "model": "typesafe/jev-latest", "state": "User asks: can I get a refund for order #1024?", "questions": map[string]any{ "refund": map[string]any{ "type": "noul", "instructions": "Is this a refund request?", }, }, }) req, _ := http.NewRequest("POST", "https://api.easyjev.online/v1/systemone", bytes.NewReader(payload)) req.Header.Set("Authorization", "Bearer sk-your-key") req.Header.Set("Content-Type", "application/json") resp, err := http.DefaultClient.Do(req) if err != nil { panic(err) } defer resp.Body.Close() var out struct { Answers map[string]struct { Noul float64 `json:"noul"` } `json:"answers"` } json.NewDecoder(resp.Body).Decode(&out) fmt.Println(out.Answers["refund"].Noul) // e.g. 0.97 }
讀取回應
答案按題目 id 彙集在 answers 下,每項回顯題目 type 並附題型專屬欄位(noul 概率、choice 與 probabilities、插值的 score、confidence)。計量資訊在 usage 下。每個欄位的完整說明見完整參考。
{
"model": "typesafe/jev-latest",
"answers": {
"refund": {
"type": "noul",
"noul": 0.97,
"confidence": 0.93
}
},
"usage": {"input_tokens": 1234, "output_tokens": 0}
}