Responses API
නවPOST /v1/responses උපදෙස් සහ input items ලැයිස්තුවක් ගෙන OpenAI Responses format එකෙන් output items වලින් සැදුම්ලත් response object එකක් ආපසු දෙයි. එය OpenAI SDK එකේ responses API එක සමඟත්, Codex CLI වැනි එය මත ගොඩනඟා ඇති මෙවලම් සමඟත් භාවිතා කරන්න. Endpoint එක state තබා නොගනී: සෑම ඉල්ලීමක්ම සමඟ සම්පූර්ණ සංවාදය යවන්න.
POST https://api.shannon-ai.com/v1/responses
කුඩාම ඉල්ලීම යනු model id එකක් සහ පෙළක් වේ. ඔබ ඉල්ලන්නේ නැතිනම් පිළිතුර stream නොකෙරේ.
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 object එකකි. Model එක තර්ක කළ විට, එහි 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
}
} ඉල්ලීම් fields
ඉල්ලීමකට අවශ්ය වන්නේ model සහ input ය. Applied by තීරුවේ field එකක් පිළිතුර වෙනස් කරන models නම් කර ඇත. අපගේ සේවාදායකවල ධාවනය වන open-weight models යනු model ලැයිස්තුවේ ඇති id දොළහයි; Shannon 3 පවුල යනු shannon-3, shannon-3-pro, shannon-3.1 සහ shannon-3.1-pro ය. Models සහ මිල ගණන්
| Field | වර්ගය | පෙරනිමිය | විස්තරය | ක්රියාත්මක කරන්නේ |
|---|---|---|---|---|
model | string | අවශ්යයි. Model ලැයිස්තුවේ id එකක්. ගැලපීම case-sensitive නොවේ. නැති හෝ ප්රකාශිත නොවන id එකකට 400 unknown model ලැබේ. | සියලු models | |
input | string | array | එක user පණිවිඩයක් ලෙස කියවන string එකක්, නැතහොත් input items array එකක්. පහත Input items බලන්න. | සියලු models | |
instructions | string | Model එක සඳහා උපදෙස්, මෙම format එකේ system prompt එක. | අපගේ සේවාදායකවල ධාවනය වන open-weight models, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true පිළිතුර server-sent events ලෙස යවයි. පහත Streaming බලන්න. | සියලු models |
max_output_tokens | integer | 4096 | පිළිතුරේ ඉහළ සීමාව, tokens වලින්. 1 සිට 65,536 දක්වා පරාසයෙන් පිටත අගයක් එම පරාසයට ගෙන එනු ලැබේ. ඉල්ලීම ධාවනය වන අතරතුර ඔබේ ශේෂයෙන් වෙන් කර තබන ප්රමාණය ද එයයි. පහත Output limit බලන්න. | අපගේ සේවාදායකවල ධාවනය වන open-weight models, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | Sampling temperature. අපගේ සේවාදායකවල ධාවනය වන open-weight models මත අගයන් 0 සහ 2 අතර තබා ගනී. | අපගේ සේවාදායකවල ධාවනය වන open-weight models; stream නොකළ පිළිතුරු වල shannon-1.6-*, shannon-2-* සහ shannon-coder-1 | |
top_p | number | Nucleus sampling. අගයන් 0 සහ 1 අතර තබා ගනී. | අපගේ සේවාදායකවල ධාවනය වන open-weight models | |
tools | array | Model එකට call කළ හැකි functions, මෙම format එකේ පැතලි ආකාරයෙන්: {"type": "function", "name", "description", "parameters"}. පහත Tools බලන්න. | සියලු models | |
tool_choice | string | object | auto | "auto" model එකට තීරණය කිරීමට ඉඩ දෙයි. "required" tool එකක් call කිරීමට සලස්වයි. {"type": "function", "name": "…"} එම tool එක call කිරීමට සලස්වයි. | අපගේ සේවාදායකවල ධාවනය වන open-weight models |
reasoning | object | off, low, medium හෝ high සහිත {"effort": "…"}. වෙනත් ඕනෑම අගයකට 400 ලැබේ. | අපගේ සේවාදායකවල ධාවනය වන open-weight models | |
text | object | {"format": {…}} JSON පිළිතුරක් ඉල්ලයි. පහත ව්යුහගත output බලන්න. | සියලු Shannon tiers; අපගේ සේවාදායකවල ධාවනය වන open-weight models id එකකට ලැයිස්තුගත කළ පරිදි |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user සහ prompt_cache_key දැනට ඇති client code වෙනසක් නොමැතිව ක්රියා කිරීම සඳහා පිළිගනී. ඒවා පිළිතුර වෙනස් නොකරයි. සංවාදයක් ගබඩා නොකරන බැවින්, පසු ඉල්ලීමක පෙර turns input හි රැගෙන යයි.
Input items
Input item එකක් යනු role එකක් සහ content එකක් සහිත පණිවිඩයක්, නැතහොත් tool call එකක් හෝ එහි ප්රතිඵලයක් රැගෙන යන type සහිත item එකකි. content යනු string එකක් හෝ කොටස් array එකකි.
| Item | විස්තරය | ක්රියාත්මක කරන්නේ |
|---|---|---|
{"role": "user", "content": …} | ඔබ අසන දේ. content යනු string එකක්, නැතහොත් input_text සහ input_image කොටස්. | සියලු models |
{"role": "assistant", "content": …} | Model එකේ පෙර පිළිතුරක්. content යනු string එකක්, නැතහොත් output_text කොටස්. | සියලු models |
{"role": "system", "content": …}{"role": "developer", "content": …} | සංවාදය තුළ උපදෙස්. | අපගේ සේවාදායකවල ධාවනය වන open-weight models |
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} | පෙර පිළිතුරක model එක කළ tool call එකක්. arguments යනු JSON string එකකි. | සියලු models |
{"type": "function_call_output", "call_id": "…", "output": "…"} | එම call එකේ ප්රතිඵලය. call_id call එකේ id එක වන අතර output ප්රතිඵලය string එකක් ලෙස. | සියලු models |
උපදෙස් instructions field එකේ තබන්න. Shannon 3 පවුලේ id එකක් සමඟ, අනිවාර්යයෙන් පිළිපැදිය යුතු උපදෙස් user පණිවිඩයට ඇතුළත් කරන්න.
පිළිතුරක output හි items එලෙසම input වෙත ආපසු යැවිය හැක: message සහ function_call items කියවයි, reasoning items මඟ හරියි.
අන්තර්ගත කොටස්
| කොටස | විස්තරය | ලබා ගත හැක්කේ |
|---|---|---|
{"type": "input_text", "text": "…"} | User පණිවිඩයක පෙළ. | සියලු models |
{"type": "output_text", "text": "…"} | Assistant පණිවිඩයක පෙළ. | සියලු models |
{"type": "input_image", "image_url": "…"} | රූපයක්, base64 අන්තර්ගතය සහිත data: URL එකක් ලෙස හෝ http(s) URL එකක් ලෙස. | Shannon 3 පවුල, shannon-1.6-lite, shannon-1.6-pro, සහ රූප ආදානය ලැයිස්තුගත කරන, අපගේ සේවාදායකවල ධාවනය වන open-weight models |
{"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 tiers මත රූප සහ ගොනු කියවන්නේ input හි අවසාන user item එකෙනි. ප්රමාණ සහ සීමා වලට තමන්ගේම පිටුවක් ඇත. රූප සහ ගොනු
උපදෙස් සහ විකල්ප සහිත ඉල්ලීමක්
මෙම ඉල්ලීම උපදෙස්, input items ලෙස සංවාදයක්, output සීමාවක්, temperature එකක් සහ reasoning effort එකක් යවයි. එය ඒ සියල්ල ක්රියාත්මක කරන, අපගේ සේවාදායකවල ධාවනය වන open-weight model එකක් භාවිතා කරයි.
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 model එකක පිළිතුරේ id, object, model, created_at, status, output සහ usage ඇත. එහි usage cache එකෙන් කියවූ 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 object එක
id, object, status, output සහ usage සෑම පිළිතුරකම ඇත. ඔබේ code එක ගොඩනඟන්නේ ඒ මත වන්න.
| Field | වර්ගය | විස්තරය | යවන්නේ |
|---|---|---|---|
id | string | resp_ ට පසුව hexadecimal අක්ෂර 32ක්. | සියලු models |
object | string | සෑම විටම response. | සියලු models |
status | string | completed. Stream එකක එය මුලින් in_progress වන අතර, response.failed event එකක failed වේ. | සියලු models |
output | array | Model එක නිපදවූ පිළිවෙලට output items: reasoning, message, function_call. | සියලු models |
usage | object | input_tokens, output_tokens සහ total_tokens. | සියලු models |
usage.input_tokens_details | object | cached_tokens: prompt cache එකෙන් කියවා ගන්නා ලද input tokens ගණන. | අපගේ සේවාදායකවල ධාවනය වන open-weight models |
usage.output_tokens_details | object | reasoning_tokens: තර්කනයට වැය වූ output tokens. | අපගේ සේවාදායකවල ධාවනය වන open-weight models |
model | string | පිළිතුරු දුන් model එකේ canonical id එක. | Shannon 3 පවුල, අපගේ සේවාදායකවල ධාවනය වන open-weight models |
created_at | integer | පිළිතුරේ වේලාව, Unix තත්පරවලින්. | Shannon 3 පවුල, අපගේ සේවාදායකවල ධාවනය වන open-weight models |
instructions, tools, temperature, … | instructions, tools සහ temperature ඉල්ලීම නැවත දක්වයි. error සහ incomplete_details null වේ, metadata {} වේ, parallel_tool_calls true වේ, tool_choice auto වේ සහ top_p null වේ. | Shannon 3 පවුල |
Output items
| Item | විස්තරය |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | Model එකේ තර්කනය එක summary_text කොටසක් ලෙස. Model එක තර්ක කළ විට පමණක් ඇත. |
{"id": "msg_…", "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "…"}]} | පිළිතුර: පෙළ සහිත එක output_text කොටසක්. |
{"id": "fc_…", "type": "function_call", "call_id": "call_…", "name": "…", "arguments": "…"} | Tool call එකක්. arguments JSON string එකකි. ප්රතිඵලය එම call_id සමඟම ආපසු යවන්න. |
OpenAI SDKs පණිවිඩයේ පෙළ ඔබ වෙනුවෙන් response.output_text හි එකට සම්බන්ධ කරයි.
Streaming
Server-sent events සඳහා stream true ලෙස සකසන්න. සෑම frame එකකම event එකේ නම සහිත event: පේළියක් සහ JSON object එකක් සහිත data: පේළියක් ඇත; object එක type හි එම නම නැවත දක්වයි. Deltas ඒවායේ item එකට output_index මගින් ගළපන්න.
OpenAI SDK සමඟ, events ඒවායේ 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
}' Events පැමිණෙන්නේ මෙම පිළිවෙලටයි. තර්කනය, පණිවිඩය සහ tool calls සඳහා කණ්ඩායම් දිස්වන්නේ පිළිතුරේ ඒවා ඇති විට පමණි.
| Event | Payload | කවදාද |
|---|---|---|
response.created | response | සෑම විටම පළමුව. response.status in_progress වන අතර response.output හිස් වේ. |
response.in_progress | response | සෑම විටම දෙවනුව, එම object එකම සමඟ. |
response.output_item.added | output_index, item | තර්කනය ආරම්භ වේ: හිස් summary සහිත reasoning item එකක්. |
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 item එක. |
response.output_item.added | output_index, item | පිළිතුර ආරම්භ වේ: status in_progress සහිත සහ අන්තර්ගතයක් නැති message item එකක්. |
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 item එක, status completed සමඟ. |
response.output_item.added | output_index, item | Tool call එකක් ආරම්භ වේ: call_id, name සහ හිස් arguments සහිත function_call item එකක්. |
response.function_call_arguments.delta | output_index, delta | Call එකේ arguments, එක delta එකකින් සම්පූර්ණව. |
response.function_call_arguments.done | output_index, arguments | එම arguments ම, arguments ලෙස. |
response.output_item.done | output_index, item | අවසන් වූ function_call item එක. |
response.completed | response | සාර්ථක වන විට සෑම විටම අවසානයේ: output සහ usage සහිත සම්පූර්ණ response object එක. |
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}, …}} අසාර්ථක වන stream එකක්
Shannon tiers මත අසාර්ථක පිළිතුරක් response.completed වෙනුවට response.failed සමඟ අවසන් වේ. එහි response.status failed වන අතර response.error හි code, rate_limit_exceeded හෝ server_error, සහ message එකක් ඇත.
අපගේ සේවාදායකවල ධාවනය වන open-weight models මත අසාර්ථකත්වයක් යනු code api_error සහ message එකක් සහිත error event එකකි. response.completed තවමත් ඊට පසුව පැමිණේ.
Stream එකක response.failed හෝ error event එකක් ඇති විට එය අසාර්ථක ලෙස සලකා, ඉල්ලීම නැවත යවන්න.
Tools
Tool එකක් යනු ඔබේ code එක ක්රියාත්මක කරන function එකකි. එය tools හි විස්තර කරන්න; model එකට එය අවශ්ය වූ විට, පිළිතුරේ පණිවිඩය වෙනුවට හෝ ඒ අසල function_call item එකක් ඇත.
tools හි tool අර්ථ දැක්වීමක්:
[
{
"type": "function",
"name": "get_weather",
"description": "Current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
]
}
}
] එය call කරන පිළිතුරක output:
[
{
"id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"type": "function_call",
"name": "get_weather",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"arguments": "{\"city\":\"Paris\"}"
}
] Function එක ක්රියාත්මක කර, ඉන්පසු call එක සහ එහි ප්රතිඵලය 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 type එකේ tools පමණි. shannon-1.6-*, shannon-2-* සහ shannon-coder-1 මත parameters schema එක පොදු JSON Schema මූල පද දක්වා අඩු කෙරේ: oneOf anyOf ලෙස කියවන අතර, $ref, additionalProperties, const, default සහ title වැනි මූල පද model එකට ලබා නොදේ.
tool_choice අගයන් required සහ නම් කළ function එකක් ක්රියාත්මක කරන්නේ අපගේ සේවාදායකවල ධාවනය වන open-weight models ය.
Tool loop එක සම්පූර්ණයෙන් තමන්ගේම පිටුවේ විස්තර කර ඇත. කාර්ය කැඳවීම
ව්යුහගත output
මෙම format එක ව්යුහගත output text.format ලෙස ලියයි. Schema එක Chat Completions හි මෙන් json_schema member එක යටතේ නොව, name සහ strict අසල, format තුළම කෙළින්ම තබා ඇත.
{"type": "json_object"}ඕනෑම JSON object එකක් ඉල්ලයි.{"type": "json_schema", "name", "schema", "strict"}ඔබේ schema එක අනුගමනය කරන 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 කරන්න. ව්යුහගත output නැති, අපගේ සේවාදායකවල ධාවනය වන open-weight model එකක් 400 ආපසු දෙයි.
{"city": "Lisbon", "date": "2027-05-12"} කුමන model එක කුමන ආකාරය පිළිගනීද යන්න එහිම පිටුවේ ලැයිස්තුගත කර ඇත. ව්යුහගත ප්රතිදාන
තර්කනය
තර්ක කරන model එකක් එහි තර්කනය පණිවිඩයට පෙර reasoning type එකේ output item එකක් ලෙස ආපසු දෙයි. Stream එකක එය response.reasoning_summary_text.delta events ලෙස පැමිණේ.
අපගේ සේවාදායකවල ධාවනය වන open-weight models reasoning.effort ක්රියාත්මක කරයි: off, low, medium හෝ high, ඔබ කිසිවක් නොයවන විට high. off reasoning item එකක් ආපසු නොදෙයි. එය object එකක් ලෙස යවන්න; මෙම endpoint හි හුදෙක් string එකක් කියවන්නේ නැත.
Efforts ගැන තමන්ගේම පිටුවේ විස්තර කර ඇත. Reasoning effort
Output සීමාව
ඔබ එය නොයවන විට max_output_tokens 4,096 වේ. ඉල්ලීම ආරම්භ වන විට ඔබේ ශේෂයෙන් වෙන් කර තබන tokens ගණන එයයි; පිළිතුර සම්පූර්ණ වූ විට, එම ප්රමාණය ඉල්ලීම භාවිතා කළ ප්රමාණයෙන් ප්රතිස්ථාපනය වේ. ඔබේ ඉතිරි ශේෂයට නොගැළපෙන අගයකට 429 Quota exceeded ලැබේ.
එය shannon-1.6-*, shannon-2-* සහ shannon-coder-1 මත පිළිතුරේ දිග ද, අපගේ සේවාදායකවල ධාවනය වන open-weight models මත පිළිතුරේ පෙළේ දිග ද සීමා කරයි.
මෙම endpoint හි shannon-coder-1 වෙනත් සෑම model එකක් මෙන් ඔබේ ශේෂයෙන් tokens වලින් අය කෙරේ.
ඉල්ලීමේ body එක 32 MiB දක්වා විය හැක. සීමා සහ ශේෂය
දෝෂ
දෝෂ OpenAI දෝෂ body එක භාවිතා කරයි: type සහ message සහිත error object එකක්; සමහරක null අගය සහිත code සහ param ද ඇත. වගුවේ මෙම endpoint එක බොහෝ විට ආපසු දෙන දේ ලැයිස්තුගත කර ඇත. නැවත උත්සාහ කළ යුතු දේ සහිත සම්පූර්ණ ලැයිස්තුවට තමන්ගේම පිටුවක් ඇත. දෝෂ
| Status | Type | පණිවිඩය | කවදාද |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | API key එකක් යවා නැත, නැතහොත් key එක නොදන්නා හෝ අවලංගු කළ එකකි. |
400 | invalid_request_error | unknown model: <id> | model නැත, නැතහොත් ප්රකාශිත id එකක් නොවේ. |
400 | invalid_request_error | No user message provided. | Shannon tiers: input හි user පෙළක් නැත. |
400 | invalid_request_error | <id> does not accept image input | රූප ආදානය නැති, අපගේ සේවාදායකවල ධාවනය වන open-weight model එකකට රූපයක් යවා ඇත. |
400 | invalid_request_error | <id> does not accept response_format | ව්යුහගත output නැති, අපගේ සේවාදායකවල ධාවනය වන open-weight model එකකට 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: … | Body එක වලංගු JSON නමුත් field එකක type එක වැරදිය. |
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. | Model එක පිළිතුරක් නිපදවූයේ නැත. ඉල්ලීම නැවත යවන්න. |
502 | api_error | The model backend failed to answer. Please retry. | අපගේ සේවාදායකවල ධාවනය වන open-weight models වලද එයම. |
504 | api_error | upstream timed out | අපගේ සේවාදායකවල ධාවනය වන open-weight model එකක් stream නොකළ පිළිතුරක කාල සීමාවට වඩා වැඩි කාලයක් ගත කළේය. එය stream true ලෙස සකසා යවන්න. |