klaude is a drop-in wrapper for claude that routes all model calls through
MiniMax (MiniMax-M2.7) instead of Anthropic, using the Anthropic-compatible API.
Regular claude is untouched — both commands coexist independently.
claudeCLI installed and accessible in PATH (~/.local/bin/claudeor similar)- A MiniMax API key from https://platform.minimax.io/user-center/basic-information/interface-key
- The
~/.klaudefolder copied from the previous machine (or set up fresh below)
Paste the following prompt to Claude Code in a fresh session on the new machine:
I need you to set up (or restore) the `klaude` CLI wrapper on this machine.
The ~/.klaude folder may already exist (copied from another machine).
Do all of the following steps in order:
---
**STEP 1 — Find where `claude` is installed**
Run: `which claude`
Note the directory (e.g. ~/.local/bin). The klaude script must go there.
---
**STEP 2 — Ensure ~/.klaude structure exists**
Run:
```bash
mkdir -p ~/.klaude ~/.klaude/config-dir
STEP 3 — Create or verify ~/.klaude/config
If ~/.klaude/config does not exist, create it:
# klaude configuration — MiniMax API credentials
# Get your API key from: https://platform.minimax.io/user-center/basic-information/interface-key
MINIMAX_API_KEY=your_api_key_here
# API base URL — change to https://api.minimaxi.com/anthropic if you're in China
MINIMAX_BASE_URL=https://api.minimax.io/anthropic
If it exists, read it and confirm MINIMAX_API_KEY is set to a real key (not the placeholder).
STEP 4 — Sync symlinks in ~/.klaude/config-dir/
This step is critical. It must:
- Check each expected symlink — repair it if broken or missing
- Scan everything in ~/.claude/ and symlink anything not already linked (skip: settings.json, settings.local.json, history.jsonl, sessions, transcripts, projects, cache, todos, backups, debug, paste-cache, shell-snapshots, stats-cache.json, policy-limits.json, telemetry)
Run this script exactly:
CLAUDE_DIR="$HOME/.claude"
KLAUDE_DIR="$HOME/.klaude/config-dir"
# Items that must never be symlinked (auth, history, cache, session state)
SKIP=(settings.json settings.local.json history.jsonl sessions transcripts projects
cache todos backups debug paste-cache shell-snapshots stats-cache.json
policy-limits.json telemetry)
skip_item() {
local name="$1"
for s in "${SKIP[@]}"; do [ "$name" = "$s" ] && return 0; done
return 1
}
echo "=== Syncing ~/.klaude/config-dir symlinks ==="
for item in "$CLAUDE_DIR"/*; do
name=$(basename "$item")
skip_item "$name" && continue
target="$KLAUDE_DIR/$name"
if [ -L "$target" ] && [ "$(readlink "$target")" = "$item" ]; then
echo " OK $name"
elif [ -L "$target" ]; then
ln -sf "$item" "$target" && echo " REPAIRED $name"
elif [ ! -e "$target" ]; then
ln -sf "$item" "$target" && echo " ADDED $name"
else
echo " SKIPPED $name (real file exists, not a symlink)"
fi
done
echo "=== Done ==="Report all ADDED, REPAIRED, and SKIPPED items.
STEP 5 — Create or verify ~/.klaude/config-dir/settings.json
If it does not exist, create it by reading ~/.claude/settings.json and copying all non-auth fields (plugins, statusLine, env except Anthropic keys, etc.).
If it exists, read both files and confirm the plugin list and statusLine match ~/.claude/settings.json. Update any differences.
STEP 6 — Create or verify the klaude wrapper script
Check if the klaude script exists at the same directory as claude.
If missing or outdated, write it with this exact content:
#!/usr/bin/env bash
# klaude — Claude Code wrapper using MiniMax models
# Config: ~/.klaude/config
CONFIG="$HOME/.klaude/config"
CONFIG_DIR="$HOME/.klaude/config-dir"
if [ ! -f "$CONFIG" ]; then
echo "klaude: config file not found at $CONFIG" >&2
exit 1
fi
source "$CONFIG"
if [ -z "$MINIMAX_API_KEY" ] || [ "$MINIMAX_API_KEY" = "your_api_key_here" ]; then
echo "klaude: set MINIMAX_API_KEY in $CONFIG" >&2
exit 1
fi
exec env \
CLAUDE_CONFIG_DIR="$CONFIG_DIR" \
ANTHROPIC_BASE_URL="${MINIMAX_BASE_URL:-https://api.minimax.io/anthropic}" \
ANTHROPIC_AUTH_TOKEN="$MINIMAX_API_KEY" \
API_TIMEOUT_MS="3000000" \
CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC="1" \
ANTHROPIC_MODEL="MiniMax-M2.7" \
ANTHROPIC_SMALL_FAST_MODEL="MiniMax-M2.7" \
ANTHROPIC_DEFAULT_SONNET_MODEL="MiniMax-M2.7" \
ANTHROPIC_DEFAULT_OPUS_MODEL="MiniMax-M2.7" \
ANTHROPIC_DEFAULT_HAIKU_MODEL="MiniMax-M2.7" \
claude "$@"Then run: chmod +x <path-to-klaude>
STEP 7 — Verify
Run:
klaude -p "reply with only: which model are you?"Expected: MiniMax-M2.7 with no auth conflict warnings.
If there is an auth conflict warning, the CLAUDE_CONFIG_DIR symlink step may have accidentally linked an auth file. Re-check the skip list in Step 4.
Why CLAUDE_CONFIG_DIR? Without it, klaude inherits the stored Anthropic OAuth session from ~/.claude/, causing an "auth conflict" warning. A separate config dir has no stored session, so no conflict. All other config (plugins, MCP, skills, hooks) comes through symlinks.