Responses API
नयाँPOST /v1/responses ले निर्देशन र इनपुट आइटमहरूको सूची लिन्छ र OpenAI Responses ढाँचामा आउटपुट आइटमहरूले बनेको रेस्पोन्स अब्जेक्ट फर्काउँछ। यसलाई OpenAI SDK को responses API सँग र Codex CLI जस्ता त्यसमा बनेका टुलहरूसँग प्रयोग गर्नुहोस्। इन्डपोइन्टले कुनै अवस्था राख्दैन: हरेक अनुरोधसँग पूरा कुराकानी पठाउनुहोस्।
POST https://api.shannon-ai.com/v1/responses
सबैभन्दा सानो अनुरोध मोडल 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."
}' जवाफ रेस्पोन्स अब्जेक्ट हो। मोडलले रिजनिङ गरेको भए यसको output मा रिजनिङ र सन्देश हुन्छन्:
{
"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 चाहिन्छ। लागू गर्ने स्तम्भले फिल्डले जवाफ बदल्ने मोडलहरूको नाम दिन्छ। होस्ट गरिएका ओपन-वेट मोडलहरू मोडल सूचीका बाह्र 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 | स्ट्रिङ, जुन एउटा प्रयोगकर्ता सन्देशका रूपमा पढिन्छ, वा इनपुट आइटमहरूको एरे। तल इनपुट आइटमहरू हेर्नुहोस्। | सबै मोडलहरू | |
instructions | string | मोडलका लागि निर्देशन, यो ढाँचाको सिस्टम प्रम्प्ट। | होस्ट गरिएका ओपन-वेट मोडलहरू, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true ले जवाफलाई सर्भर-सेन्ट इभेन्टका रूपमा पठाउँछ। तल स्ट्रिमिङ हेर्नुहोस्। | सबै मोडलहरू |
max_output_tokens | integer | 4096 | टोकनमा जवाफको माथिल्लो सीमा। 1 देखि 65,536 बाहिरको मान त्यो दायराभित्र सारिन्छ। अनुरोध चलिरहँदा तपाईंको ब्यालेन्सबाट छुट्याइने रकम पनि यही हो। तल आउटपुट सीमा हेर्नुहोस्। | होस्ट गरिएका ओपन-वेट मोडलहरू, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | स्याम्पलिङ तापक्रम। होस्ट गरिएका ओपन-वेट मोडलहरूमा मान 0 र 2 बीच राखिन्छन्। | होस्ट गरिएका ओपन-वेट मोडलहरू; स्ट्रिम नगरिएका जवाफमा shannon-1.6-*, shannon-2-* र shannon-coder-1 | |
top_p | number | न्युक्लियस स्याम्पलिङ। मान 0 र 1 बीच राखिन्छन्। | होस्ट गरिएका ओपन-वेट मोडलहरू | |
tools | array | मोडलले कल गर्न सक्ने फङ्सनहरू, यो ढाँचाको समतल रूपमा: {"type": "function", "name", "description", "parameters"}। तल टुलहरू हेर्नुहोस्। | सबै मोडलहरू | |
tool_choice | string | object | auto | "auto" ले मोडललाई निर्णय गर्न दिन्छ। "required" ले यसलाई टुल कल गर्न लगाउँछ। {"type": "function", "name": "…"} ले यसलाई त्यही टुल कल गर्न लगाउँछ। | होस्ट गरिएका ओपन-वेट मोडलहरू |
reasoning | object | off, low, medium वा high सहित {"effort": "…"}। अन्य कुनै मानले 400 फर्काउँछ। | होस्ट गरिएका ओपन-वेट मोडलहरू | |
text | object | {"format": {…}} ले JSON उत्तर माग्छ। तल स्ट्रक्चर्ड आउटपुट हेर्नुहोस्। | सबै Shannon तहहरू; होस्ट गरिएका ओपन-वेट मोडलहरू प्रति id सूचीबद्ध गरिएअनुसार |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user र prompt_cache_key स्वीकार गरिन्छन् ताकि अवस्थित क्लाइन्ट कोड बिना परिवर्तन चलोस्। तिनीहरूले जवाफ बदल्दैनन्। कुनै कुराकानी भण्डारण नगरिने भएकाले अर्को अनुरोधले अघिल्ला टर्नहरू input मा बोक्छ।
इनपुट आइटमहरू
इनपुट आइटम role र content भएको सन्देश हो, वा टुल कल वा त्यसको नतिजा बोक्ने टाइप गरिएको आइटम हो। content स्ट्रिङ वा भागहरूको एरे हो।
| आइटम | विवरण | लागू गर्ने |
|---|---|---|
{"role": "user", "content": …} | तपाईंले के सोध्नुहुन्छ। content स्ट्रिङ हो, वा input_text र input_image भागहरू। | सबै मोडलहरू |
{"role": "assistant", "content": …} | मोडलको अघिल्लो जवाफ। content स्ट्रिङ हो, वा output_text भागहरू। | सबै मोडलहरू |
{"role": "system", "content": …}{"role": "developer", "content": …} | कुराकानीभित्रका निर्देशनहरू। | होस्ट गरिएका ओपन-वेट मोडलहरू |
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} | मोडलले अघिल्लो जवाफमा गरेको टुल कल। arguments JSON स्ट्रिङ हो। | सबै मोडलहरू |
{"type": "function_call_output", "call_id": "…", "output": "…"} | त्यो कलको नतिजा। call_id कलको id हो र output स्ट्रिङका रूपमा नतिजा हो। | सबै मोडलहरू |
निर्देशनहरू instructions फिल्डमा राख्नुहोस्। Shannon 3 परिवारको id सँग, पालना हुनैपर्ने निर्देशनहरू user सन्देशमा राख्नुहोस्।
जवाफको output का आइटमहरू जस्ताको तस्तै input मा फर्काउन सकिन्छ: message र function_call आइटम पढिन्छन्, reasoning आइटम छोडिन्छन्।
कन्टेन्ट भागहरू
| भाग | विवरण | उपलब्ध |
|---|---|---|
{"type": "input_text", "text": "…"} | प्रयोगकर्ता सन्देशको टेक्स्ट। | सबै मोडलहरू |
{"type": "output_text", "text": "…"} | असिस्टेन्ट सन्देशको टेक्स्ट। | सबै मोडलहरू |
{"type": "input_image", "image_url": "…"} | base64 सामग्री भएको data: URL वा http(s) URL का रूपमा छवि। | Shannon 3 परिवार, shannon-1.6-lite, shannon-1.6-pro, र छवि इनपुट सूचीबद्ध गर्ने होस्ट गरिएका ओपन-वेट मोडलहरू |
{"type": "input_file", "file_data": "data:application/pdf;base64,…"} | कागजात (PDF, Word, PowerPoint वा Excel): file_data मा data: URL राखिन्छ, वा file_url मा http(s) URL राखिन्छ। | Shannon 3 परिवार |
Shannon तहहरूमा छवि र फाइलहरू input को अन्तिम user आइटमबाट पढिन्छन्। आकार र सीमाहरूको आफ्नै पेज छ। छवि र फाइलहरू
निर्देशन र विकल्पहरूसहितको अनुरोध
यो अनुरोधले निर्देशन, इनपुट आइटमका रूपमा कुराकानी, आउटपुट सीमा, तापक्रम र रिजनिङ प्रयास पठाउँछ। यसले होस्ट गरिएको ओपन-वेट मोडल प्रयोग गर्छ, जसले ती सबै लागू गर्छ।
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"}
}' होस्ट गरिएको ओपन-वेट मोडलको जवाफमा id, object, model, created_at, status, output र usage हुन्छन्। यसको usage ले क्याशबाट पढिएका टोकन र रिजनिङमा खर्च भएका टोकन थप्छ:
{
"usage": {
"input_tokens": 58,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 67,
"output_tokens_details": {
"reasoning_tokens": 19
},
"total_tokens": 125
}
} रेस्पोन्स अब्जेक्ट
id, object, status, output र usage हरेक जवाफमा हुन्छन्। आफ्नो कोड तिनैमा आधारित बनाउनुहोस्।
| फिल्ड | प्रकार | विवरण | पठाउने |
|---|---|---|---|
id | string | resp_ पछि 32 हेक्साडेसिमल अक्षर। | सबै मोडलहरू |
object | string | सधैं response। | सबै मोडलहरू |
status | string | completed। स्ट्रिममा यो पहिले in_progress हुन्छ, र response.failed इभेन्टमा failed। | सबै मोडलहरू |
output | array | मोडलले बनाएकै क्रममा आउटपुट आइटमहरू: reasoning, message, function_call। | सबै मोडलहरू |
usage | object | input_tokens, output_tokens र total_tokens। | सबै मोडलहरू |
usage.input_tokens_details | object | cached_tokens: प्रम्प्ट क्याशबाट पढिएका इनपुट टोकन। | होस्ट गरिएका ओपन-वेट मोडलहरू |
usage.output_tokens_details | object | reasoning_tokens: रिजनिङमा खर्च भएका आउटपुट टोकन। | होस्ट गरिएका ओपन-वेट मोडलहरू |
model | string | जवाफ दिने मोडलको क्यानोनिकल id। | Shannon 3 परिवार, होस्ट गरिएका ओपन-वेट मोडलहरू |
created_at | integer | Unix सेकेन्डमा जवाफको समय। | Shannon 3 परिवार, होस्ट गरिएका ओपन-वेट मोडलहरू |
instructions, tools, temperature, … | instructions, tools र temperature ले अनुरोध दोहोर्याउँछन्। error र incomplete_details null हुन्, metadata {} हो, parallel_tool_calls true हो, tool_choice auto हो र top_p null हो। | Shannon 3 परिवार |
आउटपुट आइटमहरू
| आइटम | विवरण |
|---|---|
{"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": "…"} | टुल कल। arguments JSON स्ट्रिङ हो। नतिजा उही call_id सहित फर्काउनुहोस्। |
OpenAI SDK हरूले सन्देशको टेक्स्ट response.output_text मा तपाईंका लागि जोड्छन्।
स्ट्रिमिङ
सर्भर-सेन्ट इभेन्टका लागि stream लाई true सेट गर्नुहोस्। हरेक फ्रेममा इभेन्टको नाम भएको event: लाइन र JSON अब्जेक्ट भएको data: लाइन हुन्छ; अब्जेक्टले type मा नाम दोहोर्याउँछ। डेल्टाहरूलाई output_index द्वारा तिनका आइटमसँग मिलाउनुहोस्।
OpenAI SDK सँग इभेन्टहरूलाई तिनको 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
}' इभेन्टहरू यही क्रममा आउँछन्। रिजनिङ, सन्देश र टुल कलका समूह जवाफमा भए मात्र देखिन्छन्।
| इभेन्ट | पेलोड | कहिले |
|---|---|---|
response.created | response | सधैं पहिलो। response.status in_progress हुन्छ र response.output खाली हुन्छ। |
response.in_progress | response | सधैं दोस्रो, उही अब्जेक्टसहित। |
response.output_item.added | output_index, item | रिजनिङ सुरु हुन्छ: खाली summary भएको reasoning आइटम। |
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 | उत्तर सुरु हुन्छ: स्टेटस in_progress र कुनै सामग्री नभएको message आइटम। |
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 | टुल कल सुरु हुन्छ: call_id, name र खाली arguments भएको function_call आइटम। |
response.function_call_arguments.delta | output_index, delta | कलका आर्गुमेन्टहरू, एउटै डेल्टामा पूरा। |
response.function_call_arguments.done | output_index, arguments | उही आर्गुमेन्टहरू, arguments का रूपमा। |
response.output_item.done | output_index, item | सकिएको function_call आइटम। |
response.completed | 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.completed को सट्टा response.failed मा सकिन्छ। यसको response.status failed हुन्छ र response.error मा code, rate_limit_exceeded वा server_error, र message हुन्छ।
होस्ट गरिएका ओपन-वेट मोडलहरूमा असफलता code api_error र message सहितको error इभेन्ट हो। response.completed तैपनि त्यसपछि आउँछ।
स्ट्रिममा response.failed वा error इभेन्ट भए त्यसलाई असफल मान्नुहोस् र अनुरोध फेरि पठाउनुहोस्।
टुलहरू
टुल तपाईंको कोडले चलाउने फङ्सन हो। यसलाई tools मा वर्णन गर्नुहोस्; मोडलले यो चाहँदा जवाफमा सन्देशको सट्टा, वा सन्देशको छेउमा, function_call आइटम हुन्छ।
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\"}"
}
] function प्रकारका टुलहरू मात्र पढिन्छन्। shannon-1.6-*, shannon-2-* र shannon-coder-1 मा parameters स्कीमा साझा JSON Schema किवर्डहरूमा घटाइन्छ: oneOf लाई anyOf का रूपमा पढिन्छ, र $ref, additionalProperties, const, default र title जस्ता किवर्डहरू मोडललाई दिइँदैनन्।
tool_choice का मानहरू required र नाम दिइएको फङ्सन होस्ट गरिएका ओपन-वेट मोडलहरूले लागू गर्छन्।
टुल लुप आफ्नै पेजमा पूर्ण रूपमा वर्णन गरिएको छ। फङ्क्शन कलिङ
स्ट्रक्चर्ड आउटपुट
यो ढाँचाले स्ट्रक्चर्ड आउटपुटलाई text.format लेख्छ। स्कीमा format मै, name र strict को छेउमा हुन्छ, Chat Completions मा जस्तो json_schema सदस्यमुनि होइन।
{"type": "json_object"}ले कुनै पनि JSON अब्जेक्ट माग्छ।{"type": "json_schema", "name", "schema", "strict"}ले तपाईंको स्कीमा पछ्याउने JSON माग्छ। तपाईंले नराख्दाstricttrueहुन्छ।
{
"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 भागमा टेक्स्टका रूपमा आउँछ; आफैं पार्स गर्नुहोस्। स्ट्रक्चर्ड आउटपुट नभएको होस्ट गरिएको ओपन-वेट मोडलले 400 फर्काउँछ।
{"city": "Lisbon", "date": "2027-05-12"} कुन मोडलले कुन रूप लिन्छ भन्ने आफ्नै पेजमा सूचीबद्ध छ। संरचित आउटपुट
रिजनिङ
रिजनिङ गर्ने मोडलले आफ्नो रिजनिङ सन्देश अघि reasoning प्रकारको आउटपुट आइटमका रूपमा फर्काउँछ। स्ट्रिममा यो response.reasoning_summary_text.delta इभेन्टका रूपमा आउँछ।
होस्ट गरिएका ओपन-वेट मोडलहरूले reasoning.effort लागू गर्छन्: off, low, medium वा high, तपाईंले केही नपठाउँदा high। off ले रिजनिङ आइटम फर्काउँदैन। यसलाई अब्जेक्टका रूपमा पठाउनुहोस्; यो इन्डपोइन्टमा सादा स्ट्रिङ पढिँदैन।
प्रयासहरू आफ्नै पेजमा वर्णन गरिएका छन्। रिजनिङ एफर्ट
आउटपुट सीमा
तपाईंले नपठाउँदा max_output_tokens 4,096 हुन्छ। अनुरोध सुरु हुँदा तपाईंको ब्यालेन्सबाट छुट्याइने टोकन संख्या यही हो; जवाफ पूरा हुँदा त्यो रकम अनुरोधले प्रयोग गरेको रकमले बदलिन्छ। तपाईंको बाँकी ब्यालेन्समा नअट्ने मानले 429 Quota exceeded फर्काउँछ।
यसले shannon-1.6-*, shannon-2-* र shannon-coder-1 मा जवाफको लम्बाइ, र होस्ट गरिएका ओपन-वेट मोडलहरूमा उत्तर टेक्स्टको लम्बाइ सीमित गर्छ।
यो इन्डपोइन्टमा shannon-coder-1 मा अरू हरेक मोडलजस्तै तपाईंको ब्यालेन्सबाट टोकनमा शुल्क लाग्छ।
अनुरोध बडी 32 MiB सम्म हुन सक्छ। सीमा र ब्यालेन्स
त्रुटिहरू
त्रुटिहरूले OpenAI त्रुटि बडी प्रयोग गर्छन्: type र message भएको error अब्जेक्ट; केहीले null मान भएका code र param पनि बोक्छन्। तालिकाले यो इन्डपोइन्टले प्रायः फर्काउने कुरा सूचीबद्ध गर्छ। के फेरि प्रयास गर्ने भन्ने सहितको पूर्ण सूचीको आफ्नै पेज छ। त्रुटि व्यवस्थापन
| स्टेटस | प्रकार | सन्देश | कहिले |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | कुनै API की पठाइएन, वा की अज्ञात वा रद्द गरिएको छ। |
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 | छवि इनपुट नभएको होस्ट गरिएको ओपन-वेट मोडलमा छवि पठाइयो। |
400 | invalid_request_error | <id> does not accept response_format | स्ट्रक्चर्ड आउटपुट नभएको होस्ट गरिएको ओपन-वेट मोडलमा text.format पठाइयो। |
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: … | बडी मान्य 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. | फ्लड प्रोटेक्सन: तपाईंको खातामा एक मिनेटमा 120 भन्दा बढी अनुरोध। |
500 | api_error | The model backend failed to answer. Please retry. | मोडलले जवाफ उत्पन्न गरेन। अनुरोध फेरि पठाउनुहोस्। |
502 | api_error | The model backend failed to answer. Please retry. | होस्ट गरिएका ओपन-वेट मोडलहरूमा उही। |
504 | api_error | upstream timed out | होस्ट गरिएको ओपन-वेट मोडलले स्ट्रिम नगरिएको जवाफको समय सीमाभन्दा बढी समय लियो। stream लाई true सेट गरेर पठाउनुहोस्। |