Reasoning effort
አዲስየሚያስብ ሞዴል የreasoning ጽሑፉን ከመልሱ ጎን በራሱ መስክ ይመልሳል። በተስተናገዱ open-weight ሞዴሎች ላይ አንድ የጥያቄ መስክ ሞዴሉ ከመመለሱ በፊት ምን ያህል በጥልቀት እንደሚያስብ ይወስናል።
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?"}
]
}' ምላሹ የreasoning ጽሑፉን በreasoning_content፣ መልሱን በcontent፣ እና የreasoning tokens ን በ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}
}
} የትኞቹ ሞዴሎች ያስባሉ
| ሞዴል | የreasoning ጽሑፍ ይመልሳል | የeffort መስኩን ይተገብራል |
|---|---|---|
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 | አዎ | — |
| እያንዳንዱ የተስተናገደ open-weight ሞዴል | አዎ | አዎ |
እነዚህ GET /v1/models ለእያንዳንዱ id የሚያሳውቃቸው capabilities.reasoning እና capabilities.reasoning_effort ባንዲራዎች ናቸው። ምላሽ የreasoning ጽሑፍ የሚይዘው ሞዴሉ ካመነጨ ብቻ ነው። ሞዴሎችና ዋጋ
effort ን ማዘጋጀት
እያንዳንዱ endpoint ለeffort የራሱ አጻጻፍ አለው። ሁሉም ከተመሳሳዮቹ አራት ደረጃዎች አንዱን ይመርጣሉ።
| መስክ | ዓይነት | ነባሪ | መግለጫ | የሚተገብሩት |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions። ሞዴሉ ከመመለሱ በፊት ምን ያህል በጥልቀት እንደሚያስብ፦ off፣ low፣ medium ወይም high። | የተስተናገዱ open-weight ሞዴሎች |
reasoning | object | string | /v1/chat/completions። ተመሳሳዩ እሴት እንደ {"effort": "low"} ወይም እንደ ባዶ string። ሁለቱም መስኮች ሲላኩ reasoning_effort ይቆጠራል። | የተስተናገዱ open-weight ሞዴሎች | |
reasoning.effort | string | high | /v1/responses። እንደ object {"effort": "low"} ይጻፋል። | የተስተናገዱ open-weight ሞዴሎች |
thinking | object | /v1/messages። {"type": "enabled", "budget_tokens": n} ወይም {"type": "disabled"}። በጀቱ ከደረጃዎቹ አንዱን ይመርጣል፤ ከታች ያለውን ሠንጠረዥ ይመልከቱ። | የተስተናገዱ open-weight ሞዴሎች |
{
"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?"}]
} | እሴት | ተቀባይነት ያላቸው ሌሎች | ውጤት |
|---|---|---|
off | none, minimal | reasoning የለም። ምላሹ የreasoning ጽሑፍ አይይዝም። |
low | አጭር reasoning። | |
medium | default | መካከለኛ ጥልቀት። |
high | max | በጣም ጥልቅ ደረጃ። ምንም እሴት የማይልክ ጥያቄ ደረጃ ይህ ነው። |
- እሴቶች ትላልቅና ትናንሽ ፊደላትን ሳይለዩ ይነበባሉ።
- እሴቱ
defaultማለትmediumማለት ነው። መስኩን መተውhighማለት ነው። - የShannon ሞዴሎች (
shannon-*) በእያንዳንዱ ጥያቄ የራሳቸውን ጥልቀት ይወስናሉ፤GET /v1/modelsለእነሱreasoning_effort: falseያሳውቃል።
በ/v1/messages ላይ ለማሰብ የሚሰጠው በጀት (thinking budget)
በ/v1/messages ላይ thinking መስኩ ደረጃውን ይመርጣል። budget_tokens ከላይ ካሉት ደረጃዎች አንዱን ይመርጣል፤ የራሱ የtoken ገደብ አይደለም። adaptive እንደ enabled ይነበባል።
| የሚልኩት | ደረጃ |
|---|---|
{"type": "disabled"} | off |
{"type": "enabled", "budget_tokens": n} ከn እስከ 2,048 ጋር | low |
n ከ2,049 እስከ 8,192 | medium |
ትልቅ n፣ ወይም ያለ budget_tokens enabled | high |
thinking መስክ የለም | high |
የreasoning ጽሑፍ የሚደርስበት
የreasoning ጽሑፍ ሁልጊዜ ከመልሱ የተለየ ነው። እያንዳንዱ ፎርማት ለእሱ የራሱ ቦታ አለው፦
| Endpoint | stream ያልሆነ | Stream የሆነ |
|---|---|---|
/v1/chat/completions | choices[0].message.reasoning_content፦ string፣ ወይም ሞዴሉ ምንም ካላመነጨ null። | choices[0].delta.reasoning_content ያላቸው chunks፣ delta.content ካላቸው chunks በፊት። |
/v1/responses | ከmessage ንጥል በፊት output ንጥል {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]}። reasoning ከሌለ ንጥሉ የለም። | reasoning ንጥል ያለው response.output_item.added፣ ከዚያ response.reasoning_summary_text.delta events እና አንድ response.reasoning_summary_text.done። |
/v1/messages | የመጀመሪያ content block {"type": "thinking", "thinking": "…"}፣ ከዚያ የtext block። reasoning ከሌለ thinking block የለም። | thinking content block ይመጣል፦ መጀመሪያ content_block_start፣ ከዚያ thinking_delta የያዙ content_block_delta events፣ በመጨረሻ content_block_stop። ከዚያ በኋላ የጽሑፉ block ይከተላል። |
{
"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
}
} የት መመልከት፣ በሞዴል፦
| ሞዴሎች | ጽሑፉ የሚደርስበት |
|---|---|
| የተስተናገዱ open-weight ሞዴሎች | በእያንዳንዱ endpoint ላይ፣ stream ቢሆንም ባይሆንም። effort off ያለው ወይም response_format / text.format ያለው ጥያቄ ያለ reasoning ጽሑፍ ይመለሳል። |
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | ሞዴሉ reasoning ጽሑፍ ባመነጨ ጊዜ ሁሉ፣ በእያንዳንዱ endpoint ላይ፣ stream ቢሆንም ባይሆንም። |
shannon-2-lite, shannon-2-pro | /v1/chat/completions፣ stream ያልሆነ፦ በmessage.reasoning_content ውስጥ። Stream፣ tools ወይም response_format በሌለው ጥያቄ፦ ሞዴሉ በሚያስብበት ጊዜ stream የ: thinking comment መስመሮችን ይይዛል፣ ከዚያ የመልስ chunks። /v1/messages፣ stream፦ ከtext block በፊት thinking block። |
shannon-1.6-pro, shannon-coder-1 | ሞዴሉ reasoning ጽሑፍ ባመነጨ ጊዜ ሁሉ፣ በstream ምላሾች እና tools ለያዙ ጥያቄዎች ምላሾች። |
በ/v1/responses ላይ stream ያልሆነ ምላሽ ለShannon 3 ቤተሰብ እና ለተስተናገዱ open-weight ሞዴሎች የreasoning ንጥል ይይዛል።
stream ማንበብ
በstream ውስጥ የreasoning ጽሑፉ መጀመሪያ በራሱ deltas ይመጣል፣ መልሱ ይከተላል። ሁለቱን ለየብቻ ያትሙ ወይም ያስቀምጡ፦
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?"}
]
}' የተስተናገደ open-weight ሞዴል የመጀመሪያ chunk፣ reasoning ወይም መልስ፣ delta.role: "assistant"ንም ይይዛል። ስትሪሚንግ
የReasoning tokens እና የክፍያ አያያዝ
በተስተናገዱ open-weight ሞዴሎች ላይ reasoning tokens output tokens ናቸው፦ በሞዴሉ የoutput ዋጋ ይከፈላሉ፣ እና የoutput ቆጠራው አስቀድሞ ያካትታቸዋል። usage እዚህ የreasoning ድርሻን ያሳያል፦
| Endpoint | መስክ | ማስታወሻ |
|---|---|---|
/v1/chat/completions | usage.completion_tokens_details.reasoning_tokens | በcompletion_tokens ውስጥ አስቀድሞ ተካቷል። |
/v1/responses | usage.output_tokens_details.reasoning_tokens | በoutput_tokens ውስጥ አስቀድሞ ተካቷል። |
/v1/messages | usage.output_tokens | Reasoning እና መልስ በአንድ ላይ። ይህ ፎርማት የተለየ ቆጠራ የለውም። |
- በተስተናገዱ open-weight ሞዴሎች ላይ
max_tokensየመልሱን ጽሑፍ ይገድባል። Reasoning tokens ወደ እሱ አይቆጠሩም። - reasoning እንደ output ስለሚከፈል የeffort ደረጃ የወጪ ቅንብርም ነው፦
offምንም reasoning tokens አያመነጭም። - የShannon ሞዴሎች
prompt_tokens፣completion_tokensእናtotal_tokens(በ/v1/messagesላይinput_tokensእናoutput_tokens) ያለ reasoning ድርሻ ያሳውቃሉ፣ እና በአንድ token አንድ ቋሚ ዋጋ ያስከፍላሉ። ሞዴሎችና ዋጋ
በቀጣዩ ጥያቄ ውስጥ ያለ reasoning
reasoning መልሰው መላክ አያስፈልግዎትም። በሚልኩት ውይይት ውስጥ ያለ thinking block ወይም reasoning ንጥል ወደ ሞዴሉ አይተላለፍም፣ ስለዚህ የassistant ዙር ከእሱ ጋር ወይም ያለ እሱ ሊመለስ ይችላል። thinking block ሁለት መስኮች አሉት፣ type እና thinking፤ signature የለውም።
ስህተቶች
| ሁኔታ | ዓይነት | መልእክት | መቼ |
|---|---|---|---|
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | የተስተናገደ open-weight ሞዴል ከዝርዝሩ ውጭ የሆነ እሴት ተቀብሏል፣ ለምሳሌ xhigh። ከቀሪ ሂሳብዎ ምንም አይወሰድም። |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | reasoning_effort string አይደለም። |
የማረጋገጫ፣ የቀሪ ሂሳብ እና የserver ስህተቶች ለእያንዳንዱ ጥያቄ እንዳሉት ተመሳሳይ ናቸው። ስህተት አስተዳደር