Simira kuzvirimo
Responses API

Responses API

POST /v1/responses inotora instructions ne-list ye-input items ndokudzosa response object inoumbwa ne-output items, mu-OpenAI Responses format. Shandisa ne-responses API ye-OpenAI SDK ne-tools dzakavakirwa pairi, sa-Codex CLI. Endpoint haichengeti state: tumira hurukuro yose ne-request imwe neimwe.

POST https://api.shannon-ai.com/v1/responses

Request diki kwazvo i-model id ne-text. Mhinduro haisi streamed kunze kwekunge wainokumbira.

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)

Mhinduro i-response object. output yayo ine reasoning, kana model yakafunga, ne-message:

200 JSON
{
  "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
  }
}

Minda yechikumbiro

model ne-input ndizvo zvinodiwa ne-request. Column inonzi Inoshandiswa ne inotaura ma-model apo field inochinja mhinduro. Hosted open-weight models ndiwo ma-id makumi matatu nematatu e-model list; mhuri ye-Shannon 3 ndi-shannon-3, shannon-3-pro, shannon-3.1 ne-shannon-3.1-pro. Ma-model nemitengo

Munda Mhando Zvakasarudzwa Tsananguro Inoshandiswa ne
model string Inodiwa. Id kubva mu-model list. Kuenzanisa hakuteereri mavara makuru nemadiki. Id isipo kana isiri published inodzosa 400 unknown model. Ma-model ese
input string | array String, inoverengwa se-user message imwe, kana array ye-input items. Tarisa Input items pazasi. Ma-model ese
instructions string Mirayiro ye-model, system prompt ye-format iyi. Ma-model open-weight anobatwa nesu, shannon-1.6-*, shannon-2-*, shannon-coder-1
stream boolean false true inotumira mhinduro se-server-sent events. Tarisa Streaming pazasi. Ma-model ese
max_output_tokens integer 4096 Muganho wepamusoro wemhinduro, mu-tokens. Value iri kunze kwe-1 kusvika 65,536 inoendeswa mu-range iyoyo. Ndiyo zvakare huwandu hunochengetwa mu-balance yako request ichiri kushanda. Tarisa Output limit pazasi. Ma-model open-weight anobatwa nesu, shannon-1.6-*, shannon-2-*, shannon-coder-1
temperature number Sampling temperature. Pa-hosted open-weight models values dzinochengetwa pakati pe-0 ne-2. Hosted open-weight models; shannon-1.6-*, shannon-2-* ne-shannon-coder-1 pa-replies dzisiri streamed
top_p number Nucleus sampling. Values dzinochengetwa pakati pe-0 ne-1. Ma-model open-weight anobatwa nesu
tools array Functions dzinogona kudanidzirwa ne-model, mu-flat form ye-format iyi: {"type": "function", "name", "description", "parameters"}. Tarisa Tools pazasi. Ma-model ese
tool_choice string | object auto "auto" inosiya model ichisarudza. "required" inoiita kuti idanidzire tool. {"type": "function", "name": "…"} inoiita kuti idanidzire tool iyoyo. Ma-model open-weight anobatwa nesu
reasoning object {"effort": "…"} ne-off, low, medium kana high. Chero value imwe inodzosa 400. Ma-model open-weight anobatwa nesu
text object {"format": {…}} inokumbira mhinduro ye-JSON. Tarisa Structured output pazasi. Shannon tiers dzese; hosted open-weight models sezvakanyorwa pa-id imwe neimwe

previous_response_id, store, metadata, parallel_tool_calls, truncation, include, user ne-prompt_cache_key dzinogamuchirwa kuti client code iripo ishande isina kuchinjwa. Hadzichinji mhinduro. Nekuti hapana hurukuro inochengetwa, request inotevera inotakura ma-turn ekare mu-input.

Zvinhu zvekupinza

Input item i-message, ine role ne-content, kana item ine type inotakura tool call kana mhedzisiro yayo. content i-string kana array ye-parts.

