Responses API
ใหม่POST /v1/responses รับ instructions และรายการ input item แล้วคืนออบเจ็กต์ response ที่ประกอบด้วย output item ในรูปแบบ OpenAI Responses ใช้กับ responses API ของ OpenAI SDK และเครื่องมือที่สร้างบนนั้น เช่น Codex CLI endpoint นี้ไม่เก็บสถานะ: ส่งบทสนทนาทั้งหมดไปกับทุกคำขอ
POST https://api.shannon-ai.com/v1/responses
คำขอที่เล็กที่สุดคือ model id และข้อความ คำตอบจะไม่สตรีมเว้นแต่คุณขอ
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
response = client.responses.create(
model="shannon-3",
input="Say hello in one sentence.",
)
print(response.output_text) import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const response = await client.responses.create({
model: "shannon-3",
input: "Say hello in one sentence.",
});
console.log(response.output_text); curl https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "shannon-3",
"input": "Say hello in one sentence."
}' คำตอบคือออบเจ็กต์ response ใน output มีการให้เหตุผล เมื่อโมเดลให้เหตุผล และ message:
{
"id": "resp_5f0c1e7a9b3d4c62a8e1f07d2b46c9a3",
"object": "response",
"created_at": 1791625200,
"model": "shannon-3",
"status": "completed",
"error": null,
"incomplete_details": null,
"instructions": null,
"metadata": {},
"parallel_tool_calls": true,
"temperature": null,
"tool_choice": "auto",
"tools": [],
"top_p": null,
"output": [
{
"id": "rs_8a2e6c1f4b7d4e03b9c5a1d70f3e2b64",
"type": "reasoning",
"summary": [
{
"type": "summary_text",
"text": "The user wants a greeting in one sentence. Keep it short and friendly."
}
]
},
{
"id": "msg_1c7b9e3a5d2f4a86b0e4c8d19a6f7e25",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "Hello, it is good to meet you.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 1184,
"output_tokens": 46,
"total_tokens": 1230
}
} ฟิลด์ของคำขอ
model และ input คือสิ่งที่คำขอต้องมี คอลัมน์ มีผลกับ ระบุโมเดลที่ฟิลด์เปลี่ยนคำตอบได้ โมเดล open-weight ที่โฮสต์คือสิบสอง id ในรายการโมเดล ตระกูล Shannon 3 คือ shannon-3, shannon-3-pro, shannon-3.1 และ shannon-3.1-pro โมเดลและราคา
| ฟิลด์ | ประเภท | ค่าเริ่มต้น | คำอธิบาย | มีผลกับ |
|---|---|---|---|---|
model | string | จำเป็น id จากรายการโมเดล การจับคู่ไม่สนใจตัวพิมพ์ใหญ่เล็ก id ที่ไม่มีหรือไม่ได้เผยแพร่จะคืน 400 unknown model | ทุกโมเดล | |
input | string | array | สตริง ซึ่งอ่านเป็นข้อความผู้ใช้หนึ่งข้อความ หรืออาร์เรย์ของ input item ดูรายการอินพุตด้านล่าง | ทุกโมเดล | |
instructions | string | คำสั่งสำหรับโมเดล คือ system prompt ของรูปแบบนี้ | โมเดล open-weight ที่โฮสต์, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true ส่งคำตอบเป็น server-sent events ดูการสตรีมด้านล่าง | ทุกโมเดล |
max_output_tokens | integer | 4096 | ขีดจำกัดบนของคำตอบ เป็น tokens ค่านอกช่วง 1 ถึง 65,536 จะถูกปรับให้อยู่ในช่วงนั้น และยังเป็นจำนวนที่กันไว้จากยอดคงเหลือของคุณขณะคำขอทำงาน ดูขีดจำกัดเอาต์พุตด้านล่าง | โมเดล open-weight ที่โฮสต์, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | temperature ของการสุ่ม บนโมเดล open-weight ที่โฮสต์ ค่าจะถูกจำกัดให้อยู่ระหว่าง 0 ถึง 2 | โมเดล open-weight ที่โฮสต์; shannon-1.6-*, shannon-2-* และ shannon-coder-1 ในคำตอบที่ไม่ใช่สตรีม | |
top_p | number | Nucleus sampling ค่าจะถูกจำกัดให้อยู่ระหว่าง 0 ถึง 1 | โมเดล open-weight ที่โฮสต์ | |
tools | array | ฟังก์ชันที่โมเดลเรียกได้ ในรูปแบบแบนของรูปแบบนี้: {"type": "function", "name", "description", "parameters"} ดู Tools ด้านล่าง | ทุกโมเดล | |
tool_choice | string | object | auto | "auto" ให้โมเดลตัดสินใจเอง "required" ให้เรียก tool {"type": "function", "name": "…"} ให้เรียก tool นั้น | โมเดล open-weight ที่โฮสต์ |
reasoning | object | {"effort": "…"} โดยค่าเป็น off, low, medium หรือ high ค่าอื่นจะคืน 400 | โมเดล open-weight ที่โฮสต์ | |
text | object | {"format": {…}} ขอคำตอบเป็น JSON ดูเอาต์พุตแบบมีโครงสร้างด้านล่าง | ทุกระดับของ Shannon; โมเดล open-weight ที่โฮสต์ตามที่ระบุไว้แต่ละ id |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user และ prompt_cache_key ได้รับการยอมรับเพื่อให้โค้ดไคลเอนต์เดิมทำงานได้โดยไม่ต้องแก้ ฟิลด์เหล่านี้ไม่เปลี่ยนคำตอบ เนื่องจากไม่มีการเก็บบทสนทนา คำขอถัดไปจึงต้องส่งรอบก่อนหน้าไปใน input
รายการอินพุต
input item เป็นได้ทั้งข้อความที่มี role และ content หรือรายการที่ระบุชนิดซึ่งเก็บการเรียก tool หรือผลลัพธ์ content เป็นสตริงหรืออาร์เรย์ของส่วนต่างๆ
| รายการ | คำอธิบาย | มีผลกับ |
|---|---|---|
{"role": "user", "content": …} | สิ่งที่คุณถาม content เป็นสตริง หรือส่วน input_text และ input_image | ทุกโมเดล |
{"role": "assistant", "content": …} | คำตอบก่อนหน้าของโมเดล content เป็นสตริง หรือส่วน output_text | ทุกโมเดล |
{"role": "system", "content": …}{"role": "developer", "content": …} | คำสั่งภายในบทสนทนา | โมเดล open-weight ที่โฮสต์ |
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} | การเรียก tool ที่โมเดลทำในคำตอบก่อนหน้า arguments เป็น JSON string | ทุกโมเดล |
{"type": "function_call_output", "call_id": "…", "output": "…"} | ผลลัพธ์ของการเรียกนั้น call_id คือ id ของการเรียก และ output คือผลลัพธ์เป็นสตริง | ทุกโมเดล |
ใส่คำสั่งในฟิลด์ instructions เมื่อใช้ id ของตระกูล Shannon 3 ให้ใส่คำสั่งที่ต้องปฏิบัติตามไว้ในข้อความ user
รายการใน output ของคำตอบส่งกลับเข้า input ได้ตามเดิม: รายการ message และ function_call จะถูกอ่าน ส่วนรายการ reasoning จะถูกข้าม
ส่วนของเนื้อหา (content parts)
| ส่วน | คำอธิบาย | ใช้ได้บน |
|---|---|---|
{"type": "input_text", "text": "…"} | ข้อความของ user message | ทุกโมเดล |
{"type": "output_text", "text": "…"} | ข้อความของ assistant message | ทุกโมเดล |
{"type": "input_image", "image_url": "…"} | รูปภาพ เป็น data: URL ที่มีเนื้อหา base64 หรือ URL แบบ http(s) | ตระกูล Shannon 3, shannon-1.6-lite, shannon-1.6-pro และโมเดล open-weight ที่โฮสต์ซึ่งระบุว่ารับรูปภาพ |
{"type": "input_file", "file_data": "data:application/pdf;base64,…"} | เอกสาร (PDF, Word, PowerPoint หรือ Excel): file_data เก็บ data: URL หรือ file_url เก็บ URL แบบ http(s) | ตระกูล Shannon 3 |
บนระดับของ Shannon รูปภาพและไฟล์จะถูกอ่านจากรายการ user สุดท้ายของ input ขนาดและขีดจำกัดมีหน้าของตัวเอง รูปภาพและไฟล์
คำขอที่มี instructions และตัวเลือก
คำขอนี้ส่ง instructions บทสนทนาเป็น input item ขีดจำกัดเอาต์พุต temperature และ reasoning effort ใช้โมเดล open-weight ที่โฮสต์ ซึ่งมีผลกับทั้งหมดนี้
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
response = client.responses.create(
model="DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
instructions="You are a physics teacher. Answer in two sentences.",
input=[
{"role": "user", "content": "Why is the sky blue?"},
{"role": "assistant", "content": "Air scatters blue light more than red light."},
{"role": "user", "content": "And why are sunsets red?"},
],
max_output_tokens=512,
temperature=0.3,
reasoning={"effort": "low"},
)
for item in response.output:
if item.type == "reasoning":
print("reasoning:", item.summary[0].text)
elif item.type == "message":
print("answer:", item.content[0].text)
print(response.usage) import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const response = await client.responses.create({
model: "DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
instructions: "You are a physics teacher. Answer in two sentences.",
input: [
{ role: "user", content: "Why is the sky blue?" },
{ role: "assistant", content: "Air scatters blue light more than red light." },
{ role: "user", content: "And why are sunsets red?" },
],
max_output_tokens: 512,
temperature: 0.3,
reasoning: { effort: "low" },
});
for (const item of response.output) {
if (item.type === "reasoning") console.log("reasoning:", item.summary[0].text);
if (item.type === "message") console.log("answer:", item.content[0].text);
}
console.log(response.usage); curl https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "DeepSeek-V4-Flash-0731-W4A16-AUTOROUND-REAP",
"instructions": "You are a physics teacher. Answer in two sentences.",
"input": [
{"role": "user", "content": "Why is the sky blue?"},
{"role": "assistant", "content": "Air scatters blue light more than red light."},
{"role": "user", "content": "And why are sunsets red?"}
],
"max_output_tokens": 512,
"temperature": 0.3,
"reasoning": {"effort": "low"}
}' คำตอบของโมเดล open-weight ที่โฮสต์มี id, object, model, created_at, status, output และ usage ส่วน usage ของมันเพิ่ม tokens ที่อ่านจากแคชและ tokens ที่ใช้ไปกับการให้เหตุผล:
{
"usage": {
"input_tokens": 58,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 67,
"output_tokens_details": {
"reasoning_tokens": 19
},
"total_tokens": 125
}
} ออบเจ็กต์ response
id, object, status, output และ usage มีอยู่ในทุกคำตอบ ให้สร้างโค้ดของคุณบนฟิลด์เหล่านี้
| ฟิลด์ | ประเภท | คำอธิบาย | ส่งโดย |
|---|---|---|---|
id | string | resp_ ตามด้วยอักขระเลขฐานสิบหก 32 ตัว | ทุกโมเดล |
object | string | เป็น response เสมอ | ทุกโมเดล |
status | string | completed ในสตรีมจะเป็น in_progress ก่อน และเป็น failed ใน event response.failed | ทุกโมเดล |
output | array | output item ตามลำดับที่โมเดลสร้าง: reasoning, message, function_call | ทุกโมเดล |
usage | object | input_tokens, output_tokens และ total_tokens | ทุกโมเดล |
usage.input_tokens_details | object | cached_tokens: input tokens ที่อ่านจากแคช prompt | โมเดล open-weight ที่โฮสต์ |
usage.output_tokens_details | object | reasoning_tokens: output tokens ที่ใช้ไปกับการให้เหตุผล | โมเดล open-weight ที่โฮสต์ |
model | string | id มาตรฐานของโมเดลที่ตอบ | ตระกูล Shannon 3, โมเดล open-weight ที่โฮสต์ |
created_at | integer | เวลาของคำตอบ เป็นวินาทีแบบ Unix | ตระกูล Shannon 3, โมเดล open-weight ที่โฮสต์ |
instructions, tools, temperature, … | instructions, tools และ temperature ทวนค่าจากคำขอ error และ incomplete_details เป็น null, metadata เป็น {}, parallel_tool_calls เป็น true, tool_choice เป็น auto และ top_p เป็น null | ตระกูล Shannon 3 |
Output item
| รายการ | คำอธิบาย |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | การให้เหตุผลของโมเดลเป็นส่วน summary_text หนึ่งส่วน มีเฉพาะเมื่อโมเดลให้เหตุผล |
{"id": "msg_…", "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "…"}]} | คำตอบ: ส่วน output_text หนึ่งส่วนที่มีข้อความ |
{"id": "fc_…", "type": "function_call", "call_id": "call_…", "name": "…", "arguments": "…"} | การเรียก tool arguments เป็น JSON string ส่งผลลัพธ์กลับด้วย call_id เดียวกัน |
OpenAI SDK จะรวมข้อความของ message ให้คุณใน response.output_text
การสตรีม
ตั้ง stream เป็น true เพื่อรับ server-sent events แต่ละเฟรมมีบรรทัด event: ที่ระบุชื่อ event และบรรทัด data: ที่เป็นออบเจ็กต์ JSON ซึ่งซ้ำชื่อไว้ใน type จับคู่ delta กับ item ของมันด้วย output_index
เมื่อใช้ OpenAI SDK ให้อ่าน event ตาม type:
from openai import OpenAI
client = OpenAI(
api_key="YOUR_API_KEY",
base_url="https://api.shannon-ai.com/v1",
)
stream = client.responses.create(
model="shannon-3",
input="Explain server-sent events in three sentences.",
stream=True,
)
for event in stream:
kind = getattr(event, "type", "error") # an event without a type is an error event
if kind == "response.reasoning_summary_text.delta":
pass # a piece of reasoning: event.delta
elif kind == "response.output_text.delta":
print(event.delta, end="", flush=True)
elif kind == "response.output_item.done" and event.item.type == "function_call":
print("\ntool call:", event.item.name, event.item.arguments)
elif kind == "response.completed":
print("\n", event.response.usage)
elif kind in ("response.failed", "error"):
raise RuntimeError("the stream failed, send the request again") import OpenAI from "openai";
const client = new OpenAI({
apiKey: "YOUR_API_KEY",
baseURL: "https://api.shannon-ai.com/v1",
});
const stream = await client.responses.create({
model: "shannon-3",
input: "Explain server-sent events in three sentences.",
stream: true,
});
for await (const event of stream) {
if (event.type === "response.reasoning_summary_text.delta") {
// a piece of reasoning: event.delta
} else if (event.type === "response.output_text.delta") {
process.stdout.write(event.delta);
} else if (event.type === "response.output_item.done" && event.item.type === "function_call") {
console.log("\ntool call:", event.item.name, event.item.arguments);
} else if (event.type === "response.completed") {
console.log("\n", event.response.usage);
} else if (event.type === "response.failed" || event.type === "error") {
throw new Error("the stream failed, send the request again");
}
} curl -N https://api.shannon-ai.com/v1/responses \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "shannon-3",
"input": "Explain server-sent events in three sentences.",
"stream": true
}' event มาถึงตามลำดับนี้ กลุ่มของการให้เหตุผล message และการเรียก tool จะปรากฏเมื่อคำตอบมีเท่านั้น
| Event | Payload | เมื่อใด |
|---|---|---|
response.created | response | มาเป็นอันแรกเสมอ response.status เป็น in_progress และ response.output ว่าง |
response.in_progress | response | มาเป็นอันที่สองเสมอ พร้อมออบเจ็กต์เดียวกัน |
response.output_item.added | output_index, item | การให้เหตุผลเริ่มต้น: รายการ reasoning ที่ summary ว่าง |
response.reasoning_summary_text.delta | output_index, summary_index, delta | ส่วนหนึ่งของการให้เหตุผล |
response.reasoning_summary_text.done | output_index, summary_index, text | การให้เหตุผลสมบูรณ์: text ทั้งหมดของมัน |
response.output_item.done | output_index, item | รายการ reasoning ที่เสร็จแล้ว |
response.output_item.added | output_index, item | คำตอบเริ่มต้น: รายการ message ที่มีสถานะ in_progress และไม่มีเนื้อหา |
response.content_part.added | output_index, content_index, part | ส่วน output_text ที่ว่างเปิดขึ้น |
response.output_text.delta | output_index, content_index, delta | ส่วนหนึ่งของคำตอบ |
response.output_text.done | output_index, content_index, text | คำตอบสมบูรณ์: text ทั้งหมดของมัน |
response.content_part.done | output_index, content_index, part | ส่วน output_text ที่เสร็จแล้ว |
response.output_item.done | output_index, item | รายการ message ที่เสร็จแล้ว มีสถานะ completed |
response.output_item.added | output_index, item | การเรียก tool เริ่มต้น: รายการ function_call ที่มี call_id, name และ arguments ว่าง |
response.function_call_arguments.delta | output_index, delta | อาร์กิวเมนต์ของการเรียก ครบใน delta เดียว |
response.function_call_arguments.done | output_index, arguments | อาร์กิวเมนต์เดียวกัน ในรูป arguments |
response.output_item.done | output_index, item | รายการ function_call ที่เสร็จแล้ว |
response.completed | response | มาเป็นอันสุดท้ายเสมอเมื่อสำเร็จ: ออบเจ็กต์ response ทั้งหมดพร้อม output และ usage |
event: response.created
data: {"type":"response.created","response":{"id":"resp_5f0c…","object":"response","status":"in_progress","output":[], …}}
event: response.in_progress
data: {"type":"response.in_progress","response":{"id":"resp_5f0c…","object":"response","status":"in_progress","output":[], …}}
event: response.output_item.added
data: {"type":"response.output_item.added","output_index":0,"item":{"id":"msg_1c7b…","type":"message","role":"assistant","status":"in_progress","content":[]}}
event: response.content_part.added
data: {"type":"response.content_part.added","output_index":0,"content_index":0,"part":{"type":"output_text","text":""}}
event: response.output_text.delta
data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":"Server-sent"}
event: response.output_text.delta
data: {"type":"response.output_text.delta","output_index":0,"content_index":0,"delta":" events let a server push text over one HTTP reply."}
event: response.output_text.done
data: {"type":"response.output_text.done","output_index":0,"content_index":0,"text":"Server-sent events let a server push text over one HTTP reply."}
event: response.content_part.done
data: {"type":"response.content_part.done","output_index":0,"content_index":0,"part":{"type":"output_text","text":"Server-sent events let a server push text over one HTTP reply."}}
event: response.output_item.done
data: {"type":"response.output_item.done","output_index":0,"item":{"id":"msg_1c7b…","type":"message","role":"assistant","status":"completed","content":[{"type":"output_text","text":"Server-sent events let a server push text over one HTTP reply.","annotations":[]}]}}
event: response.completed
data: {"type":"response.completed","response":{"id":"resp_5f0c…","object":"response","status":"completed","output":[…],"usage":{"input_tokens":1190,"output_tokens":18,"total_tokens":1208}, …}} สตรีมที่ล้มเหลว
บนระดับของ Shannon คำตอบที่ล้มเหลวจบด้วย response.failed แทน response.completed โดย response.status เป็น failed และ response.error มี code เป็น rate_limit_exceeded หรือ server_error และ message
บนโมเดล open-weight ที่โฮสต์ ความล้มเหลวคือ event error ที่มี code เป็น api_error และ message แล้ว response.completed ยังตามมา
ให้ถือว่าสตรีมล้มเหลวเมื่อมี event response.failed หรือ error แล้วส่งคำขออีกครั้ง
เครื่องมือ (Tools)
tool คือฟังก์ชันที่โค้ดของคุณรัน อธิบายไว้ใน tools เมื่อโมเดลต้องการ คำตอบจะมีรายการ function_call แทนหรือข้าง message
นิยาม tool ใน tools:
[
{
"type": "function",
"name": "get_weather",
"description": "Current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
]
}
}
] output ของคำตอบที่เรียกฟังก์ชันนั้น:
[
{
"id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"type": "function_call",
"name": "get_weather",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"arguments": "{\"city\":\"Paris\"}"
}
] รันฟังก์ชัน แล้วส่งคำขออีกครั้งโดยเพิ่มการเรียกและผลลัพธ์ลงใน input:
[
{
"role": "user",
"content": "What is the weather in Paris?"
},
{
"type": "function_call",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"name": "get_weather",
"arguments": "{\"city\":\"Paris\"}"
},
{
"type": "function_call_output",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"output": "{\"temperature_c\": 18, \"sky\": \"cloudy\"}"
}
] อ่านเฉพาะ tool ชนิด function บน shannon-1.6-*, shannon-2-* และ shannon-coder-1 schema ของ parameters จะถูกลดเหลือคีย์เวิร์ด JSON Schema ทั่วไป: oneOf ถูกอ่านเป็น anyOf และคีย์เวิร์ดเช่น $ref, additionalProperties, const, default และ title จะไม่ถูกส่งให้โมเดล
โมเดล open-weight ที่โฮสต์ใช้ค่า tool_choice เป็น required และฟังก์ชันที่ระบุชื่อ
ลูปของ tool อธิบายไว้ครบถ้วนในหน้าของตัวเอง การเรียกฟังก์ชัน
เอาต์พุตแบบมีโครงสร้าง
รูปแบบนี้เขียนเอาต์พุตแบบมีโครงสร้างเป็น text.format schema อยู่ใน format โดยตรง ข้าง name และ strict ไม่ได้อยู่ภายใต้สมาชิก json_schema เหมือนบน Chat Completions
{"type": "json_object"}ขอออบเจ็กต์ JSON ใดก็ได้{"type": "json_schema", "name", "schema", "strict"}ขอ JSON ที่เป็นไปตาม schema ของคุณstrictเป็นtrueเมื่อคุณไม่ระบุ
{
"model": "shannon-1.6-lite",
"input": "Extract the city and the date: 'The conference opens in Lisbon on 12 May 2027.'",
"text": {
"format": {
"type": "json_schema",
"name": "event",
"strict": true,
"schema": {
"type": "object",
"properties": {
"city": {
"type": "string"
},
"date": {
"type": "string",
"description": "ISO 8601 date"
}
},
"required": [
"city",
"date"
]
}
}
}
} JSON มาถึงเป็นข้อความในส่วน output_text ของ message ให้ parse เอง โมเดล open-weight ที่โฮสต์ซึ่งไม่รองรับเอาต์พุตแบบมีโครงสร้างจะคืน 400
{"city": "Lisbon", "date": "2027-05-12"} โมเดลใดรับรูปแบบใด ระบุไว้ในหน้าของตัวเอง เอาต์พุตแบบมีโครงสร้าง
การให้เหตุผล
โมเดลที่ให้เหตุผลจะส่งคืนการให้เหตุผลเป็น output item ชนิด reasoning ก่อน message ในสตรีมจะมาถึงเป็น event response.reasoning_summary_text.delta
โมเดล open-weight ที่โฮสต์ใช้ reasoning.effort: off, low, medium หรือ high โดยเป็น high เมื่อคุณไม่ส่งอะไร off ไม่ส่งคืนรายการ reasoning ให้ส่งเป็นออบเจ็กต์ endpoint นี้ไม่อ่านสตริงเปล่า
effort ต่างๆ อธิบายไว้ในหน้าของตัวเอง ระดับความพยายามในการให้เหตุผล
ขีดจำกัดเอาต์พุต
max_output_tokens เป็น 4,096 เมื่อคุณไม่ได้ส่ง เป็นจำนวน tokens ที่กันไว้จากยอดคงเหลือของคุณเมื่อคำขอเริ่ม เมื่อคำตอบสมบูรณ์ จำนวนนั้นจะถูกแทนที่ด้วยสิ่งที่คำขอใช้จริง ค่าที่ไม่พอดีกับยอดคงเหลือที่เหลืออยู่จะคืน 429 Quota exceeded
จำกัดความยาวของคำตอบบน shannon-1.6-*, shannon-2-* และ shannon-coder-1 และความยาวของข้อความคำตอบบนโมเดล open-weight ที่โฮสต์
บน endpoint นี้ shannon-coder-1 คิดเงินเป็น tokens จากยอดคงเหลือของคุณ เหมือนโมเดลอื่นทุกตัว
body ของคำขอใหญ่ได้ถึง 32 MiB ขีดจำกัดและยอดคงเหลือ
ข้อผิดพลาด
ข้อผิดพลาดใช้ body ข้อผิดพลาดของ OpenAI: ออบเจ็กต์ error ที่มี type และ message บางรายการมี code และ param ด้วยโดยมีค่า null ตารางแสดงสิ่งที่ endpoint นี้ส่งคืนบ่อยที่สุด รายการทั้งหมดพร้อมข้อมูลว่าควรลองใหม่เมื่อใดอยู่ในหน้าของตัวเอง การจัดการข้อผิดพลาด
| สถานะ | ประเภท | ข้อความ | เมื่อใด |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | ไม่ได้ส่ง API key หรือคีย์ไม่เป็นที่รู้จักหรือถูกเพิกถอนแล้ว |
400 | invalid_request_error | unknown model: <id> | ไม่มี model หรือไม่ใช่ id ที่เผยแพร่ |
400 | invalid_request_error | No user message provided. | ระดับของ Shannon: input ไม่มีข้อความของผู้ใช้ |
400 | invalid_request_error | <id> does not accept image input | ส่งรูปภาพไปยังโมเดล open-weight ที่โฮสต์ซึ่งไม่รับรูปภาพ |
400 | invalid_request_error | <id> does not accept response_format | ส่ง text.format ไปยังโมเดล open-weight ที่โฮสต์ซึ่งไม่รองรับเอาต์พุตแบบมีโครงสร้าง |
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | reasoning.effort มีค่านอกรายการ |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | body เป็น JSON ที่ถูกต้อง แต่ฟิลด์มีชนิดไม่ถูกต้อง |
429 | rate_limit_error | Quota exceeded. Upgrade your plan at shannon-ai.com/plan | max_output_tokens ใหญ่กว่ายอดคงเหลือของคุณ |
429 | rate_limit_error | Too many requests. Retry in <n>s. | Flood protection: มีคำขอมากกว่า 120 รายการในหนึ่งนาทีบนบัญชีของคุณ |
500 | api_error | The model backend failed to answer. Please retry. | โมเดลไม่ได้สร้างคำตอบ ให้ส่งคำขออีกครั้ง |
502 | api_error | The model backend failed to answer. Please retry. | เหมือนกัน บนโมเดล open-weight ที่โฮสต์ |
504 | api_error | upstream timed out | โมเดล open-weight ที่โฮสต์ใช้เวลานานเกินเวลาจำกัดของคำตอบที่ไม่ใช่สตรีม ให้ส่งโดยตั้ง stream เป็น true |