claude cli
claude-kimi.bat
simple version
@echo off
powershell -Command "$env:ANTHROPIC_BASE_URL='https://api.kimi.com/coding/'; $env:ANTHROPIC_AUTH_TOKEN='xxxxxxxx'; $env:ANTHROPIC_MODEL='kimi-for-coding'; $env:ANTHROPIC_SMALL_FAST_MODEL='kimi-for-coding'; claude %*"
full version
@echo off
:: ==============================================
:: Script Name: Claude-Kimi Coding Model Launch Script
:: Core Function: Configure environment variables to make Claude CLI tool call Kimi-for-Coding model
:: Compatible Systems: Windows 10/11 (requires PowerShell 5.1+)
:: Notes: Replace the auth token before use, and ensure Claude CLI is installed locally
:: ==============================================
:: Enable command line delayed expansion (for subsequent error checking)
setlocal enabledelayedexpansion
:: --------------------------
:: Step 1: User Configuration Check (Critical!)
:: --------------------------
:: Prompt user to replace the authentication token
echo ⚠️ Please confirm that ANTHROPIC_AUTH_TOKEN has been replaced with a valid token!
echo 📍 Token acquisition URL: Kimi Platform API Management Page (https://kimi.moonshot.cn/console/api-keys)
echo.
:: Check if Claude CLI tool is installed (to prevent execution failure)
where claude >nul 2>nul
if %errorlevel% neq 0 (
echo ❌ Error: Claude command-line tool not found
echo Solution: 1. Install Claude CLI; 2. Add the tool path to system environment variable PATH
pause
exit /b 1
)
:: --------------------------
:: Step 2: Configure Environment Variables (Connect to Kimi Service)
:: --------------------------
echo 🚀 Configuring Kimi coding model environment...
powershell -Command "$env:ANTHROPIC_BASE_URL='https://api.kimi.com/coding/'; $env:ANTHROPIC_AUTH_TOKEN='xxxxxxxx'; $env:ANTHROPIC_MODEL='kimi-for-coding'; $env:ANTHROPIC_SMALL_FAST_MODEL='kimi-for-coding';"
:: Verify if environment variables are configured successfully (via PowerShell)
powershell -Command "if (-not $env:ANTHROPIC_BASE_URL) { exit 1 }"
if %errorlevel% equ 0 (
echo ✅ Environment configured successfully, connected to Kimi-for-Coding model
) else (
echo ❌ Error: Failed to configure environment variables
echo Solution: Check if PowerShell is running properly, or if the system prohibits script execution
pause
exit /b 1
)
:: --------------------------
:: Step 3: Execute Claude Command (Pass External Parameters)
:: --------------------------
echo.
echo 📝 Starting Claude command execution, parameters: %*
echo ==============================================
claude %*
:: Check command execution result
if %errorlevel% equ 0 (
echo ==============================================
echo ✅ Command executed successfully!
) else (
echo ==============================================
echo ❌ Command execution failed, error code: %errorlevel%
echo Troubleshooting: 1. Is the auth token valid? 2. Can the network access Kimi API? 3. Are input parameters correct?
)
:: Keep window open (optional, for result review)
pause
endlocal