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

推荐订阅源

T
The Blog of Author Tim Ferriss
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
云风的 BLOG
云风的 BLOG
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
P
Palo Alto Networks Blog
D
Docker
H
Hackread – Cybersecurity News, Data Breaches, AI and More
S
Schneier on Security
Engineering at Meta
Engineering at Meta
I
InfoQ
L
LangChain Blog
Cyberwarzone
Cyberwarzone
T
Tenable Blog
WordPress大学
WordPress大学
P
Privacy & Cybersecurity Law Blog
罗磊的独立博客
Apple Machine Learning Research
Apple Machine Learning Research
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Scott Helme
Scott Helme
博客园 - 三生石上(FineUI控件)
酷 壳 – CoolShell
酷 壳 – CoolShell
Know Your Adversary
Know Your Adversary
D
Darknet – Hacking Tools, Hacker News & Cyber Security
The Last Watchdog
The Last Watchdog
Last Week in AI
Last Week in AI
Cloudbric
Cloudbric
S
SegmentFault 最新的问题
爱范儿
爱范儿
Application and Cybersecurity Blog
Application and Cybersecurity Blog
博客园 - 叶小钗
AI
AI
T
Tor Project blog
I
Intezer
T
Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
V
Visual Studio Blog
N
News and Events Feed by Topic
Latest news
Latest news
S
Security Affairs
博客园 - Franky
Microsoft Security Blog
Microsoft Security Blog
C
Cyber Attacks, Cyber Crime and Cyber Security
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
B
Blog RSS Feed
C
Cybersecurity and Infrastructure Security Agency CISA
Hugging Face - Blog
Hugging Face - Blog
小众软件
小众软件
S
Securelist

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! #