Claude Code speaks the Anthropic API, and Corvex exposes an Anthropic-compatible
endpoint — so you can point Claude Code at a Corvex model by setting a base URL,
your API key, and the model to use. The launcher shim below wires those in for a
single run and safely sets your existing Claude credentials aside while it runs,
restoring them on exit.
Prerequisites
- A Corvex API key (
sk-corvex-...) from the Token Factory dashboard. See
Authentication.
- A model name from the Models catalog (this guide uses
MiniMaxAI/MiniMax-M2.5 as the example).
- Claude Code installed and
jq available.
Store your key and endpoint in a private env file
Replace sk-corvex-... with your key from the dashboard.mkdir -p ~/.corvex
chmod 700 ~/.corvex
cat > ~/.corvex/claude-code.env <<'EOF'
export CORVEX_API_KEY="sk-corvex-..."
export CORVEX_BASE_URL="https://api.tokenfactory.corvex.cloud"
export CORVEX_CLAUDE_MODEL="MiniMaxAI/MiniMax-M2.5"
EOF
chmod 600 ~/.corvex/claude-code.env
Create the launcher shim
This claude-corvex launcher points Claude Code at Corvex for one session
and backs up / restores your normal Claude credentials automatically.cat > ~/claude-corvex <<'EOF'
#!/usr/bin/env bash
set -euo pipefail
ENV_FILE="${HOME}/.corvex/claude-code.env"
CRED_FILE="${HOME}/.claude/.credentials.json"
CRED_BAK="${HOME}/.claude/.credentials.json.corvex-bak"
if [[ ! -f "${ENV_FILE}" ]]; then
echo "[claude-corvex] missing ${ENV_FILE}" >&2
exit 1
fi
set -a
# shellcheck disable=SC1090
source "${ENV_FILE}"
set +a
cleanup() {
if [[ -f "${CRED_BAK}" ]]; then
mv -f "${CRED_BAK}" "${CRED_FILE}"
echo "[claude-corvex] restored ${CRED_FILE}" >&2
fi
}
trap cleanup EXIT INT TERM
if [[ -f "${CRED_FILE}" ]]; then
mv -f "${CRED_FILE}" "${CRED_BAK}"
echo "[claude-corvex] moved ${CRED_FILE} -> ${CRED_BAK} (restored on exit)" >&2
fi
export ANTHROPIC_BASE_URL="${CORVEX_BASE_URL}"
export ANTHROPIC_AUTH_TOKEN="${CORVEX_API_KEY}"
export ANTHROPIC_MODEL="${CORVEX_CLAUDE_MODEL}"
export ANTHROPIC_DEFAULT_SONNET_MODEL="${CORVEX_CLAUDE_MODEL}"
export ANTHROPIC_DEFAULT_OPUS_MODEL="${CORVEX_CLAUDE_MODEL}"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="${CORVEX_CLAUDE_MODEL}"
export CLAUDE_CODE_SUBAGENT_MODEL="${CORVEX_CLAUDE_MODEL}"
echo "[claude-corvex] ${ANTHROPIC_BASE_URL}" >&2
echo "[claude-corvex] model: ${ANTHROPIC_MODEL}" >&2
claude --model "${CORVEX_CLAUDE_MODEL}" "$@"
EOF
chmod 700 ~/claude-corvex
Smoke-test the endpoint
Confirm your key and endpoint work before launching Claude Code.source ~/.corvex/claude-code.env
curl -sS "${CORVEX_BASE_URL}/v1/models" \
-H "Authorization: Bearer ${CORVEX_API_KEY}" \
| jq .
Run Claude Code through Corvex
cd /path/to/your/repo
~/claude-corvex
Inside Claude Code, verify it is pointed at Corvex:
The shim sets your normal Claude credentials aside only for the duration of the
run and restores them on exit, so it won’t disturb your usual Claude Code setup.