import{_ as S}from"./index-D9cnrz_s.js";import{r as A,c as b,x as r,z as e,L as h,O as d,Q as m,ac as i,aT as x,P as a,y as o,C as p}from"./vue-vendor-Bsazo-x0.js";import"./element-plus-CqiD73Lu.js";import"./vendor-Dr8jvgFu.js";const I={class:"card p-3 sm:p-6"},E={class:"mb-4 sm:mb-8"},O={class:"flex flex-wrap gap-1 rounded-xl bg-gray-100 p-1 dark:bg-gray-800 sm:gap-2 sm:p-2"},T=["onClick"],P={key:0,class:"tutorial-content"},N={class:"mb-6 sm:mb-10"},L={class:"mb-4 rounded-xl border border-purple-100 bg-gradient-to-r from-purple-50 to-pink-50 p-4 dark:border-purple-500/40 dark:from-purple-950/30 dark:to-pink-950/30 sm:mb-6 sm:p-6"},G={class:"space-y-4"},U={class:"rounded-lg border border-purple-200 bg-white p-3 dark:border-purple-700 dark:bg-gray-800 sm:p-4"},D={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},R={class:"whitespace-nowrap text-gray-300"},H={class:"rounded-lg border border-purple-200 bg-white p-3 dark:border-purple-700 dark:bg-gray-800 sm:p-4"},j={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},K={class:"whitespace-nowrap text-gray-300"},q={class:"mt-3 text-xs text-purple-700 dark:text-purple-300 sm:text-sm"},z={class:"rounded bg-purple-100 px-1 dark:bg-purple-900"},V={class:"rounded bg-purple-100 px-1 dark:bg-purple-900"},$={class:"mt-6 rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"},B={class:"mt-3 space-y-2"},Y={class:"rounded bg-gray-100 p-2 font-mono text-sm dark:bg-gray-700"},W={class:"mt-8"},M={class:"space-y-4"},J={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},F={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Q={class:"whitespace-nowrap text-gray-300"},X={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},Z={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},tt={class:"whitespace-nowrap text-gray-300"},et={class:"mt-8"},at={class:"space-y-4"},st={class:"rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"},dt={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},rt={class:"mt-2 text-xs text-yellow-700 dark:text-yellow-300 sm:text-sm"},ot={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},lt={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},xt={class:"mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},mt={class:"mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300"},it={class:"text-sm font-medium text-yellow-800 dark:text-yellow-200"},nt={class:"space-y-2"},gt={class:"font-medium"},ct={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},vt={class:"whitespace-nowrap text-gray-300"},pt={key:0,class:"space-y-2"},bt={class:"font-medium"},ut={class:"text-xs"},ft={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},yt={class:"mt-8"},wt={class:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"},kt={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},ht={key:1,class:"tutorial-content"},Ct={class:"mb-6 sm:mb-10"},_t={class:"mb-4 rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-yellow-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-yellow-950/30 sm:mb-6 sm:p-6"},St={class:"space-y-4"},At={class:"rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"},It={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Et={class:"whitespace-nowrap text-gray-300"},Ot={class:"rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"},Tt={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Pt={class:"whitespace-nowrap text-gray-300"},Nt={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Lt={class:"whitespace-nowrap text-gray-300"},Gt={class:"mt-3 text-xs text-orange-700 dark:text-orange-300 sm:text-sm"},Ut={class:"rounded bg-orange-100 px-1 dark:bg-orange-900"},Dt={class:"rounded bg-orange-100 px-1 dark:bg-orange-900"},Rt={class:"mt-8"},Ht={class:"space-y-4"},jt={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},Kt={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},qt={class:"whitespace-nowrap text-gray-300"},zt={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},Vt={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},$t={class:"whitespace-nowrap text-gray-300"},Bt={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Yt={class:"whitespace-nowrap text-gray-300"},Wt={class:"mt-8"},Mt={class:"space-y-4"},Jt={class:"rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"},Ft={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Qt={class:"mt-2 text-xs text-yellow-700 dark:text-yellow-300 sm:text-sm"},Xt={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},Zt={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},te={class:"mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},ee={class:"mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300"},ae={class:"text-sm font-medium text-yellow-800 dark:text-yellow-200"},se={class:"space-y-2"},de={class:"font-medium"},re={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},oe={class:"whitespace-nowrap text-gray-300"},le={key:0,class:"space-y-2"},xe={class:"font-medium"},me={class:"text-xs"},ie={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},ne={class:"mt-8"},ge={class:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"},ce={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},ve={key:2,class:"tutorial-content"},pe={class:"mb-6 sm:mb-10"},be={class:"mb-4 rounded-xl border border-orange-100 bg-gradient-to-r from-orange-50 to-yellow-50 p-4 dark:border-orange-500/40 dark:from-orange-950/30 dark:to-yellow-950/30 sm:mb-6 sm:p-6"},ue={class:"space-y-4"},fe={class:"rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"},ye={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},we={class:"whitespace-nowrap text-gray-300"},ke={class:"rounded-lg border border-orange-200 bg-white p-3 dark:border-orange-700 dark:bg-gray-800 sm:p-4"},he={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Ce={class:"whitespace-nowrap text-gray-300"},_e={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Se={class:"whitespace-nowrap text-gray-300"},Ae={class:"mt-3 text-xs text-orange-700 dark:text-orange-300 sm:text-sm"},Ie={class:"rounded bg-orange-100 px-1 dark:bg-orange-900"},Ee={class:"rounded bg-orange-100 px-1 dark:bg-orange-900"},Oe={class:"mt-8"},Te={class:"space-y-4"},Pe={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},Ne={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Le={class:"whitespace-nowrap text-gray-300"},Ge={class:"rounded-lg border border-green-200 bg-white p-3 dark:border-green-700 dark:bg-gray-800 sm:p-4"},Ue={class:"mb-3 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},De={class:"whitespace-nowrap text-gray-300"},Re={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},He={class:"whitespace-nowrap text-gray-300"},je={class:"mt-8"},Ke={class:"space-y-4"},qe={class:"rounded-lg border border-yellow-200 bg-yellow-50 p-3 dark:border-yellow-500/40 dark:bg-yellow-950/30 sm:p-4"},ze={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Ve={class:"mt-2 text-xs text-yellow-700 dark:text-yellow-300 sm:text-sm"},$e={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},Be={class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},Ye={class:"mt-2 overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},We={class:"mt-3 space-y-3 text-xs text-yellow-700 dark:text-yellow-300"},Me={class:"text-sm font-medium text-yellow-800 dark:text-yellow-200"},Je={class:"space-y-2"},Fe={class:"font-medium"},Qe={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},Xe={class:"whitespace-nowrap text-gray-300"},Ze={key:0,class:"space-y-2"},ta={class:"font-medium"},ea={class:"text-xs"},aa={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},sa={class:"mt-8"},da={class:"rounded-lg border border-blue-200 bg-blue-50 p-3 dark:border-blue-500/40 dark:bg-blue-950/30 sm:p-4"},ra={class:"overflow-x-auto rounded bg-gray-900 p-2 font-mono text-xs text-green-400 sm:p-3 sm:text-sm"},oa={__name:"TutorialView",setup(la){const u=A("windows"),_=[{key:"windows",name:"Windows",icon:"fab fa-windows"},{key:"macos",name:"macOS",icon:"fab fa-apple"},{key:"linux",name:"Linux / WSL2",icon:"fab fa-linux"}],f=()=>{let c="";if(window.location.origin)c=window.location.origin;else{const t=window.location.protocol,s=window.location.hostname,g=window.location.port;c=t+"//"+s,g&&(t==="http:"&&g!=="80"||t==="https:"&&g!=="443")&&(c+=":"+g)}if(!c){const t=window.location.href,s=t.indexOf("/",8);if(s!==-1)c=t.substring(0,s);else return""}return c},n=b(()=>f()+"/api"),v=b(()=>f()+"/gemini"),w=b(()=>f()+"/openai"),k=b(()=>f()+"/droid/claude"),y=b(()=>f()+"/droid/openai"),l=b(()=>{const c=()=>{const t={title:"环境变量设置方法",description:"💡 将 OPENAI_API_KEY 设置为 null,然后设置环境变量 CRS_OAI_KEY 为您的 API 密钥(格式如 cr_xxxxxxxxxx)。"};switch(u.value){case"windows":return{...t,platform:{title:"Windows",command:"set CRS_OAI_KEY=cr_xxxxxxxxxx"}};case"macos":return{...t,platform:{title:"macOS",command:"export CRS_OAI_KEY=cr_xxxxxxxxxx"},persistent:{title:"Shell 配置文件(持久保存)",description:"添加到您的 shell 配置文件中:",commands:["# 对于 zsh (默认)",'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.zshrc',"source ~/.zshrc","","# 对于 bash",'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.bash_profile',"source ~/.bash_profile"]}};case"linux":return{...t,platform:{title:"Linux",command:"export CRS_OAI_KEY=cr_xxxxxxxxxx"},persistent:{title:"Shell 配置文件(持久保存)",description:"添加到您的 shell 配置文件中:",commands:["# 对于 bash (默认)",'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.bashrc',"source ~/.bashrc","","# 对于 zsh",'echo "export CRS_OAI_KEY=cr_xxxxxxxxxx" >> ~/.zshrc',"source ~/.zshrc"]}};default:return t}};return{configToml:['model_provider = "crs"','model = "gpt-5-codex"','model_reasoning_effort = "high"',"disable_response_storage = true",'preferred_auth_method = "apikey"',"","[model_providers.crs]",'name = "crs"',`base_url = "${w.value}"`,"# 若使用 Droid 类型账号,请改为以下地址",`# base_url = "${y.value}"`,'wire_api = "responses"',"requires_openai_auth = true",'env_key = "CRS_OAI_KEY"'],authJson:["{",' "OPENAI_API_KEY": null',"}"],authInstructions:c()}}),C=b(()=>["{",' "custom_models": ['," {",' "model_display_name": "Sonnet 4.5 [crs]",',' "model": "claude-sonnet-4-5-20250929",',` "base_url": "${k.value}",`,' "api_key": "你的API密钥",',' "provider": "anthropic",',' "max_tokens": 8192'," },"," {",' "model_display_name": "GPT5-Codex [crs]",',' "model": "gpt-5-codex",',` "base_url": "${y.value}",`,' "api_key": "你的API密钥",',' "provider": "openai",',' "max_tokens": 16384'," }"," ]","}"]);return(c,t)=>(o(),r("div",I,[t[163]||(t[163]=e("div",{class:"mb-4 sm:mb-8"},[e("h3",{class:"mb-3 flex items-center text-xl font-bold text-gray-900 dark:text-gray-100 sm:mb-4 sm:text-2xl"},[e("i",{class:"fas fa-graduation-cap mr-2 text-blue-600 sm:mr-3"}),d(" Claude Code 使用教程 ")]),e("p",{class:"text-sm text-gray-600 dark:text-gray-400 sm:text-lg"}," 跟着这个教程,你可以轻松在自己的电脑上安装并使用 Claude Code。 ")],-1)),e("div",E,[e("div",O,[(o(),r(m,null,i(_,s=>e("button",{key:s.key,class:p(["flex flex-1 items-center justify-center gap-1 rounded-lg px-3 py-2 text-xs font-semibold transition-all duration-300 sm:gap-2 sm:px-6 sm:py-3 sm:text-sm",u.value===s.key?"bg-white text-blue-600 shadow-sm dark:bg-blue-600 dark:text-white dark:shadow-blue-500/40":"text-gray-600 hover:bg-white/50 hover:text-gray-900 dark:text-gray-300 dark:hover:bg-gray-700 dark:hover:text-white"]),onClick:g=>u.value=s.key},[e("i",{class:p(s.icon)},null,2),d(" "+a(s.name),1)],10,T)),64))])]),u.value==="windows"?(o(),r("div",P,[t[50]||(t[50]=x('
1 安装 Node.js 环境
Claude Code 需要 Node.js 环境才能运行。
Windows 安装方法
方法一:官网下载(推荐)
- 打开浏览器访问
https://nodejs.org/ - 点击 "LTS" 版本进行下载(推荐长期支持版本)
- 下载完成后双击
.msi 文件 - 按照安装向导完成安装,保持默认设置即可
方法二:使用包管理器
如果你安装了 Chocolatey 或 Scoop,可以使用命令行安装:
# 使用 Chocolatey
choco install nodejs
# 或使用 Scoop
scoop install nodejs
Windows 注意事项
- • 建议使用 PowerShell 而不是 CMD
- • 如果遇到权限问题,尝试以管理员身份运行
- • 某些杀毒软件可能会误报,需要添加白名单
验证安装是否成功
安装完成后,打开 PowerShell 或 CMD,输入以下命令:
node --version
npm --version
如果显示版本号,说明安装成功了!
2 安装 Claude Code
安装 Claude Code
打开 PowerShell 或 CMD,运行以下命令:
# 全局安装 Claude Code
npm install -g @anthropic-ai/claude-code
这个命令会从 npm 官方仓库下载并安装最新版本的 Claude Code。
提示
- • 建议使用 PowerShell 而不是 CMD,功能更强大
- • 如果遇到权限问题,以管理员身份运行 PowerShell
验证 Claude Code 安装
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
',2)),e("div",N,[t[44]||(t[44]=e("h4",{class:"mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"},[e("span",{class:"mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-purple-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"},"3"),d(" 设置环境变量 ")],-1)),e("div",L,[t[14]||(t[14]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-cog mr-2 text-purple-600"}),d(" 配置 Claude Code 环境变量 ")],-1)),t[15]||(t[15]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量: ",-1)),e("div",G,[e("div",U,[t[1]||(t[1]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法一:PowerShell 临时设置(当前会话) ",-1)),t[2]||(t[2]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 PowerShell 中运行以下命令: ",-1)),e("div",D,[e("div",R,' $env:ANTHROPIC_BASE_URL = "'+a(n.value)+'" ',1),t[0]||(t[0]=e("div",{class:"whitespace-nowrap text-gray-300"},' $env:ANTHROPIC_AUTH_TOKEN = "你的API密钥" ',-1))]),t[3]||(t[3]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"},' 💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。 ',-1))]),e("div",H,[t[6]||(t[6]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法二:PowerShell 永久设置(用户级) ",-1)),t[7]||(t[7]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 PowerShell 中运行以下命令设置用户级环境变量: ",-1)),e("div",j,[t[4]||(t[4]=e("div",{class:"mb-2"},"# 设置用户级环境变量(永久生效)",-1)),e("div",K,' [System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "'+a(n.value)+'", [System.EnvironmentVariableTarget]::User) ',1),t[5]||(t[5]=e("div",{class:"whitespace-nowrap text-gray-300"},' [System.Environment]::SetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", "你的API密钥", [System.EnvironmentVariableTarget]::User) ',-1))]),t[8]||(t[8]=x('查看已设置的环境变量:
# 查看用户级环境变量
[System.Environment]::GetEnvironmentVariable("ANTHROPIC_BASE_URL", [System.EnvironmentVariableTarget]::User)
[System.Environment]::GetEnvironmentVariable("ANTHROPIC_AUTH_TOKEN", [System.EnvironmentVariableTarget]::User)
💡 设置后需要重新打开 PowerShell 窗口才能生效。
',3))])]),e("p",q,[t[9]||(t[9]=d(" 🚀 如果你在后台添加了 ",-1)),t[10]||(t[10]=e("strong",null,"Droid",-1)),t[11]||(t[11]=d(" 类型账号,请将上述命令中的 ",-1)),e("code",z,a(n.value),1),t[12]||(t[12]=d(" 替换为 ",-1)),e("code",V,a(k.value),1),t[13]||(t[13]=d(",其余配置保持不变。 ",-1))])]),t[45]||(t[45]=x(' VSCode Claude 插件配置
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:C:\\Users\\你的用户名\\.claude\\config.json
💡 如果该文件不存在,请手动创建。
',1)),e("div",$,[t[19]||(t[19]=x('验证环境变量设置
设置完环境变量后,可以通过以下命令验证是否设置成功:
在 PowerShell 中验证:
echo $env:ANTHROPIC_BASE_URL
echo $env:ANTHROPIC_AUTH_TOKEN
在 CMD 中验证:
echo %ANTHROPIC_BASE_URL%
echo %ANTHROPIC_AUTH_TOKEN%
',3)),e("div",B,[t[17]||(t[17]=e("p",{class:"text-sm text-blue-700 dark:text-blue-300"},[e("strong",null,"预期输出示例:")],-1)),e("div",Y,[e("div",null,a(n.value),1),t[16]||(t[16]=e("div",null,"cr_xxxxxxxxxxxxxxxxxx",-1))]),t[18]||(t[18]=e("p",{class:"text-xs text-blue-700 dark:text-blue-300"}," 💡 如果输出为空或显示变量名本身,说明环境变量设置失败,请重新设置。 ",-1))])]),e("div",W,[t[32]||(t[32]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-robot mr-2 text-green-600"}),d(" 配置 Gemini CLI 环境变量 ")],-1)),t[33]||(t[33]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用 Gemini CLI,需要设置以下环境变量: ",-1)),e("div",M,[e("div",J,[t[22]||(t[22]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," PowerShell 设置方法 ",-1)),t[23]||(t[23]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 PowerShell 中运行以下命令: ",-1)),e("div",F,[e("div",Q,' $env:CODE_ASSIST_ENDPOINT = "'+a(v.value)+'" ',1),t[20]||(t[20]=e("div",{class:"whitespace-nowrap text-gray-300"},' $env:GOOGLE_CLOUD_ACCESS_TOKEN = "你的API密钥" ',-1)),t[21]||(t[21]=e("div",{class:"whitespace-nowrap text-gray-300"},' $env:GOOGLE_GENAI_USE_GCA = "true" ',-1))]),t[24]||(t[24]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"}," 💡 使用与 Claude Code 相同的 API 密钥即可。 ",-1))]),e("div",X,[t[28]||(t[28]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," PowerShell 永久设置(用户级) ",-1)),t[29]||(t[29]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 PowerShell 中运行以下命令: ",-1)),e("div",Z,[t[25]||(t[25]=e("div",{class:"mb-2"},"# 设置用户级环境变量(永久生效)",-1)),e("div",tt,' [System.Environment]::SetEnvironmentVariable("CODE_ASSIST_ENDPOINT", "'+a(v.value)+'", [System.EnvironmentVariableTarget]::User) ',1),t[26]||(t[26]=e("div",{class:"whitespace-nowrap text-gray-300"},' [System.Environment]::SetEnvironmentVariable("GOOGLE_CLOUD_ACCESS_TOKEN", "你的API密钥", [System.EnvironmentVariableTarget]::User) ',-1)),t[27]||(t[27]=e("div",{class:"whitespace-nowrap text-gray-300"},' [System.Environment]::SetEnvironmentVariable("GOOGLE_GENAI_USE_GCA", "true", [System.EnvironmentVariableTarget]::User) ',-1))]),t[30]||(t[30]=e("p",{class:"mt-2 text-xs text-blue-700 dark:text-blue-300"}," 💡 设置后需要重新打开 PowerShell 窗口才能生效。 ",-1))]),t[31]||(t[31]=x(' 验证 Gemini CLI 环境变量
在 PowerShell 中验证:
echo $env:CODE_ASSIST_ENDPOINT
echo $env:GOOGLE_CLOUD_ACCESS_TOKEN
echo $env:GOOGLE_GENAI_USE_GCA
',1))])]),e("div",et,[t[42]||(t[42]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-code mr-2 text-indigo-600"}),d(" 配置 Codex 环境变量 ")],-1)),t[43]||(t[43]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量: ",-1)),e("div",at,[e("div",st,[t[39]||(t[39]=e("h6",{class:"mb-2 font-medium text-yellow-800 dark:text-yellow-300"},"Codex 配置文件",-1)),t[40]||(t[40]=e("p",{class:"mb-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/config.toml"),d(" 文件开头添加以下配置: ")],-1)),e("div",dt,[(o(!0),r(m,null,i(l.value.configToml,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))]),e("p",rt,[t[34]||(t[34]=d(" 🚀 如果你要使用 ",-1)),t[35]||(t[35]=e("strong",null,"Droid",-1)),t[36]||(t[36]=d(" 类型账号池,请把配置中的 ",-1)),e("code",ot,a(w.value),1),t[37]||(t[37]=d(" 替换为 ",-1)),e("code",lt,a(y.value),1),t[38]||(t[38]=d("。 ",-1))]),t[41]||(t[41]=e("p",{class:"mt-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/auth.json"),d(" 文件中配置API密钥: ")],-1)),e("div",xt,[(o(!0),r(m,null,i(l.value.authJson,s=>(o(),r("div",{key:s,class:"whitespace-nowrap text-gray-300"},a(s),1))),128))]),e("div",mt,[e("p",null,a(l.value.authInstructions.description),1),e("h6",it,a(l.value.authInstructions.title),1),e("div",nt,[e("p",gt,a(l.value.authInstructions.platform.title)+": ",1),e("div",ct,[e("div",vt,a(l.value.authInstructions.platform.command),1)])]),l.value.authInstructions.persistent?(o(),r("div",pt,[e("p",bt,a(l.value.authInstructions.persistent.title)+": ",1),e("p",ut,a(l.value.authInstructions.persistent.description),1),e("div",ft,[(o(!0),r(m,null,i(l.value.authInstructions.persistent.commands,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))])])):h("",!0)])])])])]),e("div",yt,[t[49]||(t[49]=x(' 配置 Droid CLI
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Windows 中可直接编辑 C:\\Users\\你的用户名\\.factory\\config.json。
',2)),e("div",wt,[t[46]||(t[46]=e("h6",{class:"mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base"}," 配置文件示例 ",-1)),t[47]||(t[47]=e("p",{class:"mb-3 text-sm text-blue-700 dark:text-blue-200"}," 将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥: ",-1)),e("div",kt,[(o(!0),r(m,null,i(C.value,(s,g)=>(o(),r("div",{key:s+g,class:"whitespace-pre text-gray-300"},a(s),1))),128))]),t[48]||(t[48]=e("p",{class:"mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm"}," 💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。 ",-1))])]),t[51]||(t[51]=x('4 开始使用 Claude Code
现在你可以开始使用 Claude Code 了!
在特定项目中使用
# 进入你的项目目录
cd C:\\path\\to\\your\\project
# 启动 Claude Code
claude
Windows 常见问题解决
安装时提示 "permission denied" 错误
这通常是权限问题,尝试以下解决方法:
- 以管理员身份运行 PowerShell
- 或者配置 npm 使用用户目录:
npm config set prefix %APPDATA%\\npm
PowerShell 执行策略错误
如果遇到执行策略限制,运行:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
环境变量设置后不生效
设置永久环境变量后需要:
- 重新启动 PowerShell 或 CMD
- 或者注销并重新登录 Windows
- 验证设置:
echo $env:ANTHROPIC_BASE_URL
',2))])):u.value==="macos"?(o(),r("div",ht,[t[105]||(t[105]=x('1 安装 Node.js 环境
Claude Code 需要 Node.js 环境才能运行。
macOS 安装方法
方法一:使用 Homebrew(推荐)
如果你已经安装了 Homebrew,使用它安装 Node.js 会更方便:
# 更新 Homebrew
brew update
# 安装 Node.js
brew install node
方法二:官网下载
- 访问
https://nodejs.org/ - 下载适合 macOS 的 LTS 版本
- 打开下载的
.pkg 文件 - 按照安装程序指引完成安装
macOS 注意事项
- • 如果遇到权限问题,可能需要使用
sudo - • 首次运行可能需要在系统偏好设置中允许
- • 建议使用 Terminal 或 iTerm2
验证安装是否成功
安装完成后,打开 Terminal,输入以下命令:
node --version
npm --version
如果显示版本号,说明安装成功了!
2 安装 Claude Code
安装 Claude Code
打开 Terminal,运行以下命令:
# 全局安装 Claude Code
npm install -g @anthropic-ai/claude-code
如果遇到权限问题,可以使用 sudo:
sudo npm install -g @anthropic-ai/claude-code
验证 Claude Code 安装
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
',2)),e("div",Ct,[t[99]||(t[99]=e("h4",{class:"mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"},[e("span",{class:"mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-orange-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"},"3"),d(" 设置环境变量 ")],-1)),e("div",_t,[t[69]||(t[69]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-cog mr-2 text-orange-600"}),d(" 配置 Claude Code 环境变量 ")],-1)),t[70]||(t[70]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量: ",-1)),e("div",St,[e("div",At,[t[53]||(t[53]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法一:临时设置(当前会话) ",-1)),t[54]||(t[54]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 Terminal 中运行以下命令: ",-1)),e("div",It,[e("div",Et,' export ANTHROPIC_BASE_URL="'+a(n.value)+'" ',1),t[52]||(t[52]=e("div",{class:"whitespace-nowrap text-gray-300"},' export ANTHROPIC_AUTH_TOKEN="你的API密钥" ',-1))]),t[55]||(t[55]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"},' 💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。 ',-1))]),e("div",Ot,[t[62]||(t[62]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法二:永久设置 ",-1)),t[63]||(t[63]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 编辑你的 shell 配置文件(根据你使用的 shell): ",-1)),e("div",Tt,[t[56]||(t[56]=e("div",{class:"mb-2"},"# 对于 zsh (默认)",-1)),e("div",Pt,` echo 'export ANTHROPIC_BASE_URL="`+a(n.value)+`"' >> ~/.zshrc `,1),t[57]||(t[57]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.zshrc `,-1)),t[58]||(t[58]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.zshrc",-1))]),e("div",Nt,[t[59]||(t[59]=e("div",{class:"mb-2"},"# 对于 bash",-1)),e("div",Lt,` echo 'export ANTHROPIC_BASE_URL="`+a(n.value)+`"' >> ~/.bash_profile `,1),t[60]||(t[60]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.bash_profile `,-1)),t[61]||(t[61]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.bash_profile",-1))])])]),e("p",Gt,[t[64]||(t[64]=d(" 🚀 如果你创建了 ",-1)),t[65]||(t[65]=e("strong",null,"Droid",-1)),t[66]||(t[66]=d(" 类型账号,请把上述命令中的 ",-1)),e("code",Ut,a(n.value),1),t[67]||(t[67]=d(" 替换为 ",-1)),e("code",Dt,a(k.value),1),t[68]||(t[68]=d(",其余配置保持不变。 ",-1))])]),t[100]||(t[100]=x(' VSCode Claude 插件配置
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
',1)),e("div",Rt,[t[87]||(t[87]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-robot mr-2 text-green-600"}),d(" 配置 Gemini CLI 环境变量 ")],-1)),t[88]||(t[88]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用 Gemini CLI,需要设置以下环境变量: ",-1)),e("div",Ht,[e("div",jt,[t[73]||(t[73]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," Terminal 设置方法 ",-1)),t[74]||(t[74]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 在 Terminal 中运行以下命令: ",-1)),e("div",Kt,[e("div",qt,' export CODE_ASSIST_ENDPOINT="'+a(v.value)+'" ',1),t[71]||(t[71]=e("div",{class:"whitespace-nowrap text-gray-300"},' export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥" ',-1)),t[72]||(t[72]=e("div",{class:"whitespace-nowrap text-gray-300"},' export GOOGLE_GENAI_USE_GCA="true" ',-1))]),t[75]||(t[75]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"}," 💡 使用与 Claude Code 相同的 API 密钥即可。 ",-1))]),e("div",zt,[t[84]||(t[84]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 永久设置方法 ",-1)),t[85]||(t[85]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 添加到你的 shell 配置文件: ",-1)),e("div",Vt,[t[76]||(t[76]=e("div",{class:"mb-2"},"# 对于 zsh (默认)",-1)),e("div",$t,` echo 'export CODE_ASSIST_ENDPOINT="`+a(v.value)+`"' >> ~/.zshrc `,1),t[77]||(t[77]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥"' >> ~/.zshrc `,-1)),t[78]||(t[78]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_GENAI_USE_GCA="true"' >> ~/.zshrc `,-1)),t[79]||(t[79]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.zshrc",-1))]),e("div",Bt,[t[80]||(t[80]=e("div",{class:"mb-2"},"# 对于 bash",-1)),e("div",Yt,` echo 'export CODE_ASSIST_ENDPOINT="`+a(v.value)+`"' >> ~/.bash_profile `,1),t[81]||(t[81]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥"' >> ~/.bash_profile `,-1)),t[82]||(t[82]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_GENAI_USE_GCA="true"' >> ~/.bash_profile `,-1)),t[83]||(t[83]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.bash_profile",-1))])]),t[86]||(t[86]=x(' 验证 Gemini CLI 环境变量
在 Terminal 中验证:
echo $CODE_ASSIST_ENDPOINT
echo $GOOGLE_CLOUD_ACCESS_TOKEN
echo $GOOGLE_GENAI_USE_GCA
',1))])]),e("div",Wt,[t[97]||(t[97]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-code mr-2 text-indigo-600"}),d(" 配置 Codex 环境变量 ")],-1)),t[98]||(t[98]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量: ",-1)),e("div",Mt,[e("div",Jt,[t[94]||(t[94]=e("h6",{class:"mb-2 font-medium text-yellow-800 dark:text-yellow-300"},"Codex 配置文件",-1)),t[95]||(t[95]=e("p",{class:"mb-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/config.toml"),d(" 文件开头添加以下配置: ")],-1)),e("div",Ft,[(o(!0),r(m,null,i(l.value.configToml,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))]),e("p",Qt,[t[89]||(t[89]=d(" 🚀 如果你要使用 ",-1)),t[90]||(t[90]=e("strong",null,"Droid",-1)),t[91]||(t[91]=d(" 类型账号池,请把配置中的 ",-1)),e("code",Xt,a(w.value),1),t[92]||(t[92]=d(" 替换为 ",-1)),e("code",Zt,a(y.value),1),t[93]||(t[93]=d("。 ",-1))]),t[96]||(t[96]=e("p",{class:"mt-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/auth.json"),d(" 文件中配置API密钥: ")],-1)),e("div",te,[(o(!0),r(m,null,i(l.value.authJson,s=>(o(),r("div",{key:s,class:"whitespace-nowrap text-gray-300"},a(s),1))),128))]),e("div",ee,[e("p",null,a(l.value.authInstructions.description),1),e("h6",ae,a(l.value.authInstructions.title),1),e("div",se,[e("p",de,a(l.value.authInstructions.platform.title)+": ",1),e("div",re,[e("div",oe,a(l.value.authInstructions.platform.command),1)])]),l.value.authInstructions.persistent?(o(),r("div",le,[e("p",xe,a(l.value.authInstructions.persistent.title)+": ",1),e("p",me,a(l.value.authInstructions.persistent.description),1),e("div",ie,[(o(!0),r(m,null,i(l.value.authInstructions.persistent.commands,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))])])):h("",!0)])])])])]),e("div",ne,[t[104]||(t[104]=x(' 配置 Droid CLI
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;你可以在 Finder 中按 ⌘ + Shift + G 并输入路径,或运行 open ~/.factory 快速打开配置目录。
',2)),e("div",ge,[t[101]||(t[101]=e("h6",{class:"mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base"}," 配置文件示例 ",-1)),t[102]||(t[102]=e("p",{class:"mb-3 text-sm text-blue-700 dark:text-blue-200"}," 将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥: ",-1)),e("div",ce,[(o(!0),r(m,null,i(C.value,(s,g)=>(o(),r("div",{key:s+g,class:"whitespace-pre text-gray-300"},a(s),1))),128))]),t[103]||(t[103]=e("p",{class:"mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm"}," 💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。 ",-1))])]),t[106]||(t[106]=x('4 开始使用 Claude Code
现在你可以开始使用 Claude Code 了!
在特定项目中使用
# 进入你的项目目录
cd /path/to/your/project
# 启动 Claude Code
claude
macOS 常见问题解决
安装时提示权限错误
尝试以下解决方法:
- 使用 sudo 安装:
sudo npm install -g @anthropic-ai/claude-code - 或者配置 npm 使用用户目录:
npm config set prefix ~/.npm-global
macOS 安全设置阻止运行
如果系统阻止运行 Claude Code:
- 打开"系统偏好设置" → "安全性与隐私"
- 点击"仍要打开"或"允许"
- 或者在 Terminal 中运行:
sudo spctl --master-disable
环境变量不生效
检查以下几点:
- 确认修改了正确的配置文件(.zshrc 或 .bash_profile)
- 重新启动 Terminal
- 验证设置:
echo $ANTHROPIC_BASE_URL
',2))])):u.value==="linux"?(o(),r("div",ve,[t[161]||(t[161]=x('1 安装 Node.js 环境
Claude Code 需要 Node.js 环境才能运行。
Linux 安装方法
方法一:使用官方仓库(推荐)
# 添加 NodeSource 仓库
curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
# 安装 Node.js
sudo apt-get install -y nodejs
方法二:使用系统包管理器
虽然版本可能不是最新的,但对于基本使用已经足够:
# Ubuntu/Debian
sudo apt update
sudo apt install nodejs npm
# CentOS/RHEL/Fedora
sudo dnf install nodejs npm
Linux 注意事项
- • 某些发行版可能需要安装额外的依赖
- • 如果遇到权限问题,使用
sudo - • 确保你的用户在 npm 的全局目录有写权限
验证安装是否成功
安装完成后,打开终端,输入以下命令:
node --version
npm --version
如果显示版本号,说明安装成功了!
2 安装 Claude Code
安装 Claude Code
打开终端,运行以下命令:
# 全局安装 Claude Code
npm install -g @anthropic-ai/claude-code
如果遇到权限问题,可以使用 sudo:
sudo npm install -g @anthropic-ai/claude-code
验证 Claude Code 安装
安装完成后,输入以下命令检查是否安装成功:
如果显示版本号,恭喜你!Claude Code 已经成功安装了。
',2)),e("div",pe,[t[158]||(t[158]=e("h4",{class:"mb-3 flex items-center text-lg font-semibold text-gray-800 dark:text-gray-300 sm:mb-4 sm:text-xl"},[e("span",{class:"mr-2 flex h-6 w-6 items-center justify-center rounded-full bg-orange-500 text-xs font-bold text-white sm:mr-3 sm:h-8 sm:w-8 sm:text-sm"},"3"),d(" 设置环境变量 ")],-1)),e("div",be,[t[124]||(t[124]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-cog mr-2 text-orange-600"}),d(" 配置 Claude Code 环境变量 ")],-1)),t[125]||(t[125]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 为了让 Claude Code 连接到你的中转服务,需要设置两个环境变量: ",-1)),e("div",ue,[e("div",fe,[t[108]||(t[108]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法一:临时设置(当前会话) ",-1)),t[109]||(t[109]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"},"在终端中运行以下命令:",-1)),e("div",ye,[e("div",we,' export ANTHROPIC_BASE_URL="'+a(n.value)+'" ',1),t[107]||(t[107]=e("div",{class:"whitespace-nowrap text-gray-300"},' export ANTHROPIC_AUTH_TOKEN="你的API密钥" ',-1))]),t[110]||(t[110]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"},' 💡 记得将 "你的API密钥" 替换为在上方 "API Keys" 标签页中创建的实际密钥。 ',-1))]),e("div",ke,[t[117]||(t[117]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 方法二:永久设置 ",-1)),t[118]||(t[118]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"},"编辑你的 shell 配置文件:",-1)),e("div",he,[t[111]||(t[111]=e("div",{class:"mb-2"},"# 对于 bash (默认)",-1)),e("div",Ce,` echo 'export ANTHROPIC_BASE_URL="`+a(n.value)+`"' >> ~/.bashrc `,1),t[112]||(t[112]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.bashrc `,-1)),t[113]||(t[113]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.bashrc",-1))]),e("div",_e,[t[114]||(t[114]=e("div",{class:"mb-2"},"# 对于 zsh",-1)),e("div",Se,` echo 'export ANTHROPIC_BASE_URL="`+a(n.value)+`"' >> ~/.zshrc `,1),t[115]||(t[115]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export ANTHROPIC_AUTH_TOKEN="你的API密钥"' >> ~/.zshrc `,-1)),t[116]||(t[116]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.zshrc",-1))])])]),e("p",Ae,[t[119]||(t[119]=d(" 🚀 如果你创建了 ",-1)),t[120]||(t[120]=e("strong",null,"Droid",-1)),t[121]||(t[121]=d(" 类型账号,请把上述命令中的 ",-1)),e("code",Ie,a(n.value),1),t[122]||(t[122]=d(" 替换为 ",-1)),e("code",Ee,a(k.value),1),t[123]||(t[123]=d(",其余配置保持不变。 ",-1))])]),e("div",Oe,[t[142]||(t[142]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-robot mr-2 text-green-600"}),d(" 配置 Gemini CLI 环境变量 ")],-1)),t[143]||(t[143]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用 Gemini CLI,需要设置以下环境变量: ",-1)),e("div",Te,[e("div",Pe,[t[128]||(t[128]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 终端设置方法 ",-1)),t[129]||(t[129]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"},"在终端中运行以下命令:",-1)),e("div",Ne,[e("div",Le,' export CODE_ASSIST_ENDPOINT="'+a(v.value)+'" ',1),t[126]||(t[126]=e("div",{class:"whitespace-nowrap text-gray-300"},' export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥" ',-1)),t[127]||(t[127]=e("div",{class:"whitespace-nowrap text-gray-300"},' export GOOGLE_GENAI_USE_GCA="true" ',-1))]),t[130]||(t[130]=e("p",{class:"mt-2 text-xs text-yellow-700 dark:text-yellow-400"}," 💡 使用与 Claude Code 相同的 API 密钥即可。 ",-1))]),e("div",Ge,[t[139]||(t[139]=e("h6",{class:"mb-2 text-sm font-medium text-gray-800 dark:text-gray-300 sm:text-base"}," 永久设置方法 ",-1)),t[140]||(t[140]=e("p",{class:"mb-3 text-sm text-gray-600 dark:text-gray-400"}," 添加到你的 shell 配置文件: ",-1)),e("div",Ue,[t[131]||(t[131]=e("div",{class:"mb-2"},"# 对于 bash (默认)",-1)),e("div",De,` echo 'export CODE_ASSIST_ENDPOINT="`+a(v.value)+`"' >> ~/.bashrc `,1),t[132]||(t[132]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥"' >> ~/.bashrc `,-1)),t[133]||(t[133]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_GENAI_USE_GCA="true"' >> ~/.bashrc `,-1)),t[134]||(t[134]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.bashrc",-1))]),e("div",Re,[t[135]||(t[135]=e("div",{class:"mb-2"},"# 对于 zsh",-1)),e("div",He,` echo 'export CODE_ASSIST_ENDPOINT="`+a(v.value)+`"' >> ~/.zshrc `,1),t[136]||(t[136]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_CLOUD_ACCESS_TOKEN="你的API密钥"' >> ~/.zshrc `,-1)),t[137]||(t[137]=e("div",{class:"whitespace-nowrap text-gray-300"},` echo 'export GOOGLE_GENAI_USE_GCA="true"' >> ~/.zshrc `,-1)),t[138]||(t[138]=e("div",{class:"whitespace-nowrap text-gray-300"},"source ~/.zshrc",-1))])]),t[141]||(t[141]=x(' 验证 Gemini CLI 环境变量
在终端中验证:
echo $CODE_ASSIST_ENDPOINT
echo $GOOGLE_CLOUD_ACCESS_TOKEN
echo $GOOGLE_GENAI_USE_GCA
',1))])]),e("div",je,[t[152]||(t[152]=e("h5",{class:"mb-2 flex items-center text-base font-semibold text-gray-800 dark:text-gray-200 sm:mb-3 sm:text-lg"},[e("i",{class:"fas fa-code mr-2 text-indigo-600"}),d(" 配置 Codex 环境变量 ")],-1)),t[153]||(t[153]=e("p",{class:"mb-3 text-sm text-gray-700 dark:text-gray-300 sm:mb-4 sm:text-base"}," 如果你使用支持 OpenAI API 的工具(如 Codex),需要设置以下环境变量: ",-1)),e("div",Ke,[e("div",qe,[t[149]||(t[149]=e("h6",{class:"mb-2 font-medium text-yellow-800 dark:text-yellow-300"},"Codex 配置文件",-1)),t[150]||(t[150]=e("p",{class:"mb-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/config.toml"),d(" 文件开头添加以下配置: ")],-1)),e("div",ze,[(o(!0),r(m,null,i(l.value.configToml,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))]),e("p",Ve,[t[144]||(t[144]=d(" 🚀 如果你要使用 ",-1)),t[145]||(t[145]=e("strong",null,"Droid",-1)),t[146]||(t[146]=d(" 类型账号池,请把配置中的 ",-1)),e("code",$e,a(w.value),1),t[147]||(t[147]=d(" 替换为 ",-1)),e("code",Be,a(y.value),1),t[148]||(t[148]=d("。 ",-1))]),t[151]||(t[151]=e("p",{class:"mt-3 text-sm text-yellow-700 dark:text-yellow-300"},[d(" 在 "),e("code",{class:"rounded bg-yellow-100 px-1 dark:bg-yellow-900"},"~/.codex/auth.json"),d(" 文件中配置API密钥: ")],-1)),e("div",Ye,[(o(!0),r(m,null,i(l.value.authJson,s=>(o(),r("div",{key:s,class:"whitespace-nowrap text-gray-300"},a(s),1))),128))]),e("div",We,[e("p",null,a(l.value.authInstructions.description),1),e("h6",Me,a(l.value.authInstructions.title),1),e("div",Je,[e("p",Fe,a(l.value.authInstructions.platform.title)+": ",1),e("div",Qe,[e("div",Xe,a(l.value.authInstructions.platform.command),1)])]),l.value.authInstructions.persistent?(o(),r("div",Ze,[e("p",ta,a(l.value.authInstructions.persistent.title)+": ",1),e("p",ea,a(l.value.authInstructions.persistent.description),1),e("div",aa,[(o(!0),r(m,null,i(l.value.authInstructions.persistent.commands,s=>(o(),r("div",{key:s,class:p(["whitespace-nowrap text-gray-300",{"mt-2":s===""}])},a(s),3))),128))])])):h("",!0)])])])]),t[159]||(t[159]=x(' VSCode Claude 插件配置
如果使用 VSCode 的 Claude 插件,需要在配置文件中进行设置:
配置文件位置:~/.claude/config.json
💡 如果该文件不存在,请手动创建。
',1)),e("div",sa,[t[157]||(t[157]=x(' 配置 Droid CLI
Droid CLI 使用 ~/.factory/config.json 保存自定义模型;在 Linux 或 WSL2 中,可直接编辑 /home/你的用户名/.factory/config.json 或在终端运行 xdg-open ~/.factory 打开目录。
',2)),e("div",da,[t[154]||(t[154]=e("h6",{class:"mb-2 text-sm font-medium text-blue-800 dark:text-blue-200 sm:text-base"}," 配置文件示例 ",-1)),t[155]||(t[155]=e("p",{class:"mb-3 text-sm text-blue-700 dark:text-blue-200"}," 将以下内容追加到配置文件中,并替换示例中的域名和 API 密钥: ",-1)),e("div",ra,[(o(!0),r(m,null,i(C.value,(s,g)=>(o(),r("div",{key:s+g,class:"whitespace-pre text-gray-300"},a(s),1))),128))]),t[156]||(t[156]=e("p",{class:"mt-3 text-xs text-blue-700 dark:text-blue-200 sm:text-sm"}," 💡 在 Droid CLI 中选择自定义模型即可使用新的 Droid 账号池;确保服务地址可被本地访问。 ",-1))])]),t[160]||(t[160]=x('4 开始使用 Claude Code
现在你可以开始使用 Claude Code 了!
在特定项目中使用
# 进入你的项目目录
cd /path/to/your/project
# 启动 Claude Code
claude
Linux 常见问题解决
安装时提示权限错误
尝试以下解决方法:
- 使用 sudo 安装:
sudo npm install -g @anthropic-ai/claude-code - 或者配置 npm 使用用户目录:
npm config set prefix ~/.npm-global - 然后添加到 PATH:
export PATH=~/.npm-global/bin:$PATH
缺少依赖库
某些 Linux 发行版需要安装额外依赖:
# Ubuntu/Debian
sudo apt install build-essential
# CentOS/RHEL
sudo dnf groupinstall "Development Tools"
环境变量不生效
检查以下几点:
- 确认修改了正确的配置文件(.bashrc 或 .zshrc)
- 重新启动终端或运行
source ~/.bashrc - 验证设置:
echo $ANTHROPIC_BASE_URL
',2))]),t[162]||(t[162]=e("div",{class:"rounded-xl bg-gradient-to-r from-blue-500 to-purple-600 p-4 text-center text-white sm:p-6"},[e("h5",{class:"mb-2 text-lg font-semibold sm:text-xl"},"🎉 恭喜你!"),e("p",{class:"mb-3 text-sm text-blue-100 sm:mb-4 sm:text-base"}," 你已经成功安装并配置了 Claude Code,现在可以开始享受 AI 编程助手带来的便利了。 "),e("p",{class:"text-xs text-blue-200 sm:text-sm"}," 如果在使用过程中遇到任何问题,可以查看官方文档或社区讨论获取帮助。 ")],-1))])):h("",!0)]))}},ga=S(oa,[["__scopeId","data-v-f64ce4ad"]]);export{ga as default};