[{"data":1,"prerenderedAt":786},["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":777,"extension":778,"eyebrow":779,"meta":780,"navTitle":779,"navigation":781,"path":782,"seo":783,"stem":784,"__hash__":785},"docs_en\u002Fintegrations\u002Fclaude-code.md",{"type":55,"value":56,"toc":766},"minimark",[57,74,87,97,102,299,303,313,431,438,442,448,510,517,521,584,588,750,762],[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-flash",", not Claude, and features that depend on Anthropic's own servers, such as web search and image input, 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 github-dark-default github-light-default","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},"s1PA9","export",[123,132,134],{"class":133},"sUq8j"," ANTHROPIC_BASE_URL",[123,136,137],{"class":129},"=",[123,139,141],{"class":140},"sHdZ9","\"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-flash[1m]\"\nexport ANTHROPIC_DEFAULT_OPUS_MODEL=\"deepseek-flash[1m]\"\nexport ANTHROPIC_DEFAULT_SONNET_MODEL=\"deepseek-flash[1m]\"\nexport ANTHROPIC_DEFAULT_HAIKU_MODEL=\"deepseek-flash\"\nexport CLAUDE_CODE_SUBAGENT_MODEL=\"deepseek-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-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-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 github-dark-default github-light-default","{\n  \"env\": {\n    \"ANTHROPIC_BASE_URL\": \"https:\u002F\u002Fapi.larasrouter.com\",\n    \"ANTHROPIC_AUTH_TOKEN\": \"lr_live_your_key_here\",\n    \"ANTHROPIC_MODEL\": \"deepseek-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_OPUS_MODEL\": \"deepseek-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_SONNET_MODEL\": \"deepseek-flash[1m]\",\n    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\": \"deepseek-flash\",\n    \"CLAUDE_CODE_SUBAGENT_MODEL\": \"deepseek-flash\"\n  }\n}\n","json",[83,319,320,325,334,348,360,372,384,396,409,419,425],{"__ignoreMap":119},[123,321,322],{"class":125,"line":126},[123,323,324],{"class":133},"{\n",[123,326,327,331],{"class":125,"line":144},[123,328,330],{"class":329},"sGSaJ","  \"env\"",[123,332,333],{"class":133},": {\n",[123,335,336,339,342,345],{"class":125,"line":225},[123,337,338],{"class":329},"    \"ANTHROPIC_BASE_URL\"",[123,340,341],{"class":133},": ",[123,343,344],{"class":140},"\"https:\u002F\u002Fapi.larasrouter.com\"",[123,346,347],{"class":133},",\n",[123,349,350,353,355,358],{"class":125,"line":237},[123,351,352],{"class":329},"    \"ANTHROPIC_AUTH_TOKEN\"",[123,354,341],{"class":133},[123,356,357],{"class":140},"\"lr_live_your_key_here\"",[123,359,347],{"class":133},[123,361,362,365,367,370],{"class":125,"line":250},[123,363,364],{"class":329},"    \"ANTHROPIC_MODEL\"",[123,366,341],{"class":133},[123,368,369],{"class":140},"\"deepseek-flash[1m]\"",[123,371,347],{"class":133},[123,373,375,378,380,382],{"class":125,"line":374},6,[123,376,377],{"class":329},"    \"ANTHROPIC_DEFAULT_OPUS_MODEL\"",[123,379,341],{"class":133},[123,381,369],{"class":140},[123,383,347],{"class":133},[123,385,387,390,392,394],{"class":125,"line":386},7,[123,388,389],{"class":329},"    \"ANTHROPIC_DEFAULT_SONNET_MODEL\"",[123,391,341],{"class":133},[123,393,369],{"class":140},[123,395,347],{"class":133},[123,397,399,402,404,407],{"class":125,"line":398},8,[123,400,401],{"class":329},"    \"ANTHROPIC_DEFAULT_HAIKU_MODEL\"",[123,403,341],{"class":133},[123,405,406],{"class":140},"\"deepseek-flash\"",[123,408,347],{"class":133},[123,410,412,415,417],{"class":125,"line":411},9,[123,413,414],{"class":329},"    \"CLAUDE_CODE_SUBAGENT_MODEL\"",[123,416,341],{"class":133},[123,418,247],{"class":140},[123,420,422],{"class":125,"line":421},10,[123,423,424],{"class":133},"  }\n",[123,426,428],{"class":125,"line":427},11,[123,429,430],{"class":133},"}\n",[58,432,433,434,437],{},"Never put the key in a project's ",[83,435,436],{},".claude\u002Fsettings.json",": that file is committed and shared with everyone who clones the repository.",[98,439,441],{"id":440},"check-the-connection-first","Check the connection first",[58,443,444,445,73],{},"To rule out Claude Code itself, send one request with ",[83,446,447],{},"curl",[114,449,451],{"className":116,"code":450,"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-flash\", \"max_tokens\": 16, \"messages\": [{\"role\": \"user\", \"content\": \"Say hi.\"}]}'\n",[83,452,453,468,484,493,502],{"__ignoreMap":119},[123,454,455,458,462,465],{"class":125,"line":126},[123,456,447],{"class":457},"sjwWW",[123,459,461],{"class":460},"sYnYM"," -sS",[123,463,464],{"class":140}," https:\u002F\u002Fapi.larasrouter.com\u002Fv1\u002Fmessages",[123,466,467],{"class":129}," \\\n",[123,469,470,473,476,479,482],{"class":125,"line":144},[123,471,472],{"class":460},"  -H",[123,474,475],{"class":140}," \"x-api-key: ",[123,477,478],{"class":133},"$ANTHROPIC_AUTH_TOKEN",[123,480,481],{"class":140},"\"",[123,483,467],{"class":129},[123,485,486,488,491],{"class":125,"line":225},[123,487,472],{"class":460},[123,489,490],{"class":140}," \"anthropic-version: 2023-06-01\"",[123,492,467],{"class":129},[123,494,495,497,500],{"class":125,"line":237},[123,496,472],{"class":460},[123,498,499],{"class":140}," \"content-type: application\u002Fjson\"",[123,501,467],{"class":129},[123,503,504,507],{"class":125,"line":250},[123,505,506],{"class":460},"  -d",[123,508,509],{"class":140}," '{\"model\": \"deepseek-flash\", \"max_tokens\": 16, \"messages\": [{\"role\": \"user\", \"content\": \"Say hi.\"}]}'\n",[58,511,512,513,516],{},"A JSON reply that starts with ",[83,514,515],{},"{\"id\":\"msg_"," means the key and the model are good.",[98,518,520],{"id":519},"good-to-know","Good to know",[522,523,524,539,547,553,560,570,577],"ul",{},[525,526,527,528,531,532,535,536,538],"li",{},"A ",[83,529,530],{},"[claude-code:unrecognized_model]"," diagnostic line may still print when you run ",[83,533,534],{},"claude -p",". It is informational: Claude Code does not know the model id, and the ",[83,537,265],{}," suffix already gave it the context window.",[525,540,541,542,546],{},"Create a separate API key for Claude Code with a ",[62,543,545],{"href":544},"\u002Fguides\u002Fbilling#key-budgets","monthly budget",". A coding agent resends the whole conversation on every turn, so a long session adds up.",[525,548,549,550,552],{},"Claude Code asks ",[83,551,85],{}," to reason, and reasoning tokens are billed as output. The usage Claude Code shows is the usage you are charged for.",[525,554,555,556,559],{},"Image input is not supported: pasting an image fails with ",[83,557,558],{},"400 invalid_request_error",". Web search runs on Anthropic's servers and is not available.",[525,561,562,565,566,569],{},[83,563,564],{},"POST \u002Fv1\u002Fmessages\u002Fcount_tokens"," is not offered. Claude Code falls back to a character-based estimate, so ",[83,567,568],{},"\u002Fcontext"," shows approximate counts.",[525,571,572,573,576],{},"Streaming keeps the connection alive with ",[83,574,575],{},"ping"," events during long pauses, so Claude Code's idle timeout does not cut a long generation.",[525,578,579,580,583],{},"To stop Claude Code sending background traffic to Anthropic (update checks, telemetry), add ",[83,581,582],{},"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC=1",". It also turns off auto-updates.",[98,585,587],{"id":586},"troubleshooting","Troubleshooting",[589,590,591,607],"table",{},[592,593,594],"thead",{},[595,596,597,601,604],"tr",{},[598,599,600],"th",{},"You see",[598,602,603],{},"Cause",[598,605,606],{},"Fix",[608,609,610,636,656,675,695,709,732],"tbody",{},[595,611,612,622,625],{},[613,614,615,618,619],"td",{},[83,616,617],{},"404"," with ",[83,620,621],{},"model_not_found",[613,623,624],{},"A Claude model name reached Laras Router",[613,626,627,628,631,632,635],{},"Set ",[83,629,630],{},"ANTHROPIC_MODEL"," and the ",[83,633,634],{},"ANTHROPIC_DEFAULT_*_MODEL"," variables from the steps above",[595,637,638,641,646],{},[613,639,640],{},"A startup warning that Claude Code \"assumes a context window of 200k tokens\"",[613,642,643,644],{},"The model was set without ",[83,645,265],{},[613,647,648,649,652,653,655],{},"Use ",[83,650,651],{},"deepseek-flash[1m]"," for ",[83,654,630],{},", Opus, and Sonnet, as in the steps above",[595,657,658,666,669],{},[613,659,660,618,663],{},[83,661,662],{},"401",[83,664,665],{},"authentication_error",[613,667,668],{},"The key is wrong, revoked, or truncated",[613,670,671,672,674],{},"Copy the key again from the console. Check ",[83,673,286],{}," for which variable is in use",[595,676,677,685,688],{},[613,678,679,618,682],{},[83,680,681],{},"402",[83,683,684],{},"billing_error",[613,686,687],{},"The balance or the key's budget cannot cover the request",[613,689,690,694],{},[62,691,693],{"href":692},"\u002Fguides\u002Ftop-up","Top up"," or raise the key's budget",[595,696,697,703,706],{},[613,698,699,702],{},[83,700,701],{},"400"," mentioning an image",[613,704,705],{},"An image was attached",[613,707,708],{},"Remove it; the model takes text only",[595,710,711,719,722],{},[613,712,713,618,716],{},[83,714,715],{},"429",[83,717,718],{},"rate_limit_error",[613,720,721],{},"The key hit its request or concurrency limit",[613,723,724,725,728,729],{},"Wait for ",[83,726,727],{},"Retry-After",". See ",[62,730,10],{"href":731},"\u002Fguides\u002Frate-limits",[595,733,734,737,740],{},[613,735,736],{},"Claude Code asks you to log in",[613,738,739],{},"It found no credential in the environment it started with",[613,741,627,742,744,745,747,748],{},[83,743,168],{}," in a shell export or in ",[83,746,312],{},", then restart ",[83,749,282],{},[58,751,752,753,757,758,73],{},"Settings and screens can change between versions. If something looks different, check the ",[62,754,756],{"href":69,"rel":755},[71],"Claude Code documentation",". For other tools, see all ",[62,759,761],{"href":760},"\u002Fintegrations","integrations",[763,764,765],"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 .sHdZ9, html code.shiki .sHdZ9{--shiki-default:#A5D6FF;--shiki-light:#0A3069}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 .sGSaJ, html code.shiki .sGSaJ{--shiki-default:#7EE787;--shiki-light:#116329}html pre.shiki code .sjwWW, html code.shiki .sjwWW{--shiki-default:#FFA657;--shiki-light:#953800}html pre.shiki code .sYnYM, html code.shiki .sYnYM{--shiki-default:#79C0FF;--shiki-light:#0550AE}",{"title":119,"searchDepth":225,"depth":225,"links":767},[768,773,774,775,776],{"id":100,"depth":144,"text":101,"children":769},[770,771,772],{"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":440,"depth":144,"text":441},{"id":519,"depth":144,"text":520},{"id":586,"depth":144,"text":587},"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":777},"integrations\u002Fclaude-code","HJp4MIDGq5KjXPht36dOiTpsJN0pu-IwJCu5ppRxp9s",1793333617473]