Chinhu Tsananguro Inoshandiswa ne
{"role": "user", "content": …} Zvaunobvunza. content i-string, kana input_text ne-input_image parts. Ma-model ese
{"role": "assistant", "content": …} Mhinduro yekare ye-model. content i-string, kana output_text parts. Ma-model ese
{"role": "system", "content": …}
{"role": "developer", "content": …}
Mirayiro mukati mehurukuro. Ma-model open-weight anobatwa nesu
{"type": "function_call", "call_id": "…", "name": "…", "arguments": "…"} Tool call yakaitwa ne-model mumhinduro yekare. arguments i-JSON string. Ma-model ese
{"type": "function_call_output", "call_id": "…", "output": "…"} Mhedzisiro ye-call iyoyo. call_id i-id ye-call uye output mhedzisiro se-string. Ma-model ese

Isa mirayiro mu-instructions field. Ne-id yemhuri ye-Shannon 3, isa mirayiro inofanira kuchengetwa mu-user message.

Items dze-output yemhinduro dzinogona kudzokera mu-input sezvadziri: message ne-function_call items dzinoverengwa, reasoning items dzinosiiwa.

Zvikamu zvemukati

Chikamu Tsananguro Inowanikwa pa
{"type": "input_text", "text": "…"} Text ye-user message. Ma-model ese
{"type": "output_text", "text": "…"} Text ye-assistant message. Ma-model ese
{"type": "input_image", "image_url": "…"} Mufananidzo, se-data: URL ine base64 content kana se-http(s) URL. Mhuri ye-Shannon 3, shannon-1.6-lite, shannon-1.6-pro, ne-hosted open-weight models dzinoratidza image input
{"type": "input_file", "file_data": "data:application/pdf;base64,…"} Document (PDF, Word, PowerPoint kana Excel): file_data ine data: URL, kana file_url ine http(s) URL. Mhuri ye-Shannon 3, ne-hosted open-weight models (zvinotumirwa inline, kwete nge-URL)

Pa-Shannon tiers mifananidzo ne-files zvinoverengwa kubva ku-user item yekupedzisira ye-input. Sizes ne-limits zvine peji razvo. Mifananidzo ne-files

Request ine instructions ne-options

Request iyi inotumira instructions, hurukuro se-input items, output limit, temperature ne-reasoning effort. Inoshandisa hosted open-weight model, inoshandisa zvese izvi.

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-uncensored-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)

Mhinduro ye-hosted open-weight model ine id, object, model, created_at, status, output ne-usage. usage yayo inowedzera tokens dzakaverengwa kubva ku-cache ne-tokens dzakashandiswa pa-reasoning:

