Responses API
ՆՈՐPOST /v1/responses-ը ընդունում է հրահանգներ և մուտքի տարրերի ցանկ և վերադարձնում է ելքի տարրերից կազմված response օբյեկտ՝ OpenAI Responses ձևաչափով։ Օգտագործեք այն OpenAI SDK-ի responses API-ի հետ և դրա վրա կառուցված գործիքների հետ, օրինակ՝ Codex CLI-ի։ Endpoint-ը վիճակ չի պահում. յուրաքանչյուր հարցման հետ ուղարկեք ամբողջ զրույցը։
POST https://api.shannon-ai.com/v1/responses
Ամենափոքր հարցումը մոդելի id-ն է և տեքստը։ Պատասխանը streaming չի լինի, եթե չխնդրեք։
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-ը պարունակում է reasoning-ը, երբ մոդելը տրամաբանել է, և հաղորդագրությունը.
{
"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։ Կիրառվում է սյունակը նշում է այն մոդելները, որոնց վրա դաշտը փոխում է պատասխանը։ Hosted 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 | Տող, որը կարդացվում է որպես մեկ user հաղորդագրություն, կամ մուտքի տարրերի զանգված։ Տե՛ս ստորև՝ Մուտքի տարրեր։ | Բոլոր մոդելները | |
instructions | string | Հրահանգներ մոդելի համար՝ այս ձևաչափի system prompt-ը։ | Hosted open-weight մոդելներ, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true-ն ուղարկում է պատասխանը որպես server-sent events։ Տե՛ս ստորև՝ Streaming։ | Բոլոր մոդելները |
max_output_tokens | integer | 4096 | Պատասխանի վերին սահմանը՝ թոքեններով։ 1-ից 65,536 տիրույթից դուրս արժեքը տեղափոխվում է այդ տիրույթ։ Սա նաև այն քանակն է, որը հարցման ընթացքում առանձնացվում է ձեր մնացորդից։ Տե՛ս ստորև՝ Ելքի սահման։ | Hosted open-weight մոդելներ, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | Sampling temperature։ Hosted open-weight մոդելների վրա արժեքները պահվում են 0-ից 2 միջակայքում։ | Hosted open-weight մոդելներ. shannon-1.6-*, shannon-2-* և shannon-coder-1՝ streaming չունեցող պատասխանների դեպքում | |
top_p | number | Nucleus sampling։ Արժեքները պահվում են 0-ից 1 միջակայքում։ | Hosted open-weight մոդելներ | |
tools | array | Ֆունկցիաները, որոնք մոդելը կարող է կանչել, այս ձևաչափի հարթ տեսքով՝ {"type": "function", "name", "description", "parameters"}։ Տե՛ս ստորև՝ Գործիքներ։ | Բոլոր մոդելները | |
tool_choice | string | object | auto | "auto"-ն թողնում է, որ մոդելը որոշի։ "required"-ը ստիպում է կանչել գործիք։ {"type": "function", "name": "…"}-ը ստիպում է կանչել հենց այդ գործիքը։ | Hosted open-weight մոդելներ |
reasoning | object | {"effort": "…"}՝ off, low, medium կամ high արժեքով։ Ցանկացած այլ արժեք վերադարձնում է 400։ | Hosted open-weight մոդելներ | |
text | object | {"format": {…}} խնդրում է JSON պատասխան։ Տե՛ս ստորև՝ Structured output։ | Shannon-ի բոլոր մակարդակները. hosted open-weight մոդելները՝ ըստ 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": …} | Հրահանգներ զրույցի ներսում։ | Hosted open-weight մոդելներ |
{"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 տարրերը բաց են թողնվում։
Content մասեր
| Մաս | Նկարագրություն | Հասանելի է |
|---|---|---|
{"type": "input_text", "text": "…"} | User հաղորդագրության տեքստ։ | Բոլոր մոդելները |
{"type": "output_text", "text": "…"} | Assistant հաղորդագրության տեքստ։ | Բոլոր մոդելները |
{"type": "input_image", "image_url": "…"} | Պատկեր՝ որպես base64 բովանդակությամբ data: URL կամ որպես http(s) URL։ | Shannon 3 ընտանիք, shannon-1.6-lite, shannon-1.6-pro և hosted open-weight մոդելները, որոնք նշում են պատկերի մուտքը |
{"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 տարրից։ Չափերն ու սահմանները ունեն իրենց էջը։ Պատկերներ և ֆայլեր
Հարցում հրահանգներով և ընտրանքներով
Այս հարցումն ուղարկում է հրահանգներ, զրույց՝ որպես մուտքի տարրեր, ելքի սահման, temperature և reasoning effort։ Այն օգտագործում է hosted 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"}
}' Hosted open-weight մոդելի պատասխանն ունի id, object, model, created_at, status, output և usage։ Դրա usage-ը ավելացնում է cache-ից կարդացված թոքենները և reasoning-ի վրա ծախսված թոքենները.
{
"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 է, իսկ response.failed իրադարձությունում՝ failed։ | Բոլոր մոդելները |
output | array | Ելքի տարրերը՝ այն հերթականությամբ, որով մոդելը ստեղծել է դրանք՝ reasoning, message, function_call։ | Բոլոր մոդելները |
usage | object | input_tokens, output_tokens և total_tokens։ | Բոլոր մոդելները |
usage.input_tokens_details | object | cached_tokens. մուտքի թոքենները, որոնք կարդացվել են prompt cache-ից։ | Hosted open-weight մոդելներ |
usage.output_tokens_details | object | reasoning_tokens. ելքի թոքենները, որոնք ծախսվել են reasoning-ի վրա։ | Hosted open-weight մոդելներ |
model | string | Պատասխանած մոդելի կանոնական id-ն։ | Shannon 3 ընտանիք, hosted open-weight մոդելներ |
created_at | integer | Պատասխանի ժամանակը՝ Unix վայրկյաններով։ | Shannon 3 ընտանիք, hosted 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 ընտանիք |
Ելքի տարրեր
| Տարր | Նկարագրություն |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | Մոդելի reasoning-ը՝ որպես մեկ 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-ում։
Streaming
Սահմանեք stream-ը true՝ server-sent events ստանալու համար։ Յուրաքանչյուր շրջանակ ունի event: տող՝ իրադարձության անունով, և data: տող՝ JSON օբյեկտով. օբյեկտը կրկնում է անունը type-ում։ Delta-ները կապեք իրենց տարրին ըստ 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
}' Իրադարձությունները գալիս են այս հերթականությամբ։ Reasoning-ի, հաղորդագրության և գործիքի կանչերի խմբերը հայտնվում են միայն այն դեպքում, երբ պատասխանն ունի դրանք։
| Իրադարձություն | Բեռ | Երբ |
|---|---|---|
response.created | response | Միշտ առաջինն է։ response.status-ը in_progress է, իսկ response.output-ը՝ դատարկ։ |
response.in_progress | response | Միշտ երկրորդն է՝ նույն օբյեկտով։ |
response.output_item.added | output_index, item | Reasoning-ը սկսվում է. reasoning տարր՝ դատարկ summary-ով։ |
response.reasoning_summary_text.delta | output_index, summary_index, delta | Reasoning-ի մի կտոր։ |
response.reasoning_summary_text.done | output_index, summary_index, text | Reasoning-ը ավարտված է. դրա ամբողջ 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 | Գործիքի կանչը սկսվում է. 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։
Hosted open-weight մոդելների վրա ձախողումը error իրադարձություն է՝ code api_error-ով և message-ով։ 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 արժեքը և անվանված ֆունկցիան կիրառում են hosted open-weight մոդելները։
Գործիքների ցիկլը ամբողջությամբ նկարագրված է իր էջում։ Ֆունկցիայի կանչ
Structured output
Այս ձևաչափը structured output-ը գրում է որպես text.format։ Սխեման գտնվում է անմիջապես format-ում՝ name-ի և strict-ի կողքին, ոչ թե json_schema անդամի տակ, ինչպես Chat Completions-ում։
{"type": "json_object"}խնդրում է ցանկացած JSON օբյեկտ։{"type": "json_schema", "name", "schema", "strict"}խնդրում է ձեր սխեմային համապատասխանող JSON։ Երբ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 մասում. վերլուծեք (parse) այն ինքներդ։ Structured output չունեցող hosted open-weight մոդելը վերադարձնում է 400։
{"city": "Lisbon", "date": "2027-05-12"} Ո՞ր մոդելն ընդունում է որ ձևը, նշված է իր էջում։ Կառուցվածքային արդյունքներ
Reasoning
Տրամաբանող մոդելը վերադարձնում է իր reasoning-ը որպես reasoning տեսակի ելքի տարր՝ հաղորդագրությունից առաջ։ Հոսքում այն գալիս է որպես response.reasoning_summary_text.delta իրադարձություններ։
Hosted open-weight մոդելները կիրառում են reasoning.effort՝ off, low, medium կամ high, իսկ երբ ոչինչ չեք ուղարկում՝ high։ off-ը reasoning տարր չի վերադարձնում։ Ուղարկեք այն որպես օբյեկտ. պարզ տողը այս endpoint-ում չի կարդացվում։
Effort-ները նկարագրված են իրենց էջում։ Reasoning effort
Ելքի սահման
max_output_tokens-ը 4,096 է, երբ չեք ուղարկում այն։ Սա այն թոքենների քանակն է, որն առանձնացվում է ձեր մնացորդից հարցման սկզբում. երբ պատասխանը ավարտվում է, այդ քանակը փոխարինվում է հարցման օգտագործածով։ Արժեքը, որը չի տեղավորվում ձեր մնացորդի մեջ, վերադարձնում է 429 Quota exceeded։
Այն սահմանափակում է պատասխանի երկարությունը shannon-1.6-*, shannon-2-* և shannon-coder-1 մոդելների վրա, և պատասխանի տեքստի երկարությունը՝ hosted open-weight մոդելների վրա։
Այս endpoint-ում shannon-coder-1-ը գանձվում է թոքեններով ձեր մնացորդից, ինչպես մյուս բոլոր մոդելները։
Հարցման մարմինը կարող է լինել մինչև 32 MiB։ Սահմանաչափեր և մնացորդ
Սխալներ
Սխալները օգտագործում են OpenAI-ի սխալի մարմինը՝ error օբյեկտ type-ով և message-ով. ոմանք կրում են նաև code և param null արժեքով։ Աղյուսակը թվարկում է այն, ինչ այս endpoint-ը վերադարձնում է ամենահաճախ։ Լրիվ ցանկը՝ ինչը կրկնել, ունի իր էջը։ Սխալների մշակում
| Կարգավիճակ | Տեսակ | Հաղորդագրություն | Երբ |
|---|---|---|---|
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 | Պատկեր է ուղարկվել hosted open-weight մոդելին, որը պատկերի մուտք չունի։ |
400 | invalid_request_error | <id> does not accept response_format | text.format է ուղարկվել hosted open-weight մոդելին, որը structured output չունի։ |
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. | 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. | Նույնը՝ hosted open-weight մոդելների վրա։ |
504 | api_error | upstream timed out | Hosted open-weight մոդելը streaming չունեցող պատասխանի ժամանակային սահմանից ավելի երկար է աշխատել։ Ուղարկեք այն stream-ը true սահմանելով։ |