[{"data":1,"prerenderedAt":356},["ShallowReactive",2],{"docs-nav-titles":3,"page-docs_en-\u002Fintegrations\u002Flangchain":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":24,"body":54,"description":348,"extension":349,"eyebrow":350,"meta":351,"navTitle":350,"navigation":198,"path":352,"seo":353,"stem":354,"__hash__":355},"docs_en\u002Fintegrations\u002Flangchain.md",{"type":55,"value":56,"toc":340},"minimark",[57,69,80,85,305,309,325,336],[58,59,60,61,68],"p",{},"This guide connects LangChain (Python) to Laras Router. Every step was checked against the ",[62,63,67],"a",{"href":64,"rel":65},"https:\u002F\u002Fdocs.langchain.com\u002Foss\u002Fpython\u002Fintegrations\u002Fchat\u002Fopenai",[66],"nofollow","LangChain (Python) documentation",".",[58,70,71,72,76,77,68],{},"You need an API key (",[73,74,75],"code",{},"lr_live_…",") and a topped-up balance. New to Laras Router? Start with the ",[62,78,33],{"href":79},"\u002Fquickstart",[81,82,84],"h2",{"id":83},"set-up","Set up",[86,87,88,93,96,125,129,132,153,157,160],"steps",{},[89,90,92],"h3",{"id":91},"install-the-package","Install the package",[58,94,95],{},"Install the integration package.",[97,98,103],"pre",{"className":99,"code":100,"language":101,"meta":102,"style":102},"language-bash shiki shiki-themes github-dark-default github-light-default","pip install -U langchain-openai\n","bash","",[73,104,105],{"__ignoreMap":102},[106,107,110,114,118,122],"span",{"class":108,"line":109},"line",1,[106,111,113],{"class":112},"sjwWW","pip",[106,115,117],{"class":116},"sHdZ9"," install",[106,119,121],{"class":120},"sYnYM"," -U",[106,123,124],{"class":116}," langchain-openai\n",[89,126,128],{"id":127},"set-your-api-key","Set your API key",[58,130,131],{},"Put your key in an environment variable.",[97,133,135],{"className":99,"code":134,"language":101,"meta":102,"style":102},"export LARAS_API_KEY=\"lr_live_your_key_here\"\n",[73,136,137],{"__ignoreMap":102},[106,138,139,143,147,150],{"class":108,"line":109},[106,140,142],{"class":141},"s1PA9","export",[106,144,146],{"class":145},"sUq8j"," LARAS_API_KEY",[106,148,149],{"class":141},"=",[106,151,152],{"class":116},"\"lr_live_your_key_here\"\n",[89,154,156],{"id":155},"create-the-model","Create the model",[58,158,159],{},"Create ChatOpenAI with the Laras Router base URL.",[97,161,169],{"className":162,"code":163,"highlights":164,"language":168,"meta":102,"style":102},"language-python shiki shiki-themes github-dark-default github-light-default","import os\nfrom langchain_openai import ChatOpenAI\n\nllm = ChatOpenAI(\n    model=\"deepseek-flash\",\n    base_url=\"https:\u002F\u002Fapi.larasrouter.com\u002Fv1\",\n    api_key=os.environ[\"LARAS_API_KEY\"],\n    use_responses_api=False,\n)\n\nmessage = llm.invoke(\"Hello!\")\nprint(message.text)\n",[165,166,167],6,7,8,"python",[73,170,171,179,193,200,211,225,239,256,269,275,280,296],{"__ignoreMap":102},[106,172,173,176],{"class":108,"line":109},[106,174,175],{"class":141},"import",[106,177,178],{"class":145}," os\n",[106,180,182,185,188,190],{"class":108,"line":181},2,[106,183,184],{"class":141},"from",[106,186,187],{"class":145}," langchain_openai ",[106,189,175],{"class":141},[106,191,192],{"class":145}," ChatOpenAI\n",[106,194,196],{"class":108,"line":195},3,[106,197,199],{"emptyLinePlaceholder":198},true,"\n",[106,201,203,206,208],{"class":108,"line":202},4,[106,204,205],{"class":145},"llm ",[106,207,149],{"class":141},[106,209,210],{"class":145}," ChatOpenAI(\n",[106,212,214,217,219,222],{"class":108,"line":213},5,[106,215,216],{"class":112},"    model",[106,218,149],{"class":141},[106,220,221],{"class":116},"\"deepseek-flash\"",[106,223,224],{"class":145},",\n",[106,226,229,232,234,237],{"class":227,"line":165},[108,228],"highlight",[106,230,231],{"class":112},"    base_url",[106,233,149],{"class":141},[106,235,236],{"class":116},"\"https:\u002F\u002Fapi.larasrouter.com\u002Fv1\"",[106,238,224],{"class":145},[106,240,242,245,247,250,253],{"class":241,"line":166},[108,228],[106,243,244],{"class":112},"    api_key",[106,246,149],{"class":141},[106,248,249],{"class":145},"os.environ[",[106,251,252],{"class":116},"\"LARAS_API_KEY\"",[106,254,255],{"class":145},"],\n",[106,257,259,262,264,267],{"class":258,"line":167},[108,228],[106,260,261],{"class":112},"    use_responses_api",[106,263,149],{"class":141},[106,265,266],{"class":120},"False",[106,268,224],{"class":145},[106,270,272],{"class":108,"line":271},9,[106,273,274],{"class":145},")\n",[106,276,278],{"class":108,"line":277},10,[106,279,199],{"emptyLinePlaceholder":198},[106,281,283,286,288,291,294],{"class":108,"line":282},11,[106,284,285],{"class":145},"message ",[106,287,149],{"class":141},[106,289,290],{"class":145}," llm.invoke(",[106,292,293],{"class":116},"\"Hello!\"",[106,295,274],{"class":145},[106,297,299,302],{"class":108,"line":298},12,[106,300,301],{"class":120},"print",[106,303,304],{"class":145},"(message.text)\n",[81,306,308],{"id":307},"good-to-know","Good to know",[310,311,312,319],"ul",{},[313,314,315,318],"li",{},[73,316,317],{},"use_responses_api=False"," keeps ChatOpenAI on Chat Completions. Some parameters and built-in tools otherwise switch it to the Responses API, which Laras Router does not implement.",[313,320,321,322,68],{},"LangChain documents that ChatOpenAI follows the official OpenAI specification and does not keep non-standard response fields such as ",[73,323,324],{},"reasoning_content",[58,326,327,328,331,332,68],{},"Settings and screens can change between versions. If something looks different, check the ",[62,329,67],{"href":64,"rel":330},[66],". For other tools, see all ",[62,333,335],{"href":334},"\u002Fintegrations","integrations",[337,338,339],"style",{},"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 .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 .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}",{"title":102,"searchDepth":195,"depth":195,"links":341},[342,347],{"id":83,"depth":181,"text":84,"children":343},[344,345,346],{"id":91,"depth":195,"text":92},{"id":127,"depth":195,"text":128},{"id":155,"depth":195,"text":156},{"id":307,"depth":181,"text":308},"ChatOpenAI from the langchain-openai package. Step-by-step setup with Laras Router.","md",null,{},"\u002Fintegrations\u002Flangchain",{"title":24,"description":348},"integrations\u002Flangchain","c1MIdKAVzuQF4ZXe_sdpeKHja9B5ymZjbfoO1wGUkPg",1793333618927]