statestring | object | array必須すべての判定の根拠を、文字列、JSON オブジェクト、配列のいずれかで指定します。別の質問の回答は参照できません。動画に関する点検では、メディアファイルの代わりに文字起こし、画面内の文字、フレームの説明を含めてください。
- デフォルト値
- 指定なし
- 制約
- minLength:1
例は、選択中のエンドポイントの公開パラメーター定義から作っています。API キーとサンプル素材を差し替えて、ご自身のサーバーから送信してください。
SDK・連携https://api.spicyapi.ai/api/v1/jobs/createTaskAPI キーはサーバーの環境変数 SPICY_API_KEY に保存します。Bearer 認証を使用し、JSON リクエストには Content-Type: application/json を指定してください。
Authorization: Bearer $SPICY_API_KEY# Generate the idempotency key once; reuse it when retrying after a lost response.
export SPICY_IDEMPOTENCY_KEY="${SPICY_IDEMPOTENCY_KEY:-$(uuidgen)}"
curl -X POST https://api.spicyapi.ai/api/v1/jobs/createTask \
-H "Authorization: Bearer $SPICY_API_KEY" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $SPICY_IDEMPOTENCY_KEY" \
-d '{
"model": "typesafe/jev-1.14/decision",
"input": {
"state": "example",
"questions": {
"example": {
"type": "noul",
"instructions": "The customer asks for a refund after being billed twice."
}
}
}
}'
# Copy data.taskId from the response into TASK_ID, then poll the status.
TASK_ID="TASK_ID_FROM_RESPONSE"
curl "https://api.spicyapi.ai/api/v1/jobs/recordInfo?taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"このモデルの入力スキーマから生成した例です。API はどのリクエストも、同じスキーマで検証します。
これらのフィールドは、リクエスト本文の input オブジェクトに指定します。名前と型は API と一致します。デフォルト値の指定がない項目に、デフォルト値があると想定しないでください。
statestring | object | array必須すべての判定の根拠を、文字列、JSON オブジェクト、配列のいずれかで指定します。別の質問の回答は参照できません。動画に関する点検では、メディアファイルの代わりに文字起こし、画面内の文字、フレームの説明を含めてください。
questionsobject必須最大 64 件の質問に名前を付け、type と instructions を指定します。criteria は choice の選択肢 1〜255 個、または低い順に並べた score の 2〜10 段階に使い、noul には true/false の説明を任意で付けられます。state と各質問は 32k トークン以内、全体は 64k 以内に収めてください。
{
"type": "object",
"required": [
"state",
"questions"
],
"x-pricing": {
"billingMode": "formula",
"variantFields": []
},
"properties": {
"state": {
"type": [
"string",
"object",
"array"
],
"x-ui": {
"order": 10,
"widget": "json",
"primary": true,
"affects_price": false
},
"minLength": 1,
"description": "The content every question refers to: a string, or a JSON object or array such as a transcript, product listing or ticket."
},
"questions": {
"type": "object",
"x-ui": {
"order": 20,
"widget": "json",
"affects_price": false
},
"description": "Questions keyed by names you choose. Each has a type (noul for yes/no, choice for one option, score for an ordered level), instructions, and criteria.",
"maxProperties": 64,
"minProperties": 1,
"additionalProperties": {
"oneOf": [
{
"type": "object",
"required": [
"type",
"instructions"
],
"properties": {
"type": {
"const": "noul"
},
"criteria": {
"type": "object",
"properties": {
"true": {
"type": [
"string",
"object",
"array"
]
},
"false": {
"type": [
"string",
"object",
"array"
]
}
},
"minProperties": 1,
"additionalProperties": false
},
"instructions": {
"type": [
"string",
"object",
"array"
],
"description": "What to decide, as a sentence or a structured object."
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"type",
"instructions",
"criteria"
],
"properties": {
"type": {
"const": "choice"
},
"criteria": {
"type": "object",
"maxProperties": 255,
"minProperties": 1,
"additionalProperties": {
"type": [
"string",
"object",
"array"
]
}
},
"instructions": {
"type": [
"string",
"object",
"array"
],
"description": "What to decide, as a sentence or a structured object."
}
},
"additionalProperties": false
},
{
"type": "object",
"required": [
"type",
"instructions",
"criteria"
],
"properties": {
"type": {
"const": "score"
},
"criteria": {
"type": "array",
"items": {
"type": [
"string",
"object",
"array"
]
},
"maxItems": 10,
"minItems": 2
},
"instructions": {
"type": [
"string",
"object",
"array"
],
"description": "What to decide, as a sentence or a structured object."
}
},
"additionalProperties": false
}
]
}
}
},
"x-input-token-limit": 65536,
"additionalProperties": false
}HTTP 202 はタスクを受け付けたという意味で、生成が終わったという意味ではありません。返ってきた taskId を保存し、そのタスクの状態を問い合わせてください。結果を待っている間に、同じ内容でタスクを作り直さないでください。
HTTP/1.1 202 Accepted
Location: /api/v1/jobs/recordInfo?taskId=job_01k3m8x9q2z4v7n5p6r8s0t1w3
{
"code": 200,
"msg": "success",
"request_id": "req_example_create",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"state": "queued",
"estimatedCost": "0.750000"
}
}受理レスポンスには今回の概算料金が含まれるため、アプリのタスク履歴と請求画面に同じ金額を表示できます。
curl --get "https://api.spicyapi.ai/api/v1/jobs/recordInfo" \
--data-urlencode "taskId=$TASK_ID" \
-H "Authorization: Bearer $SPICY_API_KEY"ポーリングは約 2 秒間隔から始め、徐々に間隔を延ばします。終了状態になったら止めてください。通信が切れたときも、元の taskId で状態を確認します。作成をやり直すときは、同じ冪等キーと同じ本文をそのまま使い回してください。
import { verifyWebhook } from "@spicyapi/sdk";
// express.raw keeps the bytes we signed; express.json never matches.
app.post("/hooks/spicy", express.raw({ type: "application/json" }), (req, res) => {
const { payload } = verifyWebhook({
rawBody: req.body,
timestamp: req.header("X-Webhook-Timestamp"),
signature: req.header("X-Webhook-Signature"),
payloadVersion: Number(req.header("X-Webhook-Payload-Version")),
secret: process.env.SPICY_WEBHOOK_SECRET,
});
res.status(200).end();
void handleFinishedTask(payload);
});タスク作成時に callBackUrl を渡せば、完了したレコードが POST で届きます——ポーリングは一切不要です。配信には毎回 X-Webhook-Timestamp、X-Webhook-Signature、X-Webhook-Payload-Version が付きます。署名は taskId.timestamp.sha256(body) に対する HMAC-SHA256(base64)なので、生のバイト列で検証してください。JSON を解析して再度文字列化するとバイト列が変わり、検証は必ず失敗します。失敗した配信は再送されるため同じ taskId が二度届くことがあります。ハンドラーは冪等に。まず 2xx を返し、処理はその後で——応答が遅いと配信失敗として扱われます。
output を読むのは、state が succeeded のときだけにしてください。失敗したときは errorCode、errorMessage、request_id を手がかりに調べます。例に出ている料金や状態は、実際の請求ではありません。
{
"code": 200,
"msg": "success",
"request_id": "req_example_record",
"data": {
"taskId": "job_01k3m8x9q2z4v7n5p6r8s0t1w3",
"model": "typesafe/jev-1.14/decision",
"state": "succeeded",
"output": {
"decision": {
"answers": {
"example": {
"type": "noul",
"noul": 0.97
}
},
"inputTokens": 128
}
},
"cost": "0.750000",
"settled": true,
"createdAt": "2026-08-28T12:00:00Z",
"completedAt": "2026-08-28T12:00:30Z"
}
}回答は output.decision.answers にあり、送信した質問名をキーにして並びます。各回答には、種類とその値が入ります。たとえば noul は「はい」の確率、choice は選択肢ごとの確率つきの答え、score は小数のスコアと legend です。ファイルは返らないため、ダウンロードするものはありません。inputTokens は入力の大きさで、料金の基準になります。
アプリ、ターミナル、AI アシスタント、ビジュアルワークフローで SpicyAPI を活用。接続ガイドを選んでください。
上のコードを書く必要はありません。MCP サーバーを 1 回接続すれば、MCP に対応するエージェント(Claude Code、Codex、Cursor、Windsurf、VS Code、Gemini CLI、Cline、LibreChat)がこのモデルを名前で実行できます。シェルから 1 つのコマンドで実行することもできます。
Use typesafe/jev-1.14/decision to generate a portrait of a dancer under neon light, and save it to ./out/.
エージェントは公開カタログからモデルを引き、ローカルファイルを代わりにアップロードし、正確な見積もりと上限額を示して確認を待ちます。承認するまで課金は発生しません。
claude mcp add spicyapi -e SPICY_API_KEY=$SPICY_API_KEY \
-- npx --yes --package=@spicyapi/mcp spicyapi-mcp
npx skills add spicyapi-ai/spicy-skill1 行目でツールを、2 行目で Skill を渡します。Skill は使い方の取り決めです——課金の前に見積もりを取り、ローカルファイルはバイト列を貼らずにアップロードし、完成した成果物の URL を推測せずに読む。ほかのクライアントも同じサーバーをそれぞれの設定ファイルから使います。開発者向けページをご覧ください。
npx @spicyapi/cli tasks create --model typesafe/jev-1.14/decision \
--input-json '{"state":"example","questions":{"example":{"type":"noul","instructions":"The customer asks for a refund after being billed twice."}}}' \
--wait入力は上の例と同じ、このエンドポイント固有のスキーマに従います。--wait はタスクの完了までポーリングして結果を表示します。CI では --yes を追加すると確認を省略できます。先に SPICY_API_KEY を設定してください。API、CLI、MCP サーバーで同じキーを使えます。
npx @spicyapi/cli tasks create --model typesafe/jev-1.14/decision \
--input-json '{…}' --retention 1h --wait
npx @spicyapi/cli tasks get $TASK_ID # read back the retention that applied--retention は保持期間を短くするだけです——30m、1h、7d、あるいは 0 なら終了と同時に削除。実際に効くのはリクエスト・アカウント設定・プラットフォーム上限のうち最も短い値なので、指定した数値が通った前提で進めず、タスクレコードから読み戻してください。アカウントの許容より長い値を渡しても何も起きません。
ComfyUI Manager か下のコマンドで SpicyAPI ノードをインストールしたら、キャンバスで Jev 1.14 · Decision を検索してください。このノードにはこのページと同じオプションがあり、実行前に価格が表示されます。
cd ComfyUI/custom_nodes
git clone https://github.com/spicyapi-ai/comfyui-spicyapi埋め込みパネルはこのページと同じスキーマを参照するため、API 仕様とのずれを防げます。ドキュメント内の検索対象にする場合は、/api/embed/models/ の JSON を取得して描画してください。
<iframe src="https://spicyapi.ai/embed/ja/models/jev-1-14/api?model=typesafe%2Fjev-1.14%2Fdecision" width="100%" height="560" loading="lazy" title="リクエスト例" style="border:1px solid rgba(0,0,0,.12)"></iframe>