Skip to main content
Claude Code speaks the Anthropic API, and Corvex exposes an Anthropic-compatible endpoint. You can point Claude Code at a Corvex model by setting a base URL, your API key, and the model to use. The launcher below wires those in for a single run and isolates the session in its own config directory (~/.claude-corvex) via CLAUDE_CONFIG_DIR. Your normal Claude credentials, sessions, and settings stay untouched. You can run Claude Code through Corvex alongside your normal Claude Code sessions at the same time.

Prerequisites

  • A Corvex API key (sk-corvex-...) from the Token Factory dashboard. See Authentication.
  • A model name from the Models catalog (this guide uses zai-org/GLM-5.2-FP8 as the example).
  • Claude Code installed and jq available.

Context length

Claude Code doesn’t auto-detect the context window of a model reached over a custom endpoint. It caps the usable window at 200K tokens. Both Corvex models have a larger native window than that, but over this integration the session is bounded at 200K regardless. Configure compaction to that ceiling:
  • CLAUDE_CODE_AUTO_COMPACT_WINDOW: set this to 200000, the window Claude Code actually enforces here. Setting it to the model’s larger native window would put the compaction trigger past the limit the session hits, so compaction would never fire and the session would fail on a full context instead.
  • CLAUDE_AUTOCOMPACT_PCT_OVERRIDE: percentage (1-100) of that window at which compaction triggers, e.g. 90 to compact with ~10% headroom.
Confirm with /context in a session. To use a model’s full native window, call the API directly; see the Quickstart.
1

Store your key and endpoint in a private env file

Replace sk-corvex-... with your key from the dashboard.
2

Create the launcher

This claude-corvex launcher points Claude Code at Corvex for one session by isolating it in its own config directory (~/.claude-corvex) via CLAUDE_CONFIG_DIR. It sources your env file, exports the Corvex endpoint and model, and passes arguments through to claude. Your normal Claude credentials are never touched.The script installs to ~/.local/bin so you can invoke it as claude-corvex from any directory. That directory is on PATH by default on most Linux distributions; on macOS, add export PATH="${HOME}/.local/bin:${PATH}" to your shell profile (e.g. ~/.zshrc) and restart your shell.
3

Smoke-test the endpoint

Confirm your key and endpoint work before launching Claude Code.
4

Run Claude Code through Corvex

Inside Claude Code, verify it is pointed at Corvex:
5

Carry over your plugins and MCP servers (optional)

The launcher does not mirror your customizations on launch, so the Corvex profile starts clean. Run this claude-corvex-migrate script to carry your plugins, settings, CLAUDE.md, and MCP servers from your normal Claude profile into ~/.claude-corvex. Run it once before launching, or again after changing your main Claude config. It is safe to re-run and best-effort: a missing tool or failed step warns and continues, and the launcher works regardless.The first part copies named paths from ~/.claude/ via an rsync include-list (only those paths copy, so credentials and runtime state never leak across). It needs rsync, skipped with a warning if absent. The second part merges only the mcpServers key from ~/.claude.json into the Corvex profile. It needs jq. The first run may be slow if your plugin tree is large.
Run it:

Subcommands

The launcher passes arguments straight through to claude and exports CLAUDE_CONFIG_DIR, so mcp, plugin, config, and other subcommands target ~/.claude-corvex automatically.
  • claude mcp add run via this launcher writes to the Corvex profile (~/.claude-corvex/.claude.json), not your normal one. That is the isolation working as intended.
  • Use -s user (or local) for personal config. -s project writes a .mcp.json into the current project dir, which is shared across both profiles.

Known caveats

  • Isolation. The launcher sets CLAUDE_CONFIG_DIR to ~/.claude-corvex, giving the Corvex profile its own sessions, projects, history, and settings. Your normal Claude credentials are never touched, so normal Claude stays logged in unconditionally. You can run both profiles at the same time.
  • Customizations not mirrored. The launcher does not copy your plugins, settings, CLAUDE.md, or MCP servers into the Corvex profile on launch. Without running claude-corvex-migrate (the optional Step above), the Corvex profile starts with no customizations. Run migrate once before launching, or again after changing your main Claude config.
  • Prompt caching. The Anthropic Messages surface accepts cache_control annotations, but Corvex does not implement prompt caching. The annotations are accepted so Claude Code and Anthropic SDK clients work unchanged; every response reports zero cache usage. See Errors: Prompt caching for details.
  • Model capabilities. Not every Corvex model supports every Anthropic feature (for example, some are text-only). If Claude Code sends a request the model cannot fulfill, the gateway returns a structured error. Pick a model whose capability list matches your workflow from the Models page.
If you switch models, update CORVEX_CLAUDE_MODEL. Leave CLAUDE_CODE_AUTO_COMPACT_WINDOW at 200000: it is the ceiling Claude Code enforces over a custom endpoint, not a per-model value.