200 JSON
{
  "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 ne-usage zviri pamhinduro imwe neimwe. Vaka code yako pazvo.

Munda Mhando Tsananguro Inotumirwa ne
id string resp_ inoteverwa ne-hexadecimal characters 32. Ma-model ese
object string Inogara iri response. Ma-model ese
status string completed. Mu-stream inotanga ive in_progress, uye failed mu-response.failed event. Ma-model ese
output array Output items nenzira dzakagadzirwa ne-model: reasoning, message, function_call. Ma-model ese
usage object input_tokens, output_tokens ne-total_tokens. Ma-model ese
usage.input_tokens_details object cached_tokens: input tokens dzakaverengwa kubva ku-prompt cache. Ma-model open-weight anobatwa nesu
usage.output_tokens_details object reasoning_tokens: output tokens dzakashandiswa pa-reasoning. Ma-model open-weight anobatwa nesu
model string Canonical id ye-model yakapindura. Mhuri ye-Shannon 3, hosted open-weight models
created_at integer Nguva yemhinduro, mumasekonzi e-Unix. Mhuri ye-Shannon 3, hosted open-weight models
instructions, tools, temperature, … instructions, tools ne-temperature zvinodzokorora request. error ne-incomplete_details ndi-null, metadata i-{}, parallel_tool_calls i-true, tool_choice i-auto uye top_p i-null. Mhuri ye-Shannon 3

Zvinhu zvinobuda

Chinhu Tsananguro
{"id": "rs_…", "type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} Reasoning ye-model se-summary_text part imwe. Iripo chete kana model yakafunga.
{"id": "msg_…", "type": "message", "role": "assistant", "content": [{"type": "output_text", "text": "…"}]} Mhinduro: output_text part imwe ine text.
{"id": "fc_…", "type": "function_call", "call_id": "call_…", "name": "…", "arguments": "…"} Tool call. arguments i-JSON string. Dzorera mhedzisiro ne-call_id imwechete.

OpenAI SDKs dzinokubatanidzira text ye-message mu-response.output_text.

Streaming

Isa stream ku-true kuti uwane server-sent events. Frame imwe neimwe ine mutsara we-event: une zita re-event nemutsara we-data: une JSON object; object inodzokorora zita mu-type. Enzanisa deltas ne-item yadzo ne-output_index.

Ne-OpenAI SDK, verenga ma-event nemhando yawo mu-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")

Ma-event anouya nenzira iyi. Mapoka e-reasoning, message ne-tool calls anooneka chete kana mhinduro ichiaita.

Chiitiko Payload Rinhi
response.created response Inogara iri yekutanga. response.status i-in_progress uye response.output haina chinhu.
response.in_progress response Inogara iri yechipiri, ine object imwechete.
response.output_item.added output_index, item Reasoning inotanga: reasoning item ine summary isina chinhu.
response.reasoning_summary_text.delta output_index, summary_index, delta Chimedu che-reasoning.
response.reasoning_summary_text.done output_index, summary_index, text Reasoning yapera: text yayo yose.
response.output_item.done output_index, item reasoning item yapera.
response.output_item.added output_index, item Mhinduro inotanga: message item ine status in_progress uye isina content.
response.content_part.added output_index, content_index, part output_text part isina chinhu inovhurwa.
response.output_text.delta output_index, content_index, delta Chimedu chemhinduro.
response.output_text.done output_index, content_index, text Mhinduro yapera: text yayo yose.
response.content_part.done output_index, content_index, part output_text part yapera.
response.output_item.done output_index, item message item yapera, ine status completed.
response.output_item.added output_index, item Tool call inotanga: function_call item ine call_id, name ne-arguments isina chinhu.
response.function_call_arguments.delta output_index, delta Arguments dze-call, dzakazara mu-delta imwe.
response.function_call_arguments.done output_index, arguments Arguments dzimwechete, se-arguments.
response.output_item.done output_index, item function_call item yapera.
response.completed response Inogara iri yekupedzisira kana zvabudirira: response object yose ine output ne-usage.
200 text/event-stream
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 inokundikana

Pa-Shannon tiers mhinduro yakundikana inopera ne-response.failed panzvimbo pe-response.completed. response.status yayo i-failed uye response.error ine code, rate_limit_exceeded kana server_error, ne-message.

Pa-hosted open-weight models kundikana i-error event ine code api_error ne-message. response.completed inoteverazve.

Tora stream seyakundikana kana ine response.failed kana error event, uye utumire request zvakare.

Zvishandiso

Tool i-function inomhanywa ne-code yako. Itsanangure mu-tools; kana model ichiida, mhinduro ine function_call item panzvimbo kana padivi pe-message.

Tool definition mu-tools:

tools
[
  {
    "type": "function",
    "name": "get_weather",
    "description": "Current weather for a city.",
    "parameters": {
      "type": "object",
      "properties": {
        "city": {
          "type": "string"
        }
      },
      "required": [
        "city"
      ]
    }
  }
]

output yemhinduro inoidanidzira:

200 output
[
  {
    "id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
    "type": "function_call",
    "name": "get_weather",
    "call_id": "call_3d9a7c1e5b2f4a60c8e1d7f09b24a6c5",
    "arguments": "{\"city\":\"Paris\"}"
  }
]

Mhanyisa function, wotumira request zvakare ine call nemhedzisiro yayo yawedzerwa mu-input:

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\"}"
  }
]

Tools dze-type function chete ndidzo dzinoverengwa. Pa-shannon-1.6-*, shannon-2-* ne-shannon-coder-1 parameters schema inoderedzwa kuita JSON Schema keywords dzakajairika: oneOf inoverengwa se-anyOf, uye keywords dzakaita se-$ref, additionalProperties, const, default ne-title hadzipiwi kuna model.

tool_choice values required ne-function yakatumidzwa dzinoshandiswa ne-hosted open-weight models.

Tool loop yakatsanangurwa zvizere papeji rayo. Kudanwa kwemabasa

Zvinobuda zvakarongeka

Format iyi inonyora structured output se-text.format. Schema iri zvakananga mu-format, padivi pe-name ne-strict, kwete pasi pe-json_schema member sepa-Chat Completions.

  • {"type": "json_object"} inokumbira chero JSON object.
  • {"type": "json_schema", "name", "schema", "strict"} inokumbira JSON inotevera schema yako. strict i-true kana ukaisiya kunze.
