API Responses
NovumPOST /v1/responses instructiones et indicem input items accipit et objectum response ex output items factum reddit, in forma OpenAI Responses. Utere eo cum API responses SDK OpenAI et cum instrumentis in ea aedificatis, ut Codex CLI. Endpoint nullum statum servat: mitte totam conversationem cum omni petitione.
POST https://api.shannon-ai.com/v1/responses
Minima petitio est id modelli et textus. Responsio non streamed est nisi eam petis.
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."
}' Responsio est objectum response. Eius output ratiocinationem, cum modellum ratiocinatum est, et nuntium tenet:
{
"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
}
} Campi petitionis
model et input sunt quibus petitio eget. Columna Applied by modellos nominat in quibus campus responsionem mutat. Modelli open-weight hosted sunt duodecim ids indicis modellorum; familia Shannon 3 est shannon-3, shannon-3-pro, shannon-3.1 et shannon-3.1-pro. Modella et pretia
| Campus | Genus | Default | Descriptio | Applicatur a |
|---|---|---|---|---|
model | string | Necessarium. Id ex indice modellorum. Congruentia litteras maiusculas et minusculas non distinguit. Id deest vel non publicatum 400 unknown model reddit. | Omnia modelli | |
input | string | array | String, qui ut unus nuntius user legitur, aut array elementorum input. Vide Input items infra. | Omnia modelli | |
instructions | string | Instructiones pro modello, system prompt huius formae. | Modelli open-weight hosted, shannon-1.6-*, shannon-2-*, shannon-coder-1 | |
stream | boolean | false | true responsionem ut server-sent events mittit. Vide Streaming infra. | Omnia modelli |
max_output_tokens | integer | 4096 | Limes superior responsionis, in tokens. Valor extra 1 ad 65,536 in illud range movetur. Est etiam quantitas de saldo tuo seposita dum petitio currit. Vide Output limit infra. | Modelli open-weight hosted, shannon-1.6-*, shannon-2-*, shannon-coder-1 |
temperature | number | Temperatura sampling. In modellis open-weight hosted valores inter 0 et 2 servantur. | Modelli open-weight hosted; shannon-1.6-*, shannon-2-* et shannon-coder-1 in responsionibus non streamed | |
top_p | number | Nucleus sampling. Valores inter 0 et 1 servantur. | Modelli open-weight hosted | |
tools | array | Functiones quas modellum vocare potest, in forma plana huius formae: {"type": "function", "name", "description", "parameters"}. Vide Tools infra. | Omnia modelli | |
tool_choice | string | object | auto | "auto" modello decernere permittit. "required" efficit ut tool vocet. {"type": "function", "name": "…"} efficit ut illud tool vocet. | Modelli open-weight hosted |
reasoning | object | {"effort": "…"} cum off, low, medium vel high. Quivis alius valor 400 reddit. | Modelli open-weight hosted | |
text | object | {"format": {…}} responsionem JSON petit. Vide Structured output infra. | Omnes gradus Shannon; modelli open-weight hosted ut per id enumerantur |
previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user et prompt_cache_key accipiuntur ut codex clientis exstans sine mutatione currat. Responsionem non mutant. Quia nulla conversatio servatur, petitio sequens turnos priores in input fert.
Input items
Input item est aut nuntius, cum role et content, aut elementum typatum quod vocationem tool vel eventum eius fert. content est string aut array partium.
| Elementum | Descriptio | Applicatur a |
|---|---|---|
{"role": "user", "content": …} | Quod petis. content est string, aut partes input_text et input_image. | Omnia modelli |
{"role": "assistant", "content": …} | Responsio prior modelli. content est string, aut partes output_text. | Omnia modelli |
{"role": "system", "content": …}{"role": "developer", "content": …} | Instructiones intra conversationem. | Modelli open-weight hosted |
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} | Vocatio tool quam modellum in responsione priore fecit. arguments est JSON string. | Omnia modelli |
{"type": "function_call_output", "call_id": "…", "output": "…"} | Eventus illius vocationis. call_id est id vocationis et output eventus ut string. | Omnia modelli |
Pone instructiones in campo instructions. Cum id familiae Shannon 3, pone instructiones quae tenendae sunt in nuntio user.
Elementa output responsionis in input ut sunt redire possunt: elementa message et function_call leguntur, elementa reasoning praetereuntur.
Partes contenti
| Pars | Descriptio | Praesto in |
|---|---|---|
{"type": "input_text", "text": "…"} | Textus nuntii user. | Omnia modelli |
{"type": "output_text", "text": "…"} | Textus nuntii assistentis. | Omnia modelli |
{"type": "input_image", "image_url": "…"} | Imago, ut data: URL cum contento base64 aut ut URL http(s). | Familia Shannon 3, shannon-1.6-lite, shannon-1.6-pro, et modelli open-weight hosted qui input imaginis enumerant |
{"type": "input_file", "file_data": "data:application/pdf;base64,…"} | Documentum (PDF, Word, PowerPoint vel Excel): file_data tenet data: URL, vel file_url URL http(s). | Familia Shannon 3 |
In gradibus Shannon imagines et fasciculi ex ultimo elemento user ipsius input leguntur. Magnitudines et limites paginam propriam habent. Imagines et fasciculi
Petitio cum instructionibus et optionibus
Haec petitio instructiones, conversationem ut input items, limitem outputi, temperaturam et effort ratiocinationis mittit. Modellum open-weight hosted utitur, quod omnia applicat.
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"}
}' Responsio modelli open-weight hosted habet id, object, model, created_at, status, output et usage. Eius usage tokens e cache lectos et tokens in ratiocinationem impensos addit:
{
"usage": {
"input_tokens": 58,
"input_tokens_details": {
"cached_tokens": 0
},
"output_tokens": 67,
"output_tokens_details": {
"reasoning_tokens": 19
},
"total_tokens": 125
}
} Objectum response
id, object, status, output et usage in omni responsione adsunt. Codicem tuum in iis funda.
| Campus | Genus | Descriptio | Missum a |
|---|---|---|---|
id | string | resp_ quod 32 notae hexadecimales sequuntur. | Omnia modelli |
object | string | Semper response. | Omnia modelli |
status | string | completed. In stream primum est in_progress, et failed in eventu response.failed. | Omnia modelli |
output | array | Output items ordine quo modellum eos produxit: reasoning, message, function_call. | Omnia modelli |
usage | object | input_tokens, output_tokens et total_tokens. | Omnia modelli |
usage.input_tokens_details | object | cached_tokens: tokens input e prompt cache lecti. | Modelli open-weight hosted |
usage.output_tokens_details | object | reasoning_tokens: tokens output in ratiocinationem impensi. | Modelli open-weight hosted |
model | string | Id canonicum modelli quod respondit. | Familia Shannon 3, modelli open-weight hosted |
created_at | integer | Tempus responsionis, in secundis Unix. | Familia Shannon 3, modelli open-weight hosted |
instructions, tools, temperature, … | instructions, tools et temperature petitionem repetunt. error et incomplete_details sunt null, metadata est {}, parallel_tool_calls est true, tool_choice est auto et top_p est null. | Familia Shannon 3 |
Output items
| Elementum | Descriptio |
|---|---|
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} | Ratiocinatio modelli ut una pars summary_text. Adest tantum cum modellum ratiocinatum est. |
{"id": "msg_…", "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "…"}]} | Responsio: una pars output_text cum textu. |
{"id": "fc_…", "type": "function_call", "call_id": "call_…", "name": "…", "arguments": "…"} | Vocatio tool. arguments est JSON string. Remitte eventum cum eodem call_id. |
SDK OpenAI textum nuntii pro te in response.output_text iungunt.
Streaming
Pone stream ad true pro server-sent events. Quisque frame lineam event: cum nomine eventus et lineam data: cum objecto JSON habet; objectum nomen in type repetit. Coniunge deltas cum suo elemento per output_index.
Cum SDK OpenAI, lege eventus per type eorum:
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
}' Eventus hoc ordine adveniunt. Greges pro ratiocinatione, nuntio et vocationibus tool apparent tantum cum responsio eos habet.
| Eventus | Payload | Quando |
|---|---|---|
response.created | response | Semper primum. response.status est in_progress et response.output vacuum est. |
response.in_progress | response | Semper secundum, cum eodem objecto. |
response.output_item.added | output_index, item | Ratiocinatio incipit: elementum reasoning cum summary vacuo. |
response.reasoning_summary_text.delta | output_index, summary_index, delta | Pars ratiocinationis. |
response.reasoning_summary_text.done | output_index, summary_index, text | Ratiocinatio completa est: totus eius text. |
response.output_item.done | output_index, item | Elementum reasoning finitum. |
response.output_item.added | output_index, item | Responsio incipit: elementum message cum statu in_progress et sine contento. |
response.content_part.added | output_index, content_index, part | Pars output_text vacua aperitur. |
response.output_text.delta | output_index, content_index, delta | Pars responsionis. |
response.output_text.done | output_index, content_index, text | Responsio completa est: totus eius text. |
response.content_part.done | output_index, content_index, part | Pars output_text finita. |
response.output_item.done | output_index, item | Elementum message finitum, cum statu completed. |
response.output_item.added | output_index, item | Vocatio tool incipit: elementum function_call cum call_id, name et arguments vacuis. |
response.function_call_arguments.delta | output_index, delta | Argumenta vocationis, completa in uno delta. |
response.function_call_arguments.done | output_index, arguments | Eadem argumenta, ut arguments. |
response.output_item.done | output_index, item | Elementum function_call finitum. |
response.completed | response | Semper ultimum in successu: totum objectum response cum output et 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}, …}} Stream qui deficit
In gradibus Shannon responsio defecta cum response.failed finit loco response.completed. Eius response.status est failed et response.error tenet code, rate_limit_exceeded vel server_error, et message.
In modellis open-weight hosted defectus est eventus error cum code api_error et message. response.completed tamen eum sequitur.
Stream ut defectum tracta cum response.failed vel eventum error tenet, et mitte petitionem iterum.
Tools
Tool est functio quam codex tuus exsequitur. Describe eam in tools; cum modellum eam vult, responsio elementum function_call loco nuntii, vel iuxta nuntium, tenet.
Definitio tool in tools:
[
{
"type": "function",
"name": "get_weather",
"description": "Current weather for a city.",
"parameters": {
"type": "object",
"properties": {
"city": {
"type": "string"
}
},
"required": [
"city"
]
}
}
] output responsionis quae eam vocat:
[
{
"id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"type": "function_call",
"name": "get_weather",
"call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
"arguments": "{\"city\":\"Paris\"}"
}
] Exsequere functionem, deinde mitte petitionem iterum cum vocatione et eventu eius ad input additis:
[
{
"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\"}"
}
] Tantum tools typi function leguntur. In shannon-1.6-*, shannon-2-* et shannon-coder-1 schema parameters ad verba clavis communia JSON Schema reducitur: oneOf ut anyOf legitur, et verba clavis ut $ref, additionalProperties, const, default et title ad modellum non transmittuntur.
Valores tool_choice required et functio nominata a modellis open-weight hosted applicantur.
Circulus tool in pagina propria plene describitur. Vocatio functionum
Output structuratus
Haec forma output structuratum ut text.format scribit. Schema directe in format sedet, iuxta name et strict, non sub membro json_schema ut in Chat Completions.
{"type": "json_object"}quodvis objectum JSON petit.{"type": "json_schema", "name", "schema", "strict"}JSON quod schema tuum sequitur petit.strictesttruecum omittis.
{
"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 ut textus in parte output_text nuntii advenit; ipse analyse. Modellum open-weight hosted sine output structurato 400 reddit.
{"city": "Lisbon", "date": "2027-05-12"} Quod modellum quam formam accipiat in pagina propria enumeratur. Exitus structi
Ratiocinatio
Modellum quod ratiocinatur ratiocinationem suam ut output item typi reasoning reddit, ante nuntium. In stream ut eventus response.reasoning_summary_text.delta advenit.
Modelli open-weight hosted reasoning.effort applicant: off, low, medium vel high, cum high si nihil mittis. off nullum elementum reasoning reddit. Mitte eum ut objectum; string nudus in hoc endpoint non legitur.
Gradus effort in pagina propria describuntur. Conatus ratiocinationis
Limes outputi
max_output_tokens est 4,096 cum eum non mittis. Est numerus tokenum de saldo tuo seposita cum petitio incipit; cum responsio completa est, illa quantitas eo quod petitio usa est substituitur. Valor qui in saldum tuum reliquum non capitur 429 Quota exceeded reddit.
Longitudinem responsionis in shannon-1.6-*, shannon-2-* et shannon-coder-1 limitat, et longitudinem textus responsionis in modellis open-weight hosted.
In hoc endpoint shannon-coder-1 in tokens de saldo tuo computatur, sicut omne aliud modellum.
Corpus petitionis ad 32 MiB esse potest. Limites et saldum
Errores
Errores corpus erroris OpenAI utuntur: objectum error cum type et message; quidam etiam code et param cum valore null ferunt. Tabula enumerat quae hoc endpoint saepissime reddit. Index plenus, cum eo quod iterandum sit, paginam propriam habet. Tractatio errorum
| Status | Type | Nuntius | Quando |
|---|---|---|---|
401 | authentication_error | Missing authenticationInvalid API key | Nulla clavis API missa est, aut clavis ignota vel revocata est. |
400 | invalid_request_error | unknown model: <id> | model deest aut non est id publicatum. |
400 | invalid_request_error | No user message provided. | Gradus Shannon: input nullum textum user tenet. |
400 | invalid_request_error | <id> does not accept image input | Imago ad modellum open-weight hosted sine input imaginis missa est. |
400 | invalid_request_error | <id> does not accept response_format | text.format ad modellum open-weight hosted sine output structurato missum est. |
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | reasoning.effort valorem extra indicem tenet. |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | Corpus est JSON validum sed campus typum falsum habet. |
429 | rate_limit_error | Quota exceeded. Upgrade your plan at shannon-ai.com/plan | max_output_tokens maior est quam quod de saldo tuo superest. |
429 | rate_limit_error | Too many requests. Retry in <n>s. | Defensio inundationis: plus quam 120 petitiones in uno minuto in ratione tua. |
500 | api_error | The model backend failed to answer. Please retry. | Modellum responsionem non produxit. Mitte petitionem iterum. |
502 | api_error | The model backend failed to answer. Please retry. | Idem, in modellis open-weight hosted. |
504 | api_error | upstream timed out | Modellum open-weight hosted diutius cepit quam terminus responsionis non streamed. Mitte eam cum stream ad true posito. |