Responses API
નવુંPOST /v1/responses સૂચનાઓ અને ઇનપુટ આઇટમ્સની યાદી લે છે અને OpenAI Responses ફોર્મેટમાં આઉટપુટ આઇટમ્સથી બનેલો response ઓબ્જેક્ટ પાછો આપે છે. તેને 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."
}' જવાબ એક response ઓબ્જેક્ટ છે. મોડેલે રીઝનિંગ કર્યું હોય તો તેનું 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 જોઈએ. કોણ લાગુ કરે છે કૉલમ એ મોડેલ્સ જણાવે છે જેમાં ફીલ્ડ જવાબ બદલે છે. હોસ્ટેડ 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. | હોસ્ટેડ 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 ની બહારની કિંમત તે શ્રેણીમાં લાવવામાં આવે છે. રિક્વેસ્ટ ચાલે ત્યાં સુધી તમારા બેલેન્સમાંથી અલગ રાખવામાં આવતી રકમ પણ આ જ છે. નીચે આઉટપુટ મર્યાદા જુઓ. | હોસ્ટેડ 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 સેમ્પલિંગ. કિંમતો 0 અને 1 ની વચ્ચે રાખવામાં આવે છે. | હોસ્ટેડ open-weight મોડેલ્સ | |
tools | array | મોડેલ જે ફંક્શન્સ કોલ કરી શકે, આ ફોર્મેટના સપાટ સ્વરૂપમાં: {"type": "function", "name", "description", "parameters"}. નીચે ટૂલ્સ જુઓ. | બધા મોડેલ્સ | |
tool_choice | string | object | auto | "auto" મોડેલને નક્કી કરવા દે છે. "required" તેને ટૂલ કોલ કરાવે છે. {"type": "function", "name": "…"} તેને તે જ ટૂલ કોલ કરાવે છે. | હોસ્ટેડ open-weight મોડેલ્સ |
reasoning | object | off, low, medium અથવા high સાથે {"effort": "…"}. બીજી કોઈપણ કિંમત 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 માં લઈ જાય છે.
ઇનપુટ આઇટમ્સ
ઇનપુટ આઇટમ કાં તો role અને content સાથેનો મેસેજ છે, અથવા ટૂલ કોલ કે તેનું પરિણામ લઈ જતી ટાઇપ કરેલી આઇટમ. 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": "…"} | અગાઉના જવાબમાં મોડેલે કરેલો ટૂલ કોલ. 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": "…"} | 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 અને ઇમેજ ઇનપુટ દર્શાવતા હોસ્ટેડ 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 અને રીઝનિંગ 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 કેશમાંથી વાંચેલા ટોકન્સ અને રીઝનિંગ પાછળ વપરાયેલા ટોકન્સ ઉમેરે છે:
{
"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: પ્રોમ્પ્ટ કેશમાંથી વાંચેલા ઇનપુટ ટોકન્સ. | હોસ્ટેડ open-weight મોડેલ્સ |
usage.output_tokens_details | object | reasoning_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 ફેમિલી |
આઉટપુટ આઇટમ્સ
| આઇટમ | વર્ણન |
|---|---|
{"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 SDKs મેસેજનો ટેક્સ્ટ તમારા માટે response.output_text માં જોડી આપે છે.
Streaming
server-sent events માટે stream ને true કરો. દરેક ફ્રેમમાં ઇવેન્ટના નામ સાથેની event: લાઇન અને JSON ઓબ્જેક્ટ સાથેની data: લાઇન હોય છે; ઓબ્જેક્ટ type માં નામ ફરીથી આપે છે. deltas ને તેમની આઇટમ સાથે 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 | કોલના arguments, એક જ delta માં પૂરા. |
response.function_call_arguments.done | output_index, arguments | એ જ arguments, arguments તરીકે. |
response.output_item.done | output_index, item | પૂર્ણ થયેલી function_call આઇટમ. |
response.completed | response | સફળતામાં હંમેશાં છેલ્લી: output અને usage સાથેનો આખો response ઓબ્જેક્ટ. |
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 હોય છે.
હોસ્ટેડ 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 schema સામાન્ય JSON Schema કીવર્ડ્સ સુધી ઘટાડવામાં આવે છે: oneOf ને anyOf તરીકે વાંચવામાં આવે છે, અને $ref, additionalProperties, const, default અને title જેવા કીવર્ડ્સ મોડેલને આપવામાં આવતા નથી.
tool_choice ની કિંમતો required અને નામ આપેલું ફંક્શન હોસ્ટેડ open-weight મોડેલ્સ લાગુ કરે છે.
ટૂલ લૂપનું પૂરું વર્ણન તેના પોતાના પેજ પર છે. ફંક્શન કોલિંગ
સ્ટ્રક્ચર્ડ આઉટપુટ
આ ફોર્મેટ સ્ટ્રક્ચર્ડ આઉટપુટને text.format તરીકે લખે છે. schema સીધું format માં, name અને strict ની બાજુમાં હોય છે, Chat Completions ની જેમ json_schema સભ્ય હેઠળ નહીં.
{"type": "json_object"}કોઈ પણ JSON ઓબ્જેક્ટ માગે છે.{"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 ભાગમાં ટેક્સ્ટ તરીકે આવે છે; તેને જાતે પાર્સ કરો. સ્ટ્રક્ચર્ડ આઉટપુટ વિનાનું હોસ્ટેડ open-weight મોડેલ 400 પાછું આપે છે.
{"city": "Lisbon", "date": "2027-05-12"} કયું મોડેલ કયું સ્વરૂપ લે છે તે તેના પોતાના પેજ પર આપેલું છે. રચિત આઉટપુટ્સ
Reasoning
રીઝનિંગ કરતું મોડેલ તેનું રીઝનિંગ મેસેજ પહેલાં reasoning પ્રકારની આઉટપુટ આઇટમ તરીકે પાછું આપે છે. સ્ટ્રીમમાં તે response.reasoning_summary_text.delta ઇવેન્ટ્સ તરીકે આવે છે.
હોસ્ટેડ open-weight મોડેલ્સ reasoning.effort લાગુ કરે છે: off, low, medium અથવા high, અને તમે કંઈ ન મોકલો તો high. off હોય તો રીઝનિંગ આઇટમ પાછી આવતી નથી. તેને ઓબ્જેક્ટ તરીકે મોકલો; આ એન્ડપોઇન્ટ પર ફક્ત સ્ટ્રિંગ વાંચવામાં આવતી નથી.
effort નું વર્ણન તેમના પોતાના પેજ પર છે. Reasoning effort
આઉટપુટ મર્યાદા
તમે max_output_tokens ન મોકલો ત્યારે તે 4,096 છે. રિક્વેસ્ટ શરૂ થાય ત્યારે તમારા બેલેન્સમાંથી અલગ રખાતા ટોકન્સની સંખ્યા તે છે; જવાબ પૂરો થાય ત્યારે તે રકમ રિક્વેસ્ટે વાપરેલી રકમથી બદલાય છે. તમારા બાકી બેલેન્સમાં ન સમાતી કિંમત 429 Quota exceeded પાછું આપે છે.
તે shannon-1.6-*, shannon-2-* અને shannon-coder-1 પર જવાબની લંબાઈ, અને હોસ્ટેડ open-weight મોડેલ્સ પર જવાબ ટેક્સ્ટની લંબાઈ મર્યાદિત કરે છે.
આ એન્ડપોઇન્ટ પર shannon-coder-1 અન્ય દરેક મોડેલની જેમ તમારા બેલેન્સના ટોકન્સમાં ચાર્જ થાય છે.
રિક્વેસ્ટ બોડી 32 MiB સુધીનો હોઈ શકે. મર્યાદાઓ અને બેલેન્સ
એરર્સ
એરર્સ OpenAI એરર બોડી વાપરે છે: type અને message સાથેનો error ઓબ્જેક્ટ; કેટલાક code અને કિંમત null સાથે 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 માં કોઈ user ટેક્સ્ટ નથી. |
400 | invalid_request_error | <id> does not accept image input | ઇમેજ ઇનપુટ વિનાના હોસ્ટેડ open-weight મોડેલને ઇમેજ મોકલવામાં આવી. |
400 | invalid_request_error | <id> does not accept response_format | સ્ટ્રક્ચર્ડ આઉટપુટ વિનાના હોસ્ટેડ open-weight મોડેલને 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. | 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 સેટ કરીને મોકલો. |