POST /v1/responses
{
  "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 inouya se-text mu-output_text part ye-message; i-parse iwe pachako. Hosted open-weight model isina structured output inodzosa 400.

output_text
{"city": "Lisbon", "date": "2027-05-12"}

Kuti model ipi inogamuchira form ipi kunoratidzwa papeji rayo. Zvinobuda zvakarongeka

Kufungisisa

Model inofunga inodzosa reasoning yayo se-output item ye-type reasoning, pamberi pe-message. Mu-stream inouya se-response.reasoning_summary_text.delta events.

Hosted open-weight models dzinoshandisa reasoning.effort: off, low, medium kana high, ne-high kana usina kutumira chinhu. off haidzosi reasoning item. Itumire se-object; string chete haiverengwi pa-endpoint iyi.

Ma-effort anotsanangurwa papeji rawo. Simba rekufunga

Muganho wezvinobuda

max_output_tokens ndi4,096 kana wasingaitumire. Ndiyo nhamba yematokeni anochengetwa kubva mubalance yako chikumbiro painotanga; kana mhinduro yapera, huwandu uhwu hunochinjwa nezvakashandiswa nechikumbiro. Kukosha kusingapindi mubalance yasara kunodzosa 429 Not enough API credit.

Inogumira kureba kwemhinduro pa-shannon-1.6-*, shannon-2-* ne-shannon-coder-1, uye kureba kwe-text yemhinduro pa-hosted open-weight models.

Pa-endpoint iyi shannon-coder-1 inobhadharwa mu-tokens kubva mu-balance yako, semamwe ma-model ese.

Request body inogona kusvika ku-32 MiB. Limits ne-balance

Zvikanganiso

Errors dzinoshandisa OpenAI error body: error object ine type ne-message; mamwe anotakurawo code ne-param ine value null. Tafura inoratidza zvinodzoserwa nguva dzakawanda ne-endpoint iyi. Rondedzero yakazara, ine zvekuedza zvakare, ine peji rayo. Zvikanganiso

Mamiriro Mhando Meseji Rinhi
401 authentication_error Missing authentication
Invalid API key
API key haina kutumirwa, kana key haizivikanwi kana kuti yabviswa.
400 invalid_request_error unknown model: <id> model haisipo kana kuti haisi published id.
400 invalid_request_error No user message provided. Shannon tiers: input haina user text.
400 invalid_request_error <id> does not accept image input Mufananidzo watumirwa kune hosted open-weight model isina image input.
400 invalid_request_error <id> does not accept response_format text.format yatumirwa kune hosted open-weight model isina structured output.
400 invalid_request_error unknown reasoning effort '<value>'; expected off, low, medium or high reasoning.effort ine value iri kunze kwe-list.
422 invalid_request_error Failed to deserialize the JSON body into the target type: … Body i-JSON chaiyo asi field ine type isiriyo.
429 insufficient_quota Not enough API credit. Top up at shannon-ai.com/tokens or get a GPU plan at shannon-ai.com/docs/api/plans max_output_tokens yakakura kupfuura zvasara mu-balance yako.
429 rate_limit_error Too many requests. Retry in <n>s. Flood protection: ma-request anopfuura 120 paminiti imwe pa-account yako.
500 api_error The model backend failed to answer. Please retry. Model haina kugadzira mhinduro. Tumira request zvakare.
502 api_error The model backend failed to answer. Please retry. Zvakafanana, pa-hosted open-weight models.
504 api_error upstream timed out Hosted open-weight model yakatora nguva yakareba kupfuura time limit ye-reply isiri streamed. Itumire ne-stream yakaiswa ku-true.
SHANNON Chiratidzo chechirongwa che NVIDIA Inception SHANNON LAB LLC inhengo yechirongwa che NVIDIA Inception.

Sarudza mutauro wako

Mitauro yese yakafanana. Sarudza yaunoda kushandisa.

Yuropu

Middle East neNorth Africa

Nezasi kweAsia

Nezasi-mabvazuva eAsia

Mabvazuva eAsia

Central Asia neCaucasus

Afrika

Oceania

Yakagadzirwa neYekare