Skip to content

Instantly share code, notes, and snippets.

@williamokano
Created June 24, 2026 13:55
Show Gist options
  • Select an option

  • Save williamokano/b4e8dcd3e2dce7109442cb172a448e42 to your computer and use it in GitHub Desktop.

Select an option

Save williamokano/b4e8dcd3e2dce7109442cb172a448e42 to your computer and use it in GitHub Desktop.
Running ClaudeCode with minimax

How to use?

Just create a file in ~/.minimax_key with your API or subscription key and the run ./claude-minimax.sh or whatever you plan to call this wrapper.

It will start the claude code with the minimax set as model. All parameters provided to the wrapper will be forwarded to the claude code.

#!/usr/bin/env bash
# Wrapper around `claude` that swaps Anthropic's backend for MiniMax-M3.
# All extra arguments are forwarded to the real `claude` CLI.
# Docs: https://platform.minimax.io/docs/token-plan/claude-code
set -euo pipefail
KEY_FILE="${HOME}/.minimax_key"
BASE_URL="${MINIMAX_BASE_URL:-https://api.minimax.io/anthropic}"
if [[ ! -f "${KEY_FILE}" ]]; then
echo "error: API key file not found at ${KEY_FILE}" >&2
echo " Create it with: printf '%s' '<your-key>' > ${KEY_FILE} && chmod 600 ${KEY_FILE}" >&2
exit 1
fi
if [[ ! -r "${KEY_FILE}" ]]; then
echo "error: ${KEY_FILE} exists but is not readable" >&2
exit 1
fi
API_KEY="$(tr -d '[:space:]' < "${KEY_FILE}")"
if [[ -z "${API_KEY}" ]]; then
echo "error: ${KEY_FILE} is empty" >&2
exit 1
fi
if ! command -v claude >/dev/null 2>&1; then
echo "error: 'claude' not found on PATH. Install Claude Code first." >&2
echo " https://code.claude.com/docs/en/setup" >&2
exit 1
fi
export ANTHROPIC_BASE_URL="${BASE_URL}"
export ANTHROPIC_AUTH_TOKEN="${API_KEY}"
export CLAUDE_CODE_AUTO_COMPACT_WINDOW="1000000"
export ANTHROPIC_MODEL="MiniMax-M3[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="MiniMax-M3[1m]"
export ANTHROPIC_DEFAULT_OPUS_MODEL="MiniMax-M3[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="MiniMax-M3[1m]"
exec claude "$@"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment