惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

罗磊的独立博客
SecWiki News
SecWiki News
酷 壳 – CoolShell
酷 壳 – CoolShell
爱范儿
爱范儿
量子位
M
MIT News - Artificial intelligence
GbyAI
GbyAI
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
TaoSecurity Blog
TaoSecurity Blog
博客园 - 【当耐特】
H
Heimdal Security Blog
腾讯CDC
The Last Watchdog
The Last Watchdog
Security Archives - TechRepublic
Security Archives - TechRepublic
Hacker News: Ask HN
Hacker News: Ask HN
S
Schneier on Security
Microsoft Security Blog
Microsoft Security Blog
WordPress大学
WordPress大学
博客园 - 司徒正美
Recent Commits to openclaw:main
Recent Commits to openclaw:main
C
Cybersecurity and Infrastructure Security Agency CISA
S
SegmentFault 最新的问题
大猫的无限游戏
大猫的无限游戏
Application and Cybersecurity Blog
Application and Cybersecurity Blog
F
Full Disclosure
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
T
Threatpost
月光博客
月光博客
A
Arctic Wolf
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
雷峰网
雷峰网
T
Troy Hunt's Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
The Cloudflare Blog
D
DataBreaches.Net
O
OpenAI News
L
LINUX DO - 最新话题
宝玉的分享
宝玉的分享
小众软件
小众软件
V
Vulnerabilities – Threatpost
A
About on SuperTechFans
人人都是产品经理
人人都是产品经理
T
The Exploit Database - CXSecurity.com
Martin Fowler
Martin Fowler
美团技术团队
P
Privacy International News Feed

About on SuperTechFans

About Us Contact Us Privacy Policy Llm Era Software
Claude Code With Kimi K2
2025-07-14 · via About on SuperTechFans

Moonshot AI 团队开发的 Kimi K2 是一款基于混合专家(MoE)架构的先进语言模型,拥有 32 亿激活参数和 1 万亿总参数。该模型在前沿知识、推理和编码任务上表现出色。 甚至 OpenAI 推迟了原本计划在本周推出的开放权重模型,HackerNews 网友推测也是为了避开 K2 的风头。

本文将会给大家介绍如何 让 Claude Code 使用上 Kimi K2 模型,完成日常的编程任务。

步骤 1: 注册 Moonshot AI 帐号 #

注意 网址是 https://platform.moonshot.ai/ ,是 ai 结尾的域名,而非 cn 结尾的域名。这里大家使用 Google 帐号即可快速完成注册,如果已经有了帐号,则跳过此步骤。

步骤 2: 生成 Moonshot AI API Key #

来到页面: https://platform.moonshot.ai/console/api-keys ,点击 Create API Key 按钮,生成 sk-xxxx 开头的 API Key,

注意: 一定要保护好这个 API Key,千万不要泄露;大模型的 API Key 需要像密码一样来保护。

建议给 API Key 起一个好辨识的名字,例如本次我们可以叫做 claude_code,以后方便通过名字来统计 Token 用量。

步骤 3: 设置 Claude Code 环境变量 #

如下,配置好的你环境变量,可以写到自己的 ~/.bash_profile 或者自己Shell 对应的配置文件中,这样每次打开 Terminal 都会自动设置好对应的环境变量;下面的 ANTHROPIC_AUTH_TOKEN 就配置你上面生成的 API Key。

export ANTHROPIC_AUTH_TOKEN=sk-YOURKEY
export ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic

步骤 4: 启动 Claude Code #

如果此前还未安装过 Claude Code,可以通过这个命令进行安装:

npm install -g @anthropic-ai/claude-code

有两点注意: #

  • 你可能需要重新 /logout/login 来让 claude code 识别到你的环境变量
    • 可以在启动之前做一下检查env | grep ANTH ,看看是否是自己刚刚的设置。
  • 留意你的 Moonshot AI 的 Billing 页面 https://platform.moonshot.ai/console/account,也许会需要进行充值,才会允许进行 api 调用。

Have Fun! #