Ymdrech rhesymu
Mae model sy'n rhesymu yn dychwelyd ei destun rhesymu wrth ymyl yr ateb, mewn maes ei hun. Ar y modelau pwysau agored a gynhelir mae un maes cais yn gosod pa mor ddwfn y mae'r model yn rhesymu cyn iddo ateb.
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?"}
]
}' Mae'r ateb yn cario'r testun rhesymu yn reasoning_content, yr ateb yn content, a'r tokenau rhesymu yn 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}
}
} Pa fodelau sy'n rhesymu
| Model | Yn dychwelyd testun rhesymu | Yn cymhwyso'r maes ymdrech |
|---|---|---|
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 | Ydy | — |
| Pob model pwysau agored a gynhelir | Ydy | Ydy |
Dyma'r baneri capabilities.reasoning a capabilities.reasoning_effort y mae GET /v1/models yn eu hadrodd am bob id. Mae ateb yn cario testun rhesymu dim ond pan gynhyrchodd y model beth. Modelau a phrisiau
Gosod yr ymdrech
Mae gan bob pwynt terfyn ei sillafiad ei hun o'r ymdrech. Mae pob un ohonynt yn dewis un o'r un pedair lefel.
| Maes | Math | Rhagosodiad | Disgrifiad | Yn cael ei gymhwyso gan |
|---|---|---|---|---|
reasoning_effort | string | high | /v1/chat/completions. Pa mor ddwfn y mae'r model yn rhesymu cyn iddo ateb: off, low, medium neu high. | Modelau pwysau agored a gynhelir |
reasoning | object | string | /v1/chat/completions. Yr un gwerth fel {"effort": "low"} neu fel llinyn noeth. Pan anfonir y ddau faes, defnyddir reasoning_effort. | Modelau pwysau agored a gynhelir | |
reasoning.effort | string | high | /v1/responses. Wedi'i ysgrifennu fel y gwrthrych {"effort": "low"}. | Modelau pwysau agored a gynhelir |
thinking | object | /v1/messages. {"type": "enabled", "budget_tokens": n} neu {"type": "disabled"}. Mae'r gyllideb yn dewis un o'r lefelau; gweler y tabl ymhellach i lawr. | Modelau pwysau agored a gynhelir |
{
"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?"}]
} | Gwerth | Derbynnir hefyd | Effaith |
|---|---|---|
off | none, minimal | Dim rhesymu. Nid yw'r ateb yn cario testun rhesymu. |
low | Rhesymu byr. | |
medium | default | Dyfnder canolig. |
high | xhigh, max | Y lefel ddyfnaf. Dyma lefel cais nad yw'n anfon gwerth. |
- Darllenir gwerthoedd heb ystyried priflythrennau na llythrennau bach.
- Mae'r gwerth
defaultyn golygumedium. Mae gadael y maes allan yn golyguhigh. - Mae'r modelau Shannon (
shannon-*) yn gosod eu dyfnder eu hunain ym mhob cais; maeGET /v1/modelsyn adroddreasoning_effort: falsear eu cyfer.
Y gyllideb thinking ar /v1/messages
Ar /v1/messages mae'r maes thinking yn dewis y lefel. Mae budget_tokens yn dewis un o'r lefelau uchod; nid yw'n derfyn tokenau ar ei ben ei hun. Darllenir adaptive fel enabled.
| Rydych yn anfon | Lefel |
|---|---|
{"type": "disabled"} | off |
{"type": "enabled", "budget_tokens": n} gydag n hyd at 2,048 | low |
n o 2,049 i 8,192 | medium |
n mwy, neu enabled heb budget_tokens | high |
Dim maes thinking | high |
Ble mae'r testun rhesymu yn cyrraedd
Mae testun rhesymu bob amser ar wahân i'r ateb. Mae gan bob fformat ei le ei hun iddo:
| Pwynt terfyn | Heb ei ffrydio | Wedi'i ffrydio |
|---|---|---|
/v1/chat/completions | choices[0].message.reasoning_content: llinyn, neu null pan na chynhyrchodd y model ddim. | Darnau gyda choices[0].delta.reasoning_content, cyn y darnau gyda delta.content. |
/v1/responses | Eitem output {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} cyn yr eitem message. Dim eitem pan nad oes rhesymu. | response.output_item.added gydag eitem reasoning, yna digwyddiadau response.reasoning_summary_text.delta ac un response.reasoning_summary_text.done. |
/v1/messages | Bloc cynnwys cyntaf {"type": "thinking", "thinking": "…"}, yna'r bloc text. Dim bloc thinking pan nad oes rhesymu. | Bloc cynnwys thinking: content_block_start, digwyddiadau content_block_delta gyda thinking_delta, content_block_stop. Mae'r bloc testun yn dilyn. |
{
"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
}
} Ble i edrych, fesul model:
| Modelau | Ble mae'r testun yn cyrraedd |
|---|---|
| Modelau pwysau agored a gynhelir | Ar bob pwynt terfyn, wedi'i ffrydio neu beidio. Atebir cais gydag ymdrech off, neu gyda response_format / text.format, heb destun rhesymu, ac mae rhai atebion eraill yn dod hebddo hefyd: trinwch y rhesymu bob amser fel rhywbeth dewisol. |
Modelau Shannon (shannon-1.6-*, shannon-2-*, shannon-3*, shannon-coder-1) | Unman. Mae'r model yn rhesymu cyn ateb, ond nid yw'r ateb yn cario testun rhesymu ar unrhyw bwynt terfyn, ac nid yw'r rhesymu'n cael ei gyfrif yn usage na'i godi. Gall ffrwd gario llinellau sylw tra bydd y model yn rhesymu. |
Ar /v1/responses, mae ateb heb ei ffrydio yn cario'r eitem reasoning ar gyfer teulu Shannon 3 a'r modelau pwysau agored a gynhelir.
Darllen ffrwd
Mewn ffrwd daw'r testun rhesymu yn gyntaf, mewn deltâu ei hun, ac mae'r ateb yn dilyn. Argraffwch neu cadwch y ddau ar wahân:
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?"}
]
}' Mae darn cyntaf model pwysau agored a gynhelir, rhesymu neu ateb, hefyd yn cario delta.role: "assistant". Ffrydio
Tokenau rhesymu a biliau
Ar y modelau pwysau agored a gynhelir, mae tokenau rhesymu yn dokenau allbwn: fe'u codir am bris allbwn y model, ac mae cyfrif yr allbwn eisoes yn eu cynnwys. Mae usage yn dangos cyfran y rhesymu yma:
| Pwynt terfyn | Maes | Nodyn |
|---|---|---|
/v1/chat/completions | usage.completion_tokens_details.reasoning_tokens | Eisoes wedi'i gynnwys yn completion_tokens. |
/v1/responses | usage.output_tokens_details.reasoning_tokens | Eisoes wedi'i gynnwys yn output_tokens. |
/v1/messages | usage.output_tokens | Rhesymu ac ateb gyda'i gilydd. Nid oes gan y fformat hwn gyfrif ar wahân. |
- Ar y modelau pwysau agored a gynhelir mae
max_tokensyn cyfyngu testun yr ateb. Nid yw tokenau rhesymu yn cyfrif yn ei erbyn. - Gan fod rhesymu yn cael ei godi fel allbwn, mae lefel yr ymdrech hefyd yn osodiad cost: nid yw
offyn cynhyrchu tokenau rhesymu. - Mae'r modelau Shannon yn adrodd
prompt_tokens,completion_tokensatotal_tokens(input_tokensacoutput_tokensar/v1/messages) heb gyfran rhesymu, ac yn codi un pris gwastad am bob tocen. Modelau a phrisiau
Rhesymu yn y cais nesaf
Nid oes rhaid i chi anfon rhesymu yn ôl. Nid yw bloc thinking nac eitem reasoning yn y sgwrs a anfonwch yn cael ei drosglwyddo i'r model, felly gall tro assistant fynd yn ôl gydag ef neu hebddo. Mae gan floc thinking y ddau faes type a thinking; nid oes ganddo signature.
Gwallau
Nid yw gwerth resymu byth yn gwneud i gais fethu. Derbynnir none, minimal, low, medium, high, xhigh a max i gyd, ar bob model a phob endpoint; caiff gwerth y tu allan i'r rhestr, neu un nad yw'n llinyn, ei anwybyddu a defnyddir y lefel ddiofyn.
Mae gwallau dilysu, balans a gweinydd yr un fath ag ar gyfer pob cais. Rheoli gwallau
