Peke ki ngā ihirangi
Reasoning effort

Reasoning effort

Hou

Ka whakahoki tētahi model e whakaaro ana i tana kuputuhi reasoning i te taha o te whakautu, i tētahi āpure motuhake. I runga i ngā model open-weight hosted ka tautuhi tētahi āpure tono i te hōhonu o te whakaaro a te model i mua i tana whakautu.

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)

Ka kawe te whakautu i te kuputuhi reasoning i te reasoning_content, te whakautu i te content, me ngā token reasoning i te usage:

200 JSON
{
  "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}
  }
}

Ko ēhea model e whakaaro ana

Model Ka whakahoki i te kuputuhi reasoning Ka whakamahi i te āpure 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 Āe —
Ia model open-weight hosted Āe Āe

Koinei ngā haki capabilities.reasoning me capabilities.reasoning_effort ka pūrongo te GET /v1/models mō ia id. Ka kawe anake tētahi whakautu i te kuputuhi reasoning ina whakaputa te model i tētahi. Ngā model me ngā utu

Te tautuhi i te effort

He tuhinga motuhake tā ia endpoint mō te effort. Ka kōwhiri katoa i tētahi o ngā taumata e whā ōrite.

Āpure Momo Taunoa Whakaahuatanga Whakamahia e
reasoning_effort string high /v1/chat/completions. Te hōhonu o te whakaaro a te model i mua i tana whakautu: off, low, medium high rānei. Ngā model open-weight hosted
reasoning object | string /v1/chat/completions. Te uara ōrite hei {"effort": "low"} hei aho kau rānei. Ina tukuna ngā āpure e rua, ka tatau te reasoning_effort. Ngā model open-weight hosted
reasoning.effort string high /v1/responses. Kua tuhia hei ahanoa {"effort": "low"}. Ngā model open-weight hosted
thinking object /v1/messages. {"type": "enabled", "budget_tokens": n} {"type": "disabled"} rānei. Ka kōwhiri te tahua i tētahi o ngā taumata; tirohia te ripanga i raro iho. Ngā model open-weight hosted
{
  "model": "Kimi-K3-3BIT-REAP",
  "reasoning_effort": "low",
  "messages": [{"role": "user", "content": "Is 221 a prime number?"}]
}
Uara E whakaaetia ana hoki Pānga
off none, minimal Kāore he reasoning. Kāore te whakautu e kawe i te kuputuhi reasoning.
low He reasoning poto.
medium default Hōhonu waenga.
high max Te taumata hōhonu rawa. Koinei te taumata o tētahi tono kāore e tuku i tētahi uara.
  • Ka pānuitia ngā uara kāore e aro ki te pū nui, pū iti rānei.
  • Ko te tikanga o te uara default ko medium. Ko te waiho i te āpure ko high.
  • Ka tautuhi ngā model Shannon (shannon-*) i tō rātou ake hōhonutanga i ia tono; ka pūrongo te GET /v1/models i te reasoning_effort: false mō rātou.

Te tahua thinking i te /v1/messages

I runga i te /v1/messages ka kōwhiri te āpure thinking i te taumata. Ka kōwhiri te budget_tokens i tētahi o ngā taumata i runga ake nei; ehara ia i te tepe token motuhake. Ka pānuitia te adaptive pēnei i te enabled.

Ka tukuna e koe Taumata
{"type": "disabled"} off
{"type": "enabled", "budget_tokens": n} me te n tae atu ki te 2,048 low
n mai i te 2,049 ki te 8,192 medium
He n nui ake, he enabled rānei me te kore budget_tokens high
Kāore he āpure thinking high

Te wāhi e tae mai ai te kuputuhi reasoning

He motuhake tonu te kuputuhi reasoning i te whakautu. He wāhi motuhake tō ia hōputu mōna:

Endpoint Kāore e stream Stream
/v1/chat/completions choices[0].message.reasoning_content: he aho, null rānei ina kāore he mea i whakaputaina e te model. Ngā chunk me te choices[0].delta.reasoning_content, i mua i ngā chunk me te delta.content.
/v1/responses He tūemi output {"type": "reasoning", "summary": [{"type": "summary_text", "text": "…"}]} i mua i te tūemi message. Kāore he tūemi ina kāore he reasoning. response.output_item.added me tētahi tūemi reasoning, kātahi ngā kaupapa response.reasoning_summary_text.delta me te response.reasoning_summary_text.done kotahi.
/v1/messages He poraka content tuatahi {"type": "thinking", "thinking": "…"}, kātahi ko te poraka text. Kāore he poraka thinking ina kāore he reasoning. He poraka content thinking: ngā kaupapa content_block_start, content_block_delta me te thinking_delta, content_block_stop. Ka whai te poraka kuputuhi.
{
  "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}
  }
}

