[{"data":1,"prerenderedAt":800},["ShallowReactive",2],{"docs-nav-titles":3,"page-docs_en-\u002Fintegrations\u002Fclaude-code":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":17,"body":54,"description":790,"extension":791,"eyebrow":792,"meta":793,"navTitle":792,"navigation":794,"path":795,"seo":796,"stem":797,"updatedAt":798,"__hash__":799},"docs_en\u002Fintegrations\u002Fclaude-code.md",{"type":55,"value":56,"toc":779},"minimark",[57,74,87,97,102,299,303,313,430,437,441,447,501,508,512,581,585,763,775],[58,59,60,61,66,67,73],"p",{},"This guide connects Claude Code to Laras Router through the ",[62,63,65],"a",{"href":64},"\u002Freference\u002Fmessages","Anthropic Messages API",". The connection settings were checked against the ",[62,68,72],{"href":69,"rel":70},"https:\u002F\u002Fcode.claude.com\u002Fdocs\u002Fen\u002Fllm-gateway-connect",[71],"nofollow","Claude Code gateway documentation",".",[75,76,79],"callout",{"title":77,"type":78},"Not an Anthropic-supported setup","warning",[58,80,81,82,86],{},"Anthropic does not support routing Claude Code to non-Claude models through a gateway. This works because Laras Router speaks the same API, but the model is ",[83,84,85],"code",{},"deepseek-v4.1-flash",", not Claude, and features that depend on Anthropic's own servers, such as web search, are not available.",[58,88,89,90,93,94,73],{},"You need an API key (",[83,91,92],{},"lr_live_…",") and a topped-up balance. New to Laras Router? Start with the ",[62,95,33],{"href":96},"\u002Fquickstart",[98,99,101],"h2",{"id":100},"set-up","Set up",[103,104,105,110,113,155,182,186,195,260,270,273,277],"steps",{},[106,107,109],"h3",{"id":108},"point-claude-code-at-laras-router","Point Claude Code at Laras Router",[58,111,112],{},"Set the base URL and your key in the shell you start Claude Code from.",[114,115,120],"pre",{"className":116,"code":117,"language":118,"meta":119,"style":119},"language-bash shiki shiki-themes laras-ink","export ANTHROPIC_BASE_URL=\"https:\u002F\u002Fapi.larasrouter.com\"\nexport ANTHROPIC_AUTH_TOKEN=\"lr_live_your_key_here\"\n","bash","",[83,121,122,142],{"__ignoreMap":119},[123,124,127,131,135,138],"span",{"class":125,"line":126},"line",1,[123,128,130],{"class":129},"sifj9","export",[123,132,134],{"class":133},"snt3o"," ANTHROPIC_BASE_URL",[123,136,137],{"class":129},"=",[123,139,141],{"class":140},"sIGQv","\"https:\u002F\u002Fapi.larasrouter.com\"\n",[123,143,145,147,150,152],{"class":125,"line":144},2,[123,146,130],{"class":129},[123,148,149],{"class":133}," ANTHROPIC_AUTH_TOKEN",[123,151,137],{"class":129},[123,153,154],{"class":140},"\"lr_live_your_key_here\"\n",[58,156,157,158,161,162,165,166,169,170,173,174,177,178,181],{},"Leave ",[83,159,160],{},"\u002Fv1"," off the base URL: Claude Code adds ",[83,163,164],{},"\u002Fv1\u002Fmessages"," itself. ",[83,167,168],{},"ANTHROPIC_AUTH_TOKEN"," sends the key as ",[83,171,172],{},"Authorization: Bearer",", and ",[83,175,176],{},"ANTHROPIC_API_KEY"," sends it as ",[83,179,180],{},"x-api-key",". Laras Router accepts both.",[106,183,185],{"id":184},"choose-the-model","Choose the model",[58,187,188,189,192,193,73],{},"Claude Code sends Claude model names unless you tell it otherwise, and Laras Router answers those with ",[83,190,191],{},"404 model_not_found",". Point every role at ",[83,194,85],{},[114,196,198],{"className":116,"code":197,"language":118,"meta":119,"style":119},"export ANTHROPIC_MODEL=\"deepseek-v4.1-flash[1m]\"\nexport ANTHROPIC_DEFAULT_OPUS_MODEL=\"deepseek-v4.1-flash[1m]\"\nexport ANTHROPIC_DEFAULT_SONNET_MODEL=\"deepseek-v4.1-flash[1m]\"\nexport ANTHROPIC_DEFAULT_HAIKU_MODEL=\"deepseek-v4.1-flash\"\nexport CLAUDE_CODE_SUBAGENT_MODEL=\"deepseek-v4.1-flash\"\n",[83,199,200,212,223,235,248],{"__ignoreMap":119},[123,201,202,204,207,209],{"class":125,"line":126},[123,203,130],{"class":129},[123,205,206],{"class":133}," ANTHROPIC_MODEL",[123,208,137],{"class":129},[123,210,211],{"class":140},"\"deepseek-v4.1-flash[1m]\"\n",[123,213,214,216,219,221],{"class":125,"line":144},[123,215,130],{"class":129},[123,217,218],{"class":133}," ANTHROPIC_DEFAULT_OPUS_MODEL",[123,220,137],{"class":129},[123,222,211],{"class":140},[123,224,226,228,231,233],{"class":125,"line":225},3,[123,227,130],{"class":129},[123,229,230],{"class":133}," ANTHROPIC_DEFAULT_SONNET_MODEL",[123,232,137],{"class":129},[123,234,211],{"class":140},[123,236,238,240,243,245],{"class":125,"line":237},4,[123,239,130],{"class":129},[123,241,242],{"class":133}," ANTHROPIC_DEFAULT_HAIKU_MODEL",[123,244,137],{"class":129},[123,246,247],{"class":140},"\"deepseek-v4.1-flash\"\n",[123,249,251,253,256,258],{"class":125,"line":250},5,[123,252,130],{"class":129},[123,254,255],{"class":133}," CLAUDE_CODE_SUBAGENT_MODEL",[123,257,137],{"class":129},[123,259,247],{"class":140},[58,261,262,263,266,267,269],{},"The ",[83,264,265],{},"[1m]"," suffix tells Claude Code that the model has a 1M-token context window. Without it, Claude Code does not recognize ",[83,268,85],{},", assumes 200k tokens, warns at startup, and compacts the conversation far earlier than it needs to. Claude Code removes the suffix before it sends the request.",[58,271,272],{},"The Haiku and subagent variables matter: Claude Code uses those models for background tasks and subagents, and a request for any other name fails.",[106,274,276],{"id":275},"start-claude-code","Start Claude Code",[58,278,279,280,283,284,287,288,291,292,295,296,298],{},"Run ",[83,281,282],{},"claude",", then ",[83,285,286],{},"\u002Fstatus",". The ",[83,289,290],{},"Anthropic base URL"," line should show ",[83,293,294],{},"https:\u002F\u002Fapi.larasrouter.com"," and the credential line should name ",[83,297,168],{},". Send a message to confirm it answers.",[98,300,302],{"id":301},"keep-it-in-a-settings-file","Keep it in a settings file",[58,304,305,306,309,310,73],{},"Shell exports last for one terminal session. To apply the settings everywhere Claude Code runs, put them in the ",[83,307,308],{},"env"," block of ",[83,311,312],{},"~\u002F.claude\u002Fsettings.json",[114,314,318],{"className":315,"code":316,"filename":312,"language":317,"meta":119,"style":119},"language-json shiki shiki-themes laras-ink","{\n  \"env\": {\n    \"ANTHROPIC_BASE_URL\": \"https:\u002F\u002Fapi.larasrouter.com\",\n    \"ANTHROPIC_AUTH_TOKEN\": \"lr_live_your_key_here\",\n    \"ANTHROPIC_MODEL\": \"deepseek-v4.1-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_OPUS_MODEL\": \"deepseek-v4.1-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_SONNET_MODEL\": \"deepseek-v4.1-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\": \"deepseek-v4.1-flash\",\n    \"CLAUDE_CODE_SUBAGENT_MODEL\": \"deepseek-v4.1-flash\"\n  }\n}\n","json",[83,319,320,325,333,347,359,371,383,395,408,418,424],{"__ignoreMap":119},[123,321,322],{"class":125,"line":126},[123,323,324],{"class":133},"{\n",[123,326,327,330],{"class":125,"line":144},[123,328,329],{"class":133},"  \"env\"",[123,331,332],{"class":133},": {\n",[123,334,335,338,341,344],{"class":125,"line":225},[123,336,337],{"class":133},"    \"ANTHROPIC_BASE_URL\"",[123,339,340],{"class":133},": ",[123,342,343],{"class":140},"\"https:\u002F\u002Fapi.larasrouter.com\"",[123,345,346],{"class":133},",\n",[123,348,349,352,354,357],{"class":125,"line":237},[123,350,351],{"class":133},"    \"ANTHROPIC_AUTH_TOKEN\"",[123,353,340],{"class":133},[123,355,356],{"class":140},"\"lr_live_your_key_here\"",[123,358,346],{"class":133},[123,360,361,364,366,369],{"class":125,"line":250},[123,362,363],{"class":133},"    \"ANTHROPIC_MODEL\"",[123,365,340],{"class":133},[123,367,368],{"class":140},"\"deepseek-v4.1-flash[1m]\"",[123,370,346],{"class":133},[123,372,374,377,379,381],{"class":125,"line":373},6,[123,375,376],{"class":133},"    \"ANTHROPIC_DEFAULT_OPUS_MODEL\"",[123,378,340],{"class":133},[123,380,368],{"class":140},[123,382,346],{"class":133},[123,384,386,389,391,393],{"class":125,"line":385},7,[123,387,388],{"class":133},"    \"ANTHROPIC_DEFAULT_SONNET_MODEL\"",[123,390,340],{"class":133},[123,392,368],{"class":140},[123,394,346],{"class":133},[123,396,398,401,403,406],{"class":125,"line":397},8,[123,399,400],{"class":133},"    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\"",[123,402,340],{"class":133},[123,404,405],{"class":140},"\"deepseek-v4.1-flash\"",[123,407,346],{"class":133},[123,409,411,414,416],{"class":125,"line":410},9,[123,412,413],{"class":133},"    \"CLAUDE_CODE_SUBAGENT_MODEL\"",[123,415,340],{"class":133},[123,417,247],{"class":140},[123,419,421],{"class":125,"line":420},10,[123,422,423],{"class":133},"  }\n",[123,425,427],{"class":125,"line":426},11,[123,428,429],{"class":133},"}\n",[58,431,432,433,436],{},"Never put the key in a project's ",[83,434,435],{},".claude\u002Fsettings.json",": that file is committed and shared with everyone who clones the repository.",[98,438,440],{"id":439},"check-the-connection-first","Check the connection first",[58,442,443,444,73],{},"To rule out Claude Code itself, send one request with ",[83,445,446],{},"curl",[114,448,450],{"className":116,"code":449,"language":118,"meta":119,"style":119},"curl -sS https:\u002F\u002Fapi.larasrouter.com\u002Fv1\u002Fmessages \\\n  -H \"x-api-key: $ANTHROPIC_AUTH_TOKEN\" \\\n  -H \"anthropic-version: 2023-06-01\" \\\n  -H \"content-type: application\u002Fjson\" \\\n  -d '{\"model\": \"deepseek-v4.1-flash\", \"max_tokens\": 16, \"messages\": [{\"role\": \"user\", \"content\": \"Say hi.\"}]}'\n",[83,451,452,465,475,484,493],{"__ignoreMap":119},[123,453,454,456,459,462],{"class":125,"line":126},[123,455,446],{"class":140},[123,457,458],{"class":140}," -sS",[123,460,461],{"class":140}," https:\u002F\u002Fapi.larasrouter.com\u002Fv1\u002Fmessages",[123,463,464],{"class":133}," \\\n",[123,466,467,470,473],{"class":125,"line":144},[123,468,469],{"class":140},"  -H",[123,471,472],{"class":140}," \"x-api-key: $ANTHROPIC_AUTH_TOKEN\"",[123,474,464],{"class":133},[123,476,477,479,482],{"class":125,"line":225},[123,478,469],{"class":140},[123,480,481],{"class":140}," \"anthropic-version: 2023-06-01\"",[123,483,464],{"class":133},[123,485,486,488,491],{"class":125,"line":237},[123,487,469],{"class":140},[123,489,490],{"class":140}," \"content-type: application\u002Fjson\"",[123,492,464],{"class":133},[123,494,495,498],{"class":125,"line":250},[123,496,497],{"class":140},"  -d",[123,499,500],{"class":140}," '{\"model\": \"deepseek-v4.1-flash\", \"max_tokens\": 16, \"messages\": [{\"role\": \"user\", \"content\": \"Say hi.\"}]}'\n",[58,502,503,504,507],{},"A JSON reply that starts with ",[83,505,506],{},"{\"id\":\"msg_"," means the key and the model are good.",[98,509,511],{"id":510},"good-to-know","Good to know",[513,514,515,530,538,544,550,557,567,574],"ul",{},[516,517,518,519,522,523,526,527,529],"li",{},"A ",[83,520,521],{},"[claude-code:unrecognized_model]"," diagnostic line may still print when you run ",[83,524,525],{},"claude -p",". It is informational: Claude Code does not know the model id, and the ",[83,528,265],{}," suffix already gave it the context window.",[516,531,532,533,537],{},"Create a separate API key for Claude Code with a ",[62,534,536],{"href":535},"\u002Fguides\u002Fbilling#key-budgets","monthly budget",". A coding agent resends the whole conversation on every turn, so a long session adds up.",[516,539,540,541,543],{},"Claude Code asks ",[83,542,85],{}," to reason, and reasoning tokens are billed as output. The usage Claude Code shows is the usage you are charged for.",[516,545,546,547,549],{},"Images work on ",[83,548,85],{},": you can paste a screenshot, and Claude Code can read image files. Each image is billed as input tokens. Web search runs on Anthropic's servers and is not available.",[516,551,552,553,556],{},"PDFs are not read. When Claude Code reads a PDF, the model gets the note ",[83,554,555],{},"[document omitted: this model does not accept document input]"," instead, and the session keeps going.",[516,558,559,562,563,566],{},[83,560,561],{},"POST \u002Fv1\u002Fmessages\u002Fcount_tokens"," is not offered. Claude Code falls back to a character-based estimate, so ",[83,564,565],{},"\u002Fcontext"," shows approximate counts.",[516,568,569,570,573],{},"Streaming keeps the connection alive with ",[83,571,572],{},"ping"," events during long pauses, so Claude Code's idle timeout does not cut a long generation.",[516,575,576,577,580],{},"To stop Claude Code sending background traffic to Anthropic (update checks, telemetry), add ",[83,578,579],{},"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1",". It also turns off auto-updates.",[98,582,584],{"id":583},"troubleshooting","Troubleshooting",[586,587,588,604],"table",{},[589,590,591],"thead",{},[592,593,594,598,601],"tr",{},[595,596,597],"th",{},"You see",[595,599,600],{},"Cause",[595,602,603],{},"Fix",[605,606,607,633,653,672,692,706,722,745],"tbody",{},[592,608,609,619,622],{},[610,611,612,615,616],"td",{},[83,613,614],{},"404"," with ",[83,617,618],{},"model_not_found",[610,620,621],{},"A Claude model name reached Laras Router",[610,623,624,625,628,629,632],{},"Set ",[83,626,627],{},"ANTHROPIC_MODEL"," and the ",[83,630,631],{},"ANTHROPIC_DEFAULT_*_MODEL"," variables from the steps above",[592,634,635,638,643],{},[610,636,637],{},"A startup warning that Claude Code \"assumes a context window of 200k tokens\"",[610,639,640,641],{},"The model was set without ",[83,642,265],{},[610,644,645,646,649,650,652],{},"Use ",[83,647,648],{},"deepseek-v4.1-flash[1m]"," for ",[83,651,627],{},", Opus, and Sonnet, as in the steps above",[592,654,655,663,666],{},[610,656,657,615,660],{},[83,658,659],{},"401",[83,661,662],{},"authentication_error",[610,664,665],{},"The key is wrong, revoked, or truncated",[610,667,668,669,671],{},"Copy the key again from the console. Check ",[83,670,286],{}," for which variable is in use",[592,673,674,682,685],{},[610,675,676,615,679],{},[83,677,678],{},"402",[83,680,681],{},"billing_error",[610,683,684],{},"The balance or the key's budget cannot cover the request",[610,686,687,691],{},[62,688,690],{"href":689},"\u002Fguides\u002Ftop-up","Top up"," or raise the key's budget",[592,693,694,700,703],{},[610,695,696,699],{},[83,697,698],{},"400"," saying image URLs are not supported",[610,701,702],{},"An image was sent as a URL",[610,704,705],{},"Send the image as a file or a pasted screenshot, which Claude Code sends inline",[592,707,708,713,716],{},[610,709,710,712],{},[83,711,698],{}," saying the model does not accept this input",[610,714,715],{},"An image reached a model without vision, or a PDF was attached to the message",[610,717,718,719,721],{},"For images, point the model variables at ",[83,720,85],{},". Remove a PDF; no model reads documents",[592,723,724,732,735],{},[610,725,726,615,729],{},[83,727,728],{},"429",[83,730,731],{},"rate_limit_error",[610,733,734],{},"The key hit its request or concurrency limit",[610,736,737,738,741,742],{},"Wait for ",[83,739,740],{},"Retry-After",". See ",[62,743,10],{"href":744},"\u002Fguides\u002Frate-limits",[592,746,747,750,753],{},[610,748,749],{},"Claude Code asks you to log in",[610,751,752],{},"It found no credential in the environment it started with",[610,754,624,755,757,758,760,761],{},[83,756,168],{}," in a shell export or in ",[83,759,312],{},", then restart ",[83,762,282],{},[58,764,765,766,770,771,73],{},"Settings and screens can change between versions. If something looks different, check the ",[62,767,769],{"href":69,"rel":768},[71],"Claude Code documentation",". For other tools, see all ",[62,772,774],{"href":773},"\u002Fintegrations","integrations",[776,777,778],"style",{},"html pre.shiki code .sifj9, html code.shiki .sifj9{--shiki-default:#8A8F98}html pre.shiki code .snt3o, html code.shiki .snt3o{--shiki-default:#B4B8BF}html pre.shiki code .sIGQv, html code.shiki .sIGQv{--shiki-default:#F7F8F8}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);}",{"title":119,"searchDepth":225,"depth":225,"links":780},[781,786,787,788,789],{"id":100,"depth":144,"text":101,"children":782},[783,784,785],{"id":108,"depth":225,"text":109},{"id":184,"depth":225,"text":185},{"id":275,"depth":225,"text":276},{"id":301,"depth":144,"text":302},{"id":439,"depth":144,"text":440},{"id":510,"depth":144,"text":511},{"id":583,"depth":144,"text":584},"Anthropic's coding agent for the terminal. Step-by-step setup with Laras Router through the Anthropic Messages API.","md",null,{},true,"\u002Fintegrations\u002Fclaude-code",{"title":17,"description":790},"integrations\u002Fclaude-code","2026-11-15","5xe9qjUW8AhHPxiAQnzHn9UNCyKuzMV_rEuZJdIv6ME",1796424410890]