[{"data":1,"prerenderedAt":685},["ShallowReactive",2],{"docs-nav-titles":3,"page-docs_en-\u002Fguides\u002Freasoning":52},{"en":4,"id":39},{"\u002Fauthentication":5,"\u002Fchangelog":6,"\u002Fguides\u002Fbilling":7,"\u002Fguides\u002Ferrors":8,"\u002Fguides\u002Fjson-output":9,"\u002Fguides\u002Frate-limits":10,"\u002Fguides\u002Freasoning":11,"\u002Fguides\u002Fstreaming":12,"\u002Fguides\u002Ftool-calling":13,"\u002Fguides\u002Ftop-up":14,"\u002F":15,"\u002Fintegrations\u002Faider":16,"\u002Fintegrations\u002Fclaude-code":17,"\u002Fintegrations\u002Fcline":18,"\u002Fintegrations\u002Fcontinue":19,"\u002Fintegrations\u002Fgoose":20,"\u002Fintegrations\u002Fhermes":21,"\u002Fintegrations":22,"\u002Fintegrations\u002Fkilo-code":23,"\u002Fintegrations\u002Flangchain":24,"\u002Fintegrations\u002Foh-my-pi":25,"\u002Fintegrations\u002Fopenai-sdk":26,"\u002Fintegrations\u002Fopenclaw":27,"\u002Fintegrations\u002Fopencode":28,"\u002Fintegrations\u002Fpi":29,"\u002Fintegrations\u002Fvercel-ai-sdk":30,"\u002Fintegrations\u002Fzed":31,"\u002Fmodels":32,"\u002Fquickstart":33,"\u002Freference\u002Fchat-completions":34,"\u002Freference":22,"\u002Freference\u002Fmessages":35,"\u002Freference\u002Fmodels":36,"\u002Freference\u002Fmodels-retrieve":37,"\u002Fsupport":38},"Authentication","Changelog","Billing","Errors & retries","JSON output","Rate limits","Reasoning content","Streaming","Tool calling","Topping up with QRIS","Introduction","Aider","Claude Code","Cline","Continue","Goose","Hermes Agent","Overview","Kilo Code","LangChain (Python)","Oh My Pi","OpenAI SDKs","OpenClaw","OpenCode","Pi","Vercel AI SDK","Zed","Models","Quickstart","Chat completions","Messages","List models","Retrieve a model","Support",{"\u002Fauthentication":40,"\u002Fchangelog":6,"\u002Fguides\u002Fbilling":7,"\u002Fguides\u002Ferrors":41,"\u002Fguides\u002Fjson-output":42,"\u002Fguides\u002Frate-limits":43,"\u002Fguides\u002Freasoning":44,"\u002Fguides\u002Fstreaming":12,"\u002Fguides\u002Ftool-calling":13,"\u002Fguides\u002Ftop-up":45,"\u002F":46,"\u002Fintegrations\u002Faider":16,"\u002Fintegrations\u002Fclaude-code":17,"\u002Fintegrations\u002Fcline":18,"\u002Fintegrations\u002Fcontinue":19,"\u002Fintegrations\u002Fgoose":20,"\u002Fintegrations\u002Fhermes":21,"\u002Fintegrations":47,"\u002Fintegrations\u002Fkilo-code":23,"\u002Fintegrations\u002Flangchain":24,"\u002Fintegrations\u002Foh-my-pi":25,"\u002Fintegrations\u002Fopenai-sdk":48,"\u002Fintegrations\u002Fopenclaw":27,"\u002Fintegrations\u002Fopencode":28,"\u002Fintegrations\u002Fpi":29,"\u002Fintegrations\u002Fvercel-ai-sdk":30,"\u002Fintegrations\u002Fzed":31,"\u002Fmodels":49,"\u002Fquickstart":33,"\u002Freference\u002Fchat-completions":34,"\u002Freference":47,"\u002Freference\u002Fmessages":35,"\u002Freference\u002Fmodels":50,"\u002Freference\u002Fmodels-retrieve":51,"\u002Fsupport":38},"Autentikasi","Error & retry","Output JSON","Rate limit","Konten reasoning","Isi saldo dengan QRIS","Pengantar","Ringkasan","OpenAI SDK","Model","Daftar model","Ambil satu model",{"id":53,"title":11,"body":54,"description":677,"extension":678,"eyebrow":679,"meta":680,"navTitle":679,"navigation":170,"path":681,"seo":682,"stem":683,"__hash__":684},"docs_en\u002Fguides\u002Freasoning.md",{"type":55,"value":56,"toc":672},"minimark",[57,61,66,110,125,612,616,654,658,668],[58,59,60],"p",{},"DeepSeek-V4.1-Flash uses a thinking mode by default: before writing the answer, it can produce a chain of reasoning. Laras Router passes that reasoning through to you in a separate field, so your users see a clean answer and you can still inspect or log how the model got there.",[62,63,65],"h2",{"id":64},"where-reasoning-appears","Where reasoning appears",[67,68,69,82],"table",{},[70,71,72],"thead",{},[73,74,75,79],"tr",{},[76,77,78],"th",{},"Response type",[76,80,81],{},"Field",[83,84,85,97],"tbody",{},[73,86,87,91],{},[88,89,90],"td",{},"Non-streaming",[88,92,93],{},[94,95,96],"code",{},"choices[0].message.reasoning_content",[73,98,99,101],{},[88,100,12],{},[88,102,103,106,107],{},[94,104,105],{},"choices[0].delta.reasoning_content",", in chunks before ",[94,108,109],{},"delta.content",[58,111,112,113,116,117,120,121,124],{},"The answer itself is always in ",[94,114,115],{},"content",". ",[94,118,119],{},"reasoning_content"," is absent or ",[94,122,123],{},"null"," when the model produced no reasoning.",[126,127,128,378],"code-group",{},[129,130,136],"pre",{"className":131,"code":132,"filename":133,"language":134,"meta":135,"style":135},"language-python shiki shiki-themes github-dark-default github-light-default","import os\nfrom openai import OpenAI\n\nclient = OpenAI(\n    base_url=\"https:\u002F\u002Fapi.larasrouter.com\u002Fv1\",\n    api_key=os.environ[\"LARAS_API_KEY\"],\n)\n\nresponse = client.chat.completions.create(\n    model=\"deepseek-flash\",\n    messages=[{\"role\": \"user\", \"content\": \"Is 1,001 a prime number?\"}],\n    max_tokens=4096,\n)\n\nmessage = response.choices[0].message\n# The OpenAI SDK keeps fields it does not know about, such as reasoning_content.\nprint(\"Reasoning:\", getattr(message, \"reasoning_content\", None))\nprint(\"Answer:\", message.content)\n","Python","python","",[94,137,138,151,165,172,184,200,217,223,228,239,252,286,300,305,310,327,334,365],{"__ignoreMap":135},[139,140,143,147],"span",{"class":141,"line":142},"line",1,[139,144,146],{"class":145},"s1PA9","import",[139,148,150],{"class":149},"sUq8j"," os\n",[139,152,154,157,160,162],{"class":141,"line":153},2,[139,155,156],{"class":145},"from",[139,158,159],{"class":149}," openai ",[139,161,146],{"class":145},[139,163,164],{"class":149}," OpenAI\n",[139,166,168],{"class":141,"line":167},3,[139,169,171],{"emptyLinePlaceholder":170},true,"\n",[139,173,175,178,181],{"class":141,"line":174},4,[139,176,177],{"class":149},"client ",[139,179,180],{"class":145},"=",[139,182,183],{"class":149}," OpenAI(\n",[139,185,187,191,193,197],{"class":141,"line":186},5,[139,188,190],{"class":189},"sjwWW","    base_url",[139,192,180],{"class":145},[139,194,196],{"class":195},"sHdZ9","\"https:\u002F\u002Fapi.larasrouter.com\u002Fv1\"",[139,198,199],{"class":149},",\n",[139,201,203,206,208,211,214],{"class":141,"line":202},6,[139,204,205],{"class":189},"    api_key",[139,207,180],{"class":145},[139,209,210],{"class":149},"os.environ[",[139,212,213],{"class":195},"\"LARAS_API_KEY\"",[139,215,216],{"class":149},"],\n",[139,218,220],{"class":141,"line":219},7,[139,221,222],{"class":149},")\n",[139,224,226],{"class":141,"line":225},8,[139,227,171],{"emptyLinePlaceholder":170},[139,229,231,234,236],{"class":141,"line":230},9,[139,232,233],{"class":149},"response ",[139,235,180],{"class":145},[139,237,238],{"class":149}," client.chat.completions.create(\n",[139,240,242,245,247,250],{"class":141,"line":241},10,[139,243,244],{"class":189},"    model",[139,246,180],{"class":145},[139,248,249],{"class":195},"\"deepseek-flash\"",[139,251,199],{"class":149},[139,253,255,258,260,263,266,269,272,275,278,280,283],{"class":141,"line":254},11,[139,256,257],{"class":189},"    messages",[139,259,180],{"class":145},[139,261,262],{"class":149},"[{",[139,264,265],{"class":195},"\"role\"",[139,267,268],{"class":149},": ",[139,270,271],{"class":195},"\"user\"",[139,273,274],{"class":149},", ",[139,276,277],{"class":195},"\"content\"",[139,279,268],{"class":149},[139,281,282],{"class":195},"\"Is 1,001 a prime number?\"",[139,284,285],{"class":149},"}],\n",[139,287,289,292,294,298],{"class":141,"line":288},12,[139,290,291],{"class":189},"    max_tokens",[139,293,180],{"class":145},[139,295,297],{"class":296},"sYnYM","4096",[139,299,199],{"class":149},[139,301,303],{"class":141,"line":302},13,[139,304,222],{"class":149},[139,306,308],{"class":141,"line":307},14,[139,309,171],{"emptyLinePlaceholder":170},[139,311,313,316,318,321,324],{"class":141,"line":312},15,[139,314,315],{"class":149},"message ",[139,317,180],{"class":145},[139,319,320],{"class":149}," response.choices[",[139,322,323],{"class":296},"0",[139,325,326],{"class":149},"].message\n",[139,328,330],{"class":141,"line":329},16,[139,331,333],{"class":332},"shPRk","# The OpenAI SDK keeps fields it does not know about, such as reasoning_content.\n",[139,335,337,340,343,346,348,351,354,357,359,362],{"class":141,"line":336},17,[139,338,339],{"class":296},"print",[139,341,342],{"class":149},"(",[139,344,345],{"class":195},"\"Reasoning:\"",[139,347,274],{"class":149},[139,349,350],{"class":296},"getattr",[139,352,353],{"class":149},"(message, ",[139,355,356],{"class":195},"\"reasoning_content\"",[139,358,274],{"class":149},[139,360,361],{"class":296},"None",[139,363,364],{"class":149},"))\n",[139,366,368,370,372,375],{"class":141,"line":367},18,[139,369,339],{"class":296},[139,371,342],{"class":149},[139,373,374],{"class":195},"\"Answer:\"",[139,376,377],{"class":149},", message.content)\n",[129,379,384],{"className":380,"code":381,"filename":382,"language":383,"meta":135,"style":135},"language-typescript shiki shiki-themes github-dark-default github-light-default","import OpenAI from \"openai\";\n\nconst client = new OpenAI({\n  baseURL: \"https:\u002F\u002Fapi.larasrouter.com\u002Fv1\",\n  apiKey: process.env.LARAS_API_KEY,\n});\n\nconst response = await client.chat.completions.create({\n  model: \"deepseek-flash\",\n  messages: [{ role: \"user\", content: \"Is 1,001 a prime number?\" }],\n  max_tokens: 4096,\n});\n\n\u002F\u002F reasoning_content is not in the SDK's types; read it from the raw message.\nconst message = response.choices[0].message as {\n  content: string | null;\n  reasoning_content?: string | null;\n};\nconsole.log(\"Reasoning:\", message.reasoning_content);\nconsole.log(\"Answer:\", message.content);\n","Node.js","typescript",[94,385,386,401,405,426,435,445,450,454,474,483,498,507,511,515,520,542,561,577,582,598],{"__ignoreMap":135},[139,387,388,390,393,395,398],{"class":141,"line":142},[139,389,146],{"class":145},[139,391,392],{"class":149}," OpenAI ",[139,394,156],{"class":145},[139,396,397],{"class":195}," \"openai\"",[139,399,400],{"class":149},";\n",[139,402,403],{"class":141,"line":153},[139,404,171],{"emptyLinePlaceholder":170},[139,406,407,410,413,416,419,423],{"class":141,"line":167},[139,408,409],{"class":145},"const",[139,411,412],{"class":296}," client",[139,414,415],{"class":145}," =",[139,417,418],{"class":145}," new",[139,420,422],{"class":421},"sK34n"," OpenAI",[139,424,425],{"class":149},"({\n",[139,427,428,431,433],{"class":141,"line":174},[139,429,430],{"class":149},"  baseURL: ",[139,432,196],{"class":195},[139,434,199],{"class":149},[139,436,437,440,443],{"class":141,"line":186},[139,438,439],{"class":149},"  apiKey: process.env.",[139,441,442],{"class":296},"LARAS_API_KEY",[139,444,199],{"class":149},[139,446,447],{"class":141,"line":202},[139,448,449],{"class":149},"});\n",[139,451,452],{"class":141,"line":219},[139,453,171],{"emptyLinePlaceholder":170},[139,455,456,458,461,463,466,469,472],{"class":141,"line":225},[139,457,409],{"class":145},[139,459,460],{"class":296}," response",[139,462,415],{"class":145},[139,464,465],{"class":145}," await",[139,467,468],{"class":149}," client.chat.completions.",[139,470,471],{"class":421},"create",[139,473,425],{"class":149},[139,475,476,479,481],{"class":141,"line":230},[139,477,478],{"class":149},"  model: ",[139,480,249],{"class":195},[139,482,199],{"class":149},[139,484,485,488,490,493,495],{"class":141,"line":241},[139,486,487],{"class":149},"  messages: [{ role: ",[139,489,271],{"class":195},[139,491,492],{"class":149},", content: ",[139,494,282],{"class":195},[139,496,497],{"class":149}," }],\n",[139,499,500,503,505],{"class":141,"line":254},[139,501,502],{"class":149},"  max_tokens: ",[139,504,297],{"class":296},[139,506,199],{"class":149},[139,508,509],{"class":141,"line":288},[139,510,449],{"class":149},[139,512,513],{"class":141,"line":302},[139,514,171],{"emptyLinePlaceholder":170},[139,516,517],{"class":141,"line":307},[139,518,519],{"class":332},"\u002F\u002F reasoning_content is not in the SDK's types; read it from the raw message.\n",[139,521,522,524,527,529,531,533,536,539],{"class":141,"line":312},[139,523,409],{"class":145},[139,525,526],{"class":296}," message",[139,528,415],{"class":145},[139,530,320],{"class":149},[139,532,323],{"class":296},[139,534,535],{"class":149},"].message ",[139,537,538],{"class":145},"as",[139,540,541],{"class":149}," {\n",[139,543,544,547,550,553,556,559],{"class":141,"line":329},[139,545,546],{"class":189},"  content",[139,548,549],{"class":145},":",[139,551,552],{"class":296}," string",[139,554,555],{"class":145}," |",[139,557,558],{"class":296}," null",[139,560,400],{"class":149},[139,562,563,566,569,571,573,575],{"class":141,"line":336},[139,564,565],{"class":189},"  reasoning_content",[139,567,568],{"class":145},"?:",[139,570,552],{"class":296},[139,572,555],{"class":145},[139,574,558],{"class":296},[139,576,400],{"class":149},[139,578,579],{"class":141,"line":367},[139,580,581],{"class":149},"};\n",[139,583,585,588,591,593,595],{"class":141,"line":584},19,[139,586,587],{"class":149},"console.",[139,589,590],{"class":421},"log",[139,592,342],{"class":149},[139,594,345],{"class":195},[139,596,597],{"class":149},", message.reasoning_content);\n",[139,599,601,603,605,607,609],{"class":141,"line":600},20,[139,602,587],{"class":149},[139,604,590],{"class":421},[139,606,342],{"class":149},[139,608,374],{"class":195},[139,610,611],{"class":149},", message.content);\n",[62,613,615],{"id":614},"cost-and-limits","Cost and limits",[617,618,619,631,648],"ul",{},[620,621,622,626,627,630],"li",{},[623,624,625],"strong",{},"Reasoning is output."," Reasoning tokens are included in ",[94,628,629],{},"usage.completion_tokens"," and billed at the output price, $1.600 per 1M tokens.",[620,632,633,640,641,644,645,647],{},[623,634,635,636,639],{},"Reasoning counts toward ",[94,637,638],{},"max_tokens","."," With the default cap of 8,192 tokens, a long chain of reasoning can leave little room for the answer. If responses stop with ",[94,642,643],{},"finish_reason: \"length\"",", raise ",[94,646,638],{}," (up to 384,000).",[620,649,650,653],{},[623,651,652],{},"Don't show it by default."," Reasoning is useful for debugging and evaluation, but it can be long and is not written for end users.",[62,655,657],{"id":656},"in-multi-turn-conversations","In multi-turn conversations",[58,659,660,661,664,665,667],{},"Laras Router forwards your ",[94,662,663],{},"messages"," as you send them. For the next turn, append the assistant's answer from ",[94,666,115],{},"; see DeepSeek's API documentation for how the model treats earlier reasoning in a conversation.",[669,670,671],"style",{},"html pre.shiki code .s1PA9, html code.shiki .s1PA9{--shiki-default:#FF7B72;--shiki-light:#CF222E}html pre.shiki code .sUq8j, html code.shiki .sUq8j{--shiki-default:#E6EDF3;--shiki-light:#1F2328}html pre.shiki code .sjwWW, html code.shiki .sjwWW{--shiki-default:#FFA657;--shiki-light:#953800}html pre.shiki code .sHdZ9, html code.shiki .sHdZ9{--shiki-default:#A5D6FF;--shiki-light:#0A3069}html pre.shiki code .sYnYM, html code.shiki .sYnYM{--shiki-default:#79C0FF;--shiki-light:#0550AE}html pre.shiki code .shPRk, html code.shiki .shPRk{--shiki-default:#8B949E;--shiki-light:#6E7781}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html pre.shiki code .sK34n, html code.shiki .sK34n{--shiki-default:#D2A8FF;--shiki-light:#8250DF}",{"title":135,"searchDepth":167,"depth":167,"links":673},[674,675,676],{"id":64,"depth":153,"text":65},{"id":614,"depth":153,"text":615},{"id":656,"depth":153,"text":657},"deepseek-flash can think before it answers. Its reasoning is returned in reasoning_content and billed as output tokens.","md",null,{},"\u002Fguides\u002Freasoning",{"title":11,"description":677},"guides\u002Freasoning","Fc-5HW11ZjyUvngpAAIO35lwkxgMCWPgyh3V757sKUM",1793333617467]