Reasoning effort
புதியதுreasoning செய்யும் மாடல் தன் reasoning உரையைப் பதிலுக்குப் பக்கத்தில், தனிப் புலத்தில் தரும். ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்களில், பதிலளிக்கும் முன் மாடல் எவ்வளவு ஆழமாக reasoning செய்கிறது என்பதை ஒரு கோரிக்கைப் புலம் அமைக்கிறது.
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 டோக்கன்களை 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 செய்கின்றன
| மாடல் | 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 flags. மாடல் உருவாக்கியிருந்தால் மட்டுமே பதில் reasoning உரையைக் கொண்டிருக்கும். மாடல்கள் & விலை
effort-ஐ அமைத்தல்
ஒவ்வொரு endpoint-க்கும் effort-ஐ எழுதும் தனி முறை உண்டு. அவை அனைத்தும் அதே நான்கு நிலைகளில் ஒன்றைத் தேர்ந்தெடுக்கின்றன.
| புலம் | வகை | இயல்புநிலை | விளக்கம் | செயல்படுத்துவது |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions. பதிலளிக்கும் முன் மாடல் எவ்வளவு ஆழமாக reasoning செய்கிறது: 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. {"effort": "low"} object ஆக எழுதப்படும். | ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்கள் |
thinking | object | /v1/messages. {"type": "enabled", "budget_tokens": n} அல்லது {"type": "disabled"}. budget நிலைகளில் ஒன்றைத் தேர்ந்தெடுக்கும்; கீழே உள்ள அட்டவணையைப் பாருங்கள். | ஹோஸ்ட் செய்யப்பட்ட 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-ல் சிந்தனை வரம்பு (budget)
/v1/messages-ல் thinking புலம் நிலையைத் தேர்ந்தெடுக்கும். budget_tokens மேலே உள்ள நிலைகளில் ஒன்றைத் தேர்ந்தெடுக்கும்; அது தனி டோக்கன் வரம்பு அல்ல. adaptive என்பது enabled போலவே படிக்கப்படும்.
| நீங்கள் அனுப்புவது | நிலை |
|---|---|
{"type": "disabled"} | off |
n 2,048 வரை இருக்கும் {"type": "enabled", "budget_tokens": n} | 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. | delta.content கொண்ட chunks-க்கு முன், choices[0].delta.reasoning_content கொண்ட chunks. |
/v1/responses | message உருப்படிக்கு முன் ஒரு output உருப்படி {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]}. reasoning இல்லையென்றால் உருப்படி இருக்காது. | reasoning உருப்படியுடன் response.output_item.added, பிறகு response.reasoning_summary_text.delta நிகழ்வுகளும் ஒரு 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 நிகழ்வுகள், 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 மாடல்கள் | stream செய்தாலும் செய்யாவிட்டாலும் ஒவ்வொரு endpoint-லும். effort off கொண்ட கோரிக்கைக்கு, அல்லது response_format / text.format கொண்ட கோரிக்கைக்கு, reasoning உரை இல்லாமல் பதில் வரும். |
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro | stream செய்தாலும் செய்யாவிட்டாலும் ஒவ்வொரு endpoint-லும், மாடல் reasoning உரையை உருவாக்கியிருந்தால். |
shannon-2-lite, shannon-2-pro | /v1/chat/completions, stream செய்யாதபோது: message.reasoning_content-ல். tools அல்லது response_format இல்லாத கோரிக்கையில் stream செய்யும்போது: மாடல் reasoning செய்யும் வரை stream : thinking கருத்து வரிகளைக் கொண்டிருக்கும், பிறகு பதில் chunks. /v1/messages, stream செய்யும்போது: உரை block-க்கு முன் ஒரு thinking block. |
shannon-1.6-pro, shannon-coder-1 | stream செய்யப்பட்ட பதில்களிலும், tools கொண்ட கோரிக்கைகளுக்கான பதில்களிலும், மாடல் reasoning உரையை உருவாக்கியிருந்தால். |
/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 டோக்கன்களும் கட்டணமும்
ஹோஸ்ட் செய்யப்பட்ட open-weight மாடல்களில், reasoning டோக்கன்கள் வெளியீட்டு டோக்கன்கள்: அவை மாடலின் வெளியீட்டு விலையில் கட்டணம் விதிக்கப்படுகின்றன, வெளியீட்டு எண்ணிக்கையில் அவை ஏற்கனவே சேர்ந்துள்ளன. இங்கே 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 டோக்கன்கள் இதில் கணக்கிடப்படாது. - reasoning வெளியீடாகக் கட்டணம் விதிக்கப்படுவதால், effort நிலை ஒரு செலவு அமைப்பும் ஆகும்:
offreasoning டோக்கன்களை உருவாக்காது. - Shannon மாடல்கள்
prompt_tokens,completion_tokensமற்றும்total_tokens(/v1/messages-ல்input_tokensமற்றும்output_tokens) ஆகியவற்றை reasoning பங்கு இல்லாமல் தெரிவித்து, ஒரு டோக்கனுக்கு ஒரே நிலையான விலையில் கட்டணம் விதிக்கின்றன. மாடல்கள் & விலை
அடுத்த கோரிக்கையில் 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 அல்ல. |
அங்கீகாரம், இருப்பு மற்றும் சர்வர் பிழைகள் ஒவ்வொரு கோரிக்கைக்கும் உள்ளவையே. கையாளுவதில் பிழை