Te wāhi hei tiro, mō ia model:

Ngā model Te wāhi e tae mai ai te kuputuhi
Ngā model open-weight hosted I ia endpoint, stream, kāore rānei. Ka whakautua tētahi tono me te effort off, me te response_format / text.format rānei, me te kore kuputuhi reasoning.
shannon-3, shannon-3-pro, shannon-3.1, shannon-3.1-pro I ia endpoint, stream, kāore rānei, ina whakaputa te model i te kuputuhi reasoning.
shannon-2-lite, shannon-2-pro /v1/chat/completions, kāore e stream: i te message.reasoning_content. Stream, i tētahi tono kāore he tools he response_format rānei: ka kawe te stream i ngā rārangi kōrero : thinking i a te model e whakaaro ana, kātahi ngā chunk whakautu. /v1/messages, stream: he poraka thinking i mua i te poraka kuputuhi.
shannon-1.6-pro, shannon-coder-1 I ngā whakautu stream me ngā whakautu ki ngā tono e kawe ana i te tools, ina whakaputa te model i te kuputuhi reasoning.

I runga i te /v1/responses, ka kawe tētahi whakautu kāore e stream i te tūemi reasoning mō te whānau Shannon 3 me ngā model open-weight hosted.

Te pānui i tētahi stream

I roto i tētahi stream ka tae mai te kuputuhi reasoning i te tuatahi, i ngā delta motuhake, ā, ka whai te whakautu. Tāngia, tiakina rānei ngā mea e rua ki tēnā, ki tē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-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

Ka kawe hoki te chunk tuatahi o tētahi model open-weight hosted, reasoning, whakautu rānei, i te delta.role: "assistant". Rere

Ngā token reasoning me te utu

I runga i ngā model open-weight hosted, he token output ngā token reasoning: ka whakaritea ki te utu output o te model, ā, kua uru kē rātou ki te tatau output. Ka whakaatu te usage i te wāhanga reasoning i konei:

Endpoint Āpure Tuhipoka
/v1/chat/completions usage.completion_tokens_details.reasoning_tokens Kua uru kē ki te completion_tokens.
/v1/responses usage.output_tokens_details.reasoning_tokens Kua uru kē ki te output_tokens.
/v1/messages usage.output_tokens Te reasoning me te whakautu tahi. Kāore he tatau motuhake i tēnei hōputu.
  • I runga i ngā model open-weight hosted ka whakawhāiti te max_tokens i te kuputuhi whakautu. Kāore e tatau ki a ia ngā token reasoning.
  • Nā te mea ka whakaritea te reasoning hei output, he tautuhinga utu hoki te taumata effort: kāore te off e whakaputa token reasoning.
  • Ka pūrongo ngā model Shannon i te prompt_tokens, completion_tokens me te total_tokens (input_tokens me output_tokens i te /v1/messages) me te kore wāhanga reasoning, ā, ka whakarite i tētahi utu papatahi mō ia token. Ngā model me ngā utu

Te reasoning i te tono e whai ake nei

Kāore koe e hiahia ki te tuku whakamuri i te reasoning. Kāore e tukuna ki te model tētahi poraka thinking tētahi tūemi reasoning rānei i roto i te kōrero ka tukuna e koe, nō reira ka taea te hoki o tētahi hurihanga assistant me te kore rānei. E rua ngā āpure o tētahi poraka thinking, type me thinking; kāore he signature.

Ngā hapa

Tūnga Momo Karere Āhea
400 invalid_request_error unknown reasoning effort '<value>'; expected off, low, medium or high I whiwhi tētahi model open-weight hosted i tētahi uara i waho i te rārangi, hei tauira xhigh. Kāore he mea e tangohia i tō toenga.
422 invalid_request_error Failed to deserialize the JSON body into the target type: … Ehara te reasoning_effort i te aho.

He ōrite ngā hapa whakamotuhēhē, toenga me te tūmau ki ia tono. Whakahaere hapa