Oidhirp reusanachaidh
ÙrTillidh modail a nì reasoning an teacsa reasoning ri taobh an fhreagairt, ann an raon fa leth. Air na modailean open-weight hosted suidhichidh aon raon iarrtais cho domhainn ’s a nì am modail reasoning mus freagair e.
POST https://api.shannon-ai.com/v1/chat/completions
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.shannon-ai.com/v1")
response = client.chat.completions.create(
model="Kimi-K3-3BIT-REAP",
reasoning_effort="low",
messages=[{"role": "user", "content": "Is 221 a prime number?"}],
)
message = response.choices[0].message
print("Reasoning:", getattr(message, "reasoning_content", None))
print("Answer:", message.content)
print("Reasoning tokens:", response.usage.completion_tokens_details.reasoning_tokens) import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.shannon-ai.com/v1" });
const response = await client.chat.completions.create({
model: "Kimi-K3-3BIT-REAP",
reasoning_effort: "low",
messages: [{ role: "user", content: "Is 221 a prime number?" }],
});
const message = response.choices[0].message;
console.log("Reasoning:", message.reasoning_content);
console.log("Answer:", message.content);
console.log("Reasoning tokens:", response.usage.completion_tokens_details.reasoning_tokens); curl https://api.shannon-ai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Kimi-K3-3BIT-REAP",
"reasoning_effort": "low",
"messages": [
{"role": "user", "content": "Is 221 a prime number?"}
]
}' Tha an teacsa reasoning san fhreagairt ann an reasoning_content, am freagairt ann an content, agus na tokens reasoning ann an usage:
{
"id": "chatcmpl-2a6c8e0b4d1f4a3c9e7b5d3f1a8c6e4b",
"object": "chat.completion",
"created": 1791590400,
"model": "Kimi-K3-3BIT-REAP",
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "No. 221 = 13 x 17, so it is not prime.",
"reasoning_content": "Try small primes. 221 / 13 = 17, so 221 = 13 x 17."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 43,
"total_tokens": 57,
"prompt_tokens_details": {"cached_tokens": 0},
"completion_tokens_details": {"reasoning_tokens": 27}
}
} Dè na modailean a nì reasoning
| Modail | Tillidh e teacsa reasoning | Cuiridh e an raon oidhirp an gnìomh |
|---|---|---|
shannon-1.6-lite | — | — |
shannon-1.6-pro, shannon-2-lite, shannon-2-pro, shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro, shannon-coder-1 | Tha | — |
| A h-uile modail open-weight hosted | Tha | Tha |
Seo na brataichean capabilities.reasoning agus capabilities.reasoning_effort a tha GET /v1/models ag aithris airson gach id. Chan eil teacsa reasoning ann am freagairt ach nuair a thug am modail a-mach cuid. Modailean & prìsean
A’ suidheachadh na h-oidhirp
Tha litreachadh fhèin aig gach endpoint airson na h-oidhirp. Taghaidh iad uile aon dhe na h-aon cheithir ìrean.
| Raon | Seòrsa | Bun-roghainn | Tuairisgeul | Air a chur an sàs le |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions. Cho domhainn ’s a nì am modail reasoning mus freagair e: off, low, medium no high. | Modailean open-weight hosted |
reasoning | object | string | /v1/chat/completions. An aon luach ri {"effort": "low"} no mar sreang lom. Nuair a thèid an dà raon a chur, bidh reasoning_effort a’ cunntadh. | Modailean open-weight hosted | |
reasoning.effort | string | high | /v1/responses. Sgrìobhte mar an nì {"effort": "low"}. | Modailean open-weight hosted |
thinking | object | /v1/messages. {"type": "enabled", "budget_tokens": n} no {"type": "disabled"}. Taghaidh am buidseat aon dhe na h-ìrean; faic a’ chlàr nas fhaide sìos. | Modailean open-weight hosted |
{
"model": "Kimi-K3-3BIT-REAP",
"reasoning_effort": "low",
"messages": [{"role": "user", "content": "Is 221 a prime number?"}]
} {
"model": "Kimi-K3-3BIT-REAP",
"reasoning": {"effort": "low"},
"input": "Is 221 a prime number?"
} {
"model": "Kimi-K3-3BIT-REAP",
"max_tokens": 1024,
"thinking": {"type": "enabled", "budget_tokens": 2048},
"messages": [{"role": "user", "content": "Is 221 a prime number?"}]
} | Luach | Air a ghabhail cuideachd | Buaidh |
|---|---|---|
off | none, minimal | Gun reasoning. Chan eil teacsa reasoning san fhreagairt. |
low | Reasoning goirid. | |
medium | default | Doimhneachd mheadhanach. |
high | max | An ìre as doimhne. Seo ìre iarrtais nach cuir luach. |
- Thèid na luachan a leughadh gun suim de litrichean mòra no beaga.
- Tha an luach
defaulta’ ciallachadhmedium. Ma dh’fhàgas tu an raon às, tha sin a’ ciallachadhhigh. - Suidhichidh na modailean Shannon (
shannon-*) an doimhneachd fhèin anns gach iarrtas; thaGET /v1/modelsag aithrisreasoning_effort: falsedhaibh.
Am buidseat thinking air /v1/messages
Air /v1/messages taghaidh an raon thinking an ìre. Taghaidh budget_tokens aon dhe na h-ìrean gu h-àrd; chan e crìoch tokens fa leth a th’ ann. Thèid adaptive a leughadh mar enabled.
| Cuiridh tu | Ìre |
|---|---|
{"type": "disabled"} | off |
{"type": "enabled", "budget_tokens": n} le n suas gu 2,048 | low |
n o 2,049 gu 8,192 | medium |
n nas motha, no enabled gun budget_tokens | high |
Gun raon thinking | high |
Càite a bheil an teacsa reasoning a’ ruighinn
Tha teacsa reasoning an-còmhnaidh air leth on fhreagairt. Tha àite fhèin aig gach cruth air a shon:
| Endpoint | Gun streaming | Le streaming |
|---|---|---|
/v1/chat/completions | choices[0].message.reasoning_content: sreang, no null nuair nach tug am modail a-mach gin. | Chunks le choices[0].delta.reasoning_content, ron chunks le delta.content. |
/v1/responses | Nì output {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} ron nì message. Chan eil nì ann nuair nach eil reasoning ann. | response.output_item.added le nì reasoning, an uair sin tachartasan response.reasoning_summary_text.delta agus aon response.reasoning_summary_text.done. |
/v1/messages | A’ chiad bhloc susbaint {"type": "thinking", "thinking": "…"}, an uair sin am bloc text. Chan eil bloc thinking ann nuair nach eil reasoning ann. | Bloc susbaint thinking: content_block_start, tachartasan content_block_delta le thinking_delta, content_block_stop. Thig am bloc teacsa às a dhèidh. |
{
"choices": [
{
"index": 0,
"message": {
"role": "assistant",
"content": "No. 221 = 13 x 17, so it is not prime.",
"reasoning_content": "Try small primes. 221 / 13 = 17, so 221 = 13 x 17."
},
"finish_reason": "stop"
}
],
"usage": {
"prompt_tokens": 14,
"completion_tokens": 43,
"total_tokens": 57,
"prompt_tokens_details": {"cached_tokens": 0},
"completion_tokens_details": {"reasoning_tokens": 27}
}
} {
"output": [
{
"id": "rs_6f0a2c4e8b1d4f3a9c7e5b3d1f8a6c4e",
"type": "reasoning",
"summary": [
{
"type": "summary_text",
"text": "Try small primes. 221 / 13 = 17, so 221 = 13 x 17."
}
]
},
{
"id": "msg_1b3d5f7a9c2e4b6d8f0a2c4e6b8d0f1a",
"type": "message",
"role": "assistant",
"status": "completed",
"content": [
{
"type": "output_text",
"text": "No. 221 = 13 x 17, so it is not prime.",
"annotations": []
}
]
}
],
"usage": {
"input_tokens": 14,
"input_tokens_details": {"cached_tokens": 0},
"output_tokens": 43,
"output_tokens_details": {"reasoning_tokens": 27},
"total_tokens": 57
}
} {
"content": [
{
"type": "thinking",
"thinking": "Try small primes. 221 / 13 = 17, so 221 = 13 x 17."
},
{"type": "text", "text": "No. 221 = 13 x 17, so it is not prime."}
],
"stop_reason": "end_turn",
"usage": {
"input_tokens": 14,
"cache_read_input_tokens": 0,
"cache_creation_input_tokens": 0,
"output_tokens": 43
}
} Càite am faic thu e, gach modail:
| Modailean | Càite a bheil an teacsa a’ ruighinn |
|---|---|
| Modailean open-weight hosted | Air gach endpoint, le streaming no às aonais. Thèid iarrtas le oidhirp off, no le response_format / text.format, a fhreagairt gun teacsa reasoning. |
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | Air gach endpoint, le streaming no às aonais, a h-uile uair a thug am modail a-mach teacsa reasoning. |
shannon-2-lite, shannon-2-pro | /v1/chat/completions, gun streaming: ann an message.reasoning_content. Le streaming, ann an iarrtas gun tools no response_format: bidh loidhnichean beachd : thinking anns an stream fhad ’s a nì am modail reasoning, an uair sin na chunks freagairt. /v1/messages, le streaming: bloc thinking ron bhloc teacsa. |
shannon-1.6-pro, shannon-coder-1 | Ann am freagairtean le streaming agus ann am freagairtean do dh’iarrtasan anns a bheil tools, a h-uile uair a thug am modail a-mach teacsa reasoning. |
Air /v1/responses, tha an nì reasoning ann am freagairt gun streaming airson teaghlach Shannon 3 agus na modailean open-weight hosted.
A’ leughadh stream
Ann an stream thig an teacsa reasoning an toiseach, ann an deltas fa leth, agus thig am freagairt às a dhèidh. Clò-bhuail no stòraich an dà fhear air leth:
from openai import OpenAI
client = OpenAI(api_key="YOUR_API_KEY", base_url="https://api.shannon-ai.com/v1")
stream = client.chat.completions.create(
model="Kimi-K3-3BIT-REAP",
reasoning_effort="medium",
stream=True,
messages=[{"role": "user", "content": "Is 221 a prime number?"}],
)
for chunk in stream:
if not chunk.choices:
continue
delta = chunk.choices[0].delta
reasoning = getattr(delta, "reasoning_content", None)
if reasoning:
print(reasoning, end="", flush=True) # the reasoning text comes first
if delta.content:
print(delta.content, end="", flush=True) # then the answer import OpenAI from "openai";
const client = new OpenAI({ apiKey: "YOUR_API_KEY", baseURL: "https://api.shannon-ai.com/v1" });
const stream = await client.chat.completions.create({
model: "Kimi-K3-3BIT-REAP",
reasoning_effort: "medium",
stream: true,
messages: [{ role: "user", content: "Is 221 a prime number?" }],
});
for await (const chunk of stream) {
const delta = chunk.choices[0]?.delta ?? {};
if (delta.reasoning_content) process.stdout.write(delta.reasoning_content); // the reasoning text comes first
if (delta.content) process.stdout.write(delta.content); // then the answer
} curl -N https://api.shannon-ai.com/v1/chat/completions \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "Kimi-K3-3BIT-REAP",
"reasoning_effort": "medium",
"stream": true,
"messages": [
{"role": "user", "content": "Is 221 a prime number?"}
]
}' Tha delta.role: "assistant" cuideachd sa chiad chunk de mhodail open-weight hosted, reasoning no freagairt. Sruthadh
Tokens reasoning agus billeadh
Air na modailean open-weight hosted, tha tokens reasoning nan tokens cuir-a-mach: thèid am billeadh aig prìs cuir-a-mach a’ mhodail, agus tha iad cuimsichte mu thràth anns a’ chunntas cuir-a-mach. Seallaidh usage cuibhreann reasoning an seo:
| Endpoint | Raon | Nòta |
|---|---|---|
/v1/chat/completions | usage.completion_tokens_details.reasoning_tokens | Cuimsichte mu thràth ann an completion_tokens. |
/v1/responses | usage.output_tokens_details.reasoning_tokens | Cuimsichte mu thràth ann an output_tokens. |
/v1/messages | usage.output_tokens | Reasoning agus freagairt còmhla. Chan eil cunntas fa leth aig an cruth seo. |
- Air na modailean open-weight hosted cuingichidh
max_tokensteacsa an fhreagairt. Chan eil tokens reasoning air an cunntadh na aghaidh. - Leis gu bheil reasoning air a bhilleadh mar chuir-a-mach, tha ìre na h-oidhirp cuideachd na roghainn cosgais: chan eil
offa’ toirt a-mach tokens reasoning. - Aithrisidh na modailean Shannon
prompt_tokens,completion_tokensagustotal_tokens(input_tokensagusoutput_tokensair/v1/messages) gun chuibhreann reasoning, agus billidh iad aon phrìs chòmhnard gach token. Modailean & prìsean
Reasoning san ath iarrtas
Chan fheum thu reasoning a chur air ais. Chan eilear a’ toirt bloc thinking no nì reasoning anns a’ chòmhradh a chuireas tu air adhart chun a’ mhodail, agus mar sin faodaidh tionndadh neach-cuideachaidh tilleadh leis no às aonais. Tha an dà raon type agus thinking ann am bloc thinking; chan eil signature ann.
Mearachdan
| Staid | Seòrsa | Teachdaireachd | Cuin |
|---|---|---|---|
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | Fhuair modail open-weight hosted luach taobh a-muigh na liosta, mar eisimpleir xhigh. Chan eil dad air a thoirt bho do balance. |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | Chan e sreang a th’ ann an reasoning_effort. |
Tha mearachdan dearbhaidh, balance agus frithealaiche mar a tha iad airson gach iarrtas. Làimhseachadh mearachd