Reasoning effort
VaovaoNy model manao reasoning dia mamerina ny soratra reasoning-ny eo anilan'ny valiny, ao amin'ny saha manokana. Amin'ny model open-weight hosted, saha fangatahana iray no mametra ny halalin'ny reasoning an'ny model alohan'ny hamaliany.
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?"}
]
}' Ny valiny dia mitondra ny soratra reasoning ao amin'ny reasoning_content, ny valiny ao amin'ny content, ary ny reasoning token ao amin'ny 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}
}
} Iza amin'ny model no manao reasoning
| Model | Mamerina soratra reasoning | Mampihatra ny saha 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 | Eny | — |
| Model open-weight hosted rehetra | Eny | Eny |
Ireo no flag capabilities.reasoning sy capabilities.reasoning_effort ambaran'ny GET /v1/models isaky ny id. Ny valiny dia mitondra soratra reasoning rehefa namokatra izany ny model ihany. Model & vidiny
Fametrahana ny effort
Ny endpoint tsirairay dia manana fanoratana manokana ho an'ny effort. Ireo rehetra dia mifidy ambaratonga iray amin'ireo efatra mitovy.
| Saha | Karazana | Default | Famaritana | Ampiharin'ny |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions. Hoatrinona ny halalin'ny reasoning an'ny model alohan'ny hamaliany: off, low, medium na high. | Model open-weight hosted |
reasoning | object | string | /v1/chat/completions. Ny sanda mitovy ho {"effort": "low"} na ho string tsotra. Rehefa alefa ny saha roa, ny reasoning_effort no ampiasaina. | Model open-weight hosted | |
reasoning.effort | string | high | /v1/responses. Sorana ho object {"effort": "low"}. | Model open-weight hosted |
thinking | object | /v1/messages. {"type": "enabled", "budget_tokens": n} na {"type": "disabled"}. Ny budget no mifidy ambaratonga iray; jereo ny tabilao etsy ambany. | Model 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?"}]
} | Sanda | Raisina koa | Vokany |
|---|---|---|
off | none, minimal | Tsy misy reasoning. Ny valiny dia tsy mitondra soratra reasoning. |
low | Reasoning fohy. | |
medium | default | Halalina antonony. |
high | max | Ny ambaratonga lalina indrindra. Io no ambaratonga amin'ny fangatahana tsy mandefa sanda. |
- Vakiana tsy mijery ny litera lehibe/kely ny sanda.
- Ny sanda
defaultdia midikamedium. Ny tsy fametrahana ny saha dia midikahigh. - Ny model Shannon (
shannon-*) dia mamaritra ny halaliny manokana isaky ny fangatahana; nyGET /v1/modelsdia milazareasoning_effort: falseho azy ireo.
Ny thinking budget amin'ny /v1/messages
Amin'ny /v1/messages, ny saha thinking no mifidy ny ambaratonga. Ny budget_tokens dia mifidy iray amin'ireo ambaratonga etsy ambony; tsy fetra token manokana izy. Ny adaptive dia vakiana toy ny enabled.
| Alefanao | Ambaratonga |
|---|---|
{"type": "disabled"} | off |
{"type": "enabled", "budget_tokens": n} miaraka amin'ny n hatramin'ny 2,048 | low |
n manomboka amin'ny 2,049 hatramin'ny 8,192 | medium |
n lehibe kokoa, na enabled tsy misy budget_tokens | high |
Tsy misy saha thinking | high |
Izay tonga ny soratra reasoning
Ny soratra reasoning dia misaraka foana amin'ny valiny. Ny endrika tsirairay dia manana toerana manokana ho azy:
| Endpoint | Tsy streamed | Streamed |
|---|---|---|
/v1/chat/completions | choices[0].message.reasoning_content: string, na null raha tsy namokatra ny model. | Chunk misy choices[0].delta.reasoning_content, alohan'ny chunk misy delta.content. |
/v1/responses | Item output {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} alohan'ny item message. Tsy misy item raha tsy misy reasoning. | response.output_item.added miaraka amin'ny item reasoning, avy eo event response.reasoning_summary_text.delta ary response.reasoning_summary_text.done iray. |
/v1/messages | Content block voalohany {"type": "thinking", "thinking": "…"}, avy eo ny block text. Tsy misy block thinking raha tsy misy reasoning. | Content block thinking: content_block_start, event content_block_delta miaraka amin'ny thinking_delta, content_block_stop. Manaraka ny text 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
}
} Izay hojerena, isaky ny model:
| Model | Izay tonga ny soratra |
|---|---|
| Model open-weight hosted | Amin'ny endpoint rehetra, streamed na tsia. Ny fangatahana misy effort off, na misy response_format / text.format, dia valiana tsy misy soratra reasoning. |
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | Amin'ny endpoint rehetra, streamed na tsia, isaky ny namokatra soratra reasoning ny model. |
shannon-2-lite, shannon-2-pro | /v1/chat/completions, tsy streamed: ao amin'ny message.reasoning_content. Streamed, amin'ny fangatahana tsy misy tools na response_format: ny stream dia mitondra andalana fanamarihana : thinking raha mbola manao reasoning ny model, avy eo ny chunk valiny. /v1/messages, streamed: block thinking alohan'ny text block. |
shannon-1.6-pro, shannon-coder-1 | Ao amin'ny valiny streamed sy ao amin'ny valin'ny fangatahana mitondra tools, isaky ny namokatra soratra reasoning ny model. |
Amin'ny /v1/responses, ny valiny tsy streamed dia mitondra ny item reasoning ho an'ny fianakavian'i Shannon 3 sy ny model open-weight hosted.
Famakiana stream
Ao anaty stream, ny soratra reasoning no tonga voalohany, amin'ny delta manokana, ary manaraka ny valiny. Soraty na tehirizo samy hafa ireo roa:
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?"}
]
}' Ny chunk voalohany an'ny model open-weight hosted, reasoning na valiny, dia mitondra delta.role: "assistant" koa. Fandefasana mivantana
Reasoning token sy fandoavam-bola
Amin'ny model open-weight hosted, ny reasoning token dia output token: vidiana amin'ny vidin'ny output an'ny model, ary ny isan'ny output dia efa ahitana azy ireo. Ny usage dia mampiseho eto ny anjaran'ny reasoning:
| Endpoint | Saha | Fanamarihana |
|---|---|---|
/v1/chat/completions | usage.completion_tokens_details.reasoning_tokens | Efa ao anatin'ny completion_tokens. |
/v1/responses | usage.output_tokens_details.reasoning_tokens | Efa ao anatin'ny output_tokens. |
/v1/messages | usage.output_tokens | Reasoning sy valiny miaraka. Ity endrika ity dia tsy manana isa mitokana. |
- Amin'ny model open-weight hosted, ny
max_tokensdia mametra ny soratry ny valiny. Ny reasoning token dia tsy ao anatiny. - Satria vidiana ho output ny reasoning, ny ambaratonga effort dia setting vidiny koa: ny
offdia tsy mamokatra reasoning token. - Ny model Shannon dia milaza
prompt_tokens,completion_tokensarytotal_tokens(input_tokenssyoutput_tokensamin'ny/v1/messages) tsy misy anjaran'ny reasoning, ary mamidy vidiny mitovy isaky ny token. Model & vidiny
Reasoning ao amin'ny fangatahana manaraka
Tsy tsy maintsy alefanao miverina ny reasoning. Ny block thinking na item reasoning ao amin'ny resaka alefanao dia tsy atolotra ny model, ka ny fihodinan'ny assistant dia mety miverina miaraka na tsy miaraka aminy. Ny block thinking dia manana saha roa type sy thinking; tsy manana signature.
Hadisoana
| Status | Karazana | Hafatra | Rahoviana |
|---|---|---|---|
400 | invalid_request_error | unknown reasoning effort '<value>'; expected off, low, medium or high | Nahazo sanda ivelan'ny lisitra ny model open-weight hosted, ohatra xhigh. Tsy misy very amin'ny balance-nao. |
422 | invalid_request_error | Failed to deserialize the JSON body into the target type: … | Tsy string ny reasoning_effort. |
Ny fanamarinana, ny balance ary ny hadisoan'ny server dia mitovy amin'ny an'ny fangatahana rehetra. Fitantanana hadisoana