Ƙoƙarin tunani
Model da ke yin reasoning yana mayar da rubutun reasoning ɗinsa kusa da amsa, a field na kansa. A hosted open-weight models field ɗaya na request yana saita zurfin reasoning na model kafin ya amsa.
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-uncensored-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-uncensored-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-uncensored-3BIT-REAP",
"reasoning_effort": "low",
"messages": [
{"role": "user", "content": "Is 221 a prime number?"}
]
}' Amsar tana ɗauke da rubutun reasoning a reasoning_content, amsa a content, da reasoning tokens a usage:
{
"id": "chatcmpl-2a6c8e0b4d1f4a3c9e7b5d3f1a8c6e4b",
"object": "chat.completion",
"created": 1791590400,
"model": "Kimi-K3-uncensored-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}
}
} Waɗanne models ke yin reasoning
| Samfuri | Yana mayar da rubutun reasoning | Yana aiwatar da field na 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 | Eh | — |
| Kowane hosted open-weight model | Eh | Eh |
Waɗannan su ne flags capabilities.reasoning da capabilities.reasoning_effort da GET /v1/models ke bayyana ga kowane id. Amsa tana ɗauke da rubutun reasoning ne kawai idan model ya samar da wani. Models & farashi
Saita effort
Kowane endpoint yana da nasa rubutun effort. Dukansu suna zaɓar ɗaya daga matakai huɗu iri ɗaya.
| Fili | Nau'i | Na asali | Bayani | Wanda ke aiwatarwa |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions. Zurfin reasoning na model kafin ya amsa: off, low, medium ko high. | Models na open-weight da aka ɗaura a dandali |
reasoning | object | string | /v1/chat/completions. Ƙima iri ɗaya a matsayin {"effort": "low"} ko a matsayin string kaɗai. Idan an aika fields duka biyu, reasoning_effort ne ke aiki. | Models na open-weight da aka ɗaura a dandali | |
reasoning.effort | string | high | /v1/responses. Ana rubuta shi a matsayin object {"effort": "low"}. | Models na open-weight da aka ɗaura a dandali |
thinking | object | /v1/messages. {"type": "enabled", "budget_tokens": n} ko {"type": "disabled"}. Budget yana zaɓar ɗaya daga matakai; duba tebur a ƙasa. | Models na open-weight da aka ɗaura a dandali |
{
"model": "Kimi-K3-uncensored-3BIT-REAP",
"reasoning_effort": "low",
"messages": [{"role": "user", "content": "Is 221 a prime number?"}]
} {
"model": "Kimi-K3-uncensored-3BIT-REAP",
"reasoning": {"effort": "low"},
"input": "Is 221 a prime number?"
} {
"model": "Kimi-K3-uncensored-3BIT-REAP",
"max_tokens": 1024,
"thinking": {"type": "enabled", "budget_tokens": 2048},
"messages": [{"role": "user", "content": "Is 221 a prime number?"}]
} | Ƙima | Ana kuma karɓa | Tasiri |
|---|---|---|
off | none, minimal | Babu reasoning. Amsa ba ta ɗauke da rubutun reasoning. |
low | Reasoning a taƙaice. | |
medium | default | Zurfi matsakaici. |
high | xhigh, max | Mafi zurfin mataki. Wannan shi ne matakin request da ba ya aika ƙima. |
- Ana karanta ƙimomi ba tare da la'akari da manyan haruffa ko ƙanana ba.
- Ƙimar
defaulttana nufinmedium. Barin field ɗin yana nufinhigh. - Models na Shannon (
shannon-*) suna saita zurfinsu da kansu a kowace request;GET /v1/modelsyana bayyanareasoning_effort: falsea gare su.
Thinking budget a /v1/messages
A /v1/messages field na thinking yana zaɓar mataki. budget_tokens yana zaɓar ɗaya daga matakan da ke sama; ba iyakar tokens ba ce ta kanta. Ana karanta adaptive kamar enabled.
| Kuna aikawa | Mataki |
|---|---|
{"type": "disabled"} | off |
{"type": "enabled", "budget_tokens": n} da n har zuwa 2,048 | low |
n daga 2,049 zuwa 8,192 | medium |
n mafi girma, ko enabled ba tare da budget_tokens ba | high |
Babu field na thinking | high |
Inda rubutun reasoning ke zuwa
Rubutun reasoning koyaushe daban yake da amsa. Kowane tsari yana da wurinsa:
| Endpoint | Ba streaming | Streaming |
|---|---|---|
/v1/chat/completions | choices[0].message.reasoning_content: string, ko null idan model bai samar da komai ba. | Chunks masu choices[0].delta.reasoning_content, kafin chunks masu delta.content. |
/v1/responses | Item na output {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} kafin item na message. Babu item idan babu reasoning. | response.output_item.added mai item na reasoning, sannan events na response.reasoning_summary_text.delta da response.reasoning_summary_text.done ɗaya. |
/v1/messages | Content block na farko {"type": "thinking", "thinking": "…"}, sannan block na text. Babu block na thinking idan babu reasoning. | Content block na thinking: content_block_start, events na content_block_delta masu thinking_delta, content_block_stop. Block na rubutu yana biye. |
{
"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
}
} Inda za a duba, ga kowane model:
| Models | Inda rubutun ke zuwa |
|---|---|
| Models na open-weight da aka ɗaura a dandali | A kowane endpoint, da streaming ko ba tare da shi ba. Ana amsa request mai effort off, ko mai response_format / text.format, ba tare da rubutun reasoning ba, kuma wasu amsoshi ma suna zuwa ba tare da shi ba: ku riƙa ɗaukar reasoning a matsayin abin da ba dole ba ne koyaushe. |
Models na Shannon (shannon-1.6-*, shannon-2-*, shannon-3*, shannon-coder-1) | Babu inda. Model yana yin reasoning kafin ya amsa, amma amsar ba ta ɗauke da rubutun reasoning a kowane endpoint, kuma ba a ƙirga reasoning a cikin usage ko a caje shi. Stream na iya ɗauke da layukan sharhi yayin da model ke yin reasoning. |
A /v1/responses, amsar da ba streaming ba tana ɗauke da item na reasoning ga iyalin Shannon 3 da hosted open-weight models.
Karanta stream
A stream rubutun reasoning yana zuwa da farko, a deltas na kansa, sannan amsa tana biye. Ku buga ko ku adana su biyu daban:
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-uncensored-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-uncensored-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-uncensored-3BIT-REAP",
"reasoning_effort": "medium",
"stream": true,
"messages": [
{"role": "user", "content": "Is 221 a prime number?"}
]
}' Chunk na farko na hosted open-weight model, reasoning ko amsa, yana kuma ɗauke da delta.role: "assistant". Yawo
Reasoning tokens da biyan kuɗi
A hosted open-weight models, reasoning tokens output tokens ne: ana cajin su a farashin output na model, kuma ƙirgan output ya riga ya haɗa da su. usage yana nuna kason reasoning a nan:
| Endpoint | Fili | Bayani |
|---|---|---|
/v1/chat/completions | usage.completion_tokens_details.reasoning_tokens | Ya riga ya shiga cikin completion_tokens. |
/v1/responses | usage.output_tokens_details.reasoning_tokens | Ya riga ya shiga cikin output_tokens. |
/v1/messages | usage.output_tokens | Reasoning da amsa a haɗe. Wannan tsari ba shi da ƙirgi na daban. |
- A hosted open-weight models
max_tokensyana iyakance rubutun amsa. Ba a ƙirga reasoning tokens a ciki ba. - Domin ana cajin reasoning a matsayin output, matakin effort kuma saitin kuɗi ne:
offba ya samar da reasoning tokens. - Models na Shannon suna bayyana
prompt_tokens,completion_tokensdatotal_tokens(input_tokensdaoutput_tokensa/v1/messages) ba tare da kason reasoning ba, kuma suna cajin farashi tsayayye ɗaya ga kowane token. Models & farashi
Reasoning a request na gaba
Ba sai kun mayar da reasoning ba. Block na thinking ko item na reasoning a tattaunawar da kuka aika ba a mika shi ga model, don haka turn na assistant na iya komawa da shi ko ba tare da shi ba. Block na thinking yana da fields biyu type da thinking; ba shi da signature.
Kurakurai
Ƙimar tunani ba ta taɓa sa buƙata ta kasa. Ana karɓar none, minimal, low, medium, high, xhigh da max duka, a kan kowane model da kowane endpoint; ƙimar da ba ta cikin jerin, ko wadda ba zaren rubutu ba ce, ana yin watsi da ita kuma ana amfani da matakin da aka saba.
Kurakuran tabbatarwa, balance da server iri ɗaya ne da na kowace request. Kuskuren Gudanarwa
