Do we have offical guide for using K2 in Claude Code?

All of Qwen3, DeepSeek and GLM4.5 provide official guide about how to use their model in Claude Code

DeepSeek Anthropic API Guide
Alibaba Cloud Model Studio - Claude Code Integration
Zhipu GLM - Claude Development Guide

I didn’t find it for Kimi K2. Can you give me the link for it if I missed or prepare one? That will be very helpful

Here is how I set the claude code enviroment variable
“anthropicUrl”: “https://api.moonshot.ai/anthropic”,
“defaultModel”: “K2-Instruct-0905”,
“fastModel”: “K2-Instruct-0905”

When I try to call kiwi inside claude code based on some guessing, I get the error

API Error: 404 {“error”:{“type”:“resource_not_found_error”,“message”:“Not found the model k2-instruct-0905 or Permission denied”},“request_id”:“35ea16b9-8da8-11f0-aff3-00163e789b79”,“type”:“error”}

So I need the help about how to configure it correctly

Here is my .bashrc file and .zshrc file

export MOONSHOT_CN_API_KEY="sk-mymoonshotcnapikey"
export MOONSHOT_AI_API_KEY="sk-mymoonshotaiapikey"
alias claude-kimi-cn='ANTHROPIC_BASE_URL=https://api.moonshot.cn/anthropic ANTHROPIC_AUTH_TOKEN=$MOONSHOT_CN_API_KEY claude'
alias claude-kimi-cn-turbo='ANTHROPIC_MODEL=kimi-k2-turbo-preview ANTHROPIC_SMALL_FAST_MODEL=kimi-k2-turbo-preview ANTHROPIC_BASE_URL=https://api.moonshot.cn/anthropic ANTHROPIC_AUTH_TOKEN=$MOONSHOT_CN_API_KEY claude'
alias claude-kimi-ai='ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic ANTHROPIC_AUTH_TOKEN=$MOONSHOT_AI_API_KEY claude'
alias claude-kimi-ai-turbo='ANTHROPIC_MODEL=kimi-k2-turbo-preview ANTHROPIC_SMALL_FAST_MODEL=kimi-k2-turbo-preview ANTHROPIC_BASE_URL=https://api.moonshot.ai/anthropic ANTHROPIC_AUTH_TOKEN=$MOONSHOT_AI_API_KEY claude'

1 Like

Thanks, is it possible to use kimi-k2-0905-preview as the main model?

This is a compatible API. Technically, all model IDs obtained by using the OpenAI API to list models ( GET https://api.moonshot.cn/v1/models) can be used here.