TL;DR: Crush officially supports custom providers — two crush provider add commands (OpenAI-compatible / Anthropic-compatible) connect it to CodeGateway models.
Prerequisites
Register at codegateway.dev — trial credit included after you bind a card (current amount shown on the signup/pricing page) — and create an API key (sk-cg- prefix).
Crush supports both protocol surfaces; pick a path based on the models you want.
1. Install Crush
brew install charmbracelet/tap/crushOr npm install -g @charmland/crush (Windows: winget install charmbracelet.crush).
2a. Path A: OpenAI-compatible (DeepSeek / Kimi / GLM / Qwen)
crush provider add cg --type openai-compat \
--base-url "https://api.codegateway.dev/v1" \
--api-key "sk-cg-your-key"
crush model add cg/deepseek-v4-pro --context-window 262144--type openai-compatis for non-OpenAI OpenAI-compatible endpoints (use--type openaionly for the official OpenAI API).Model ids match the model list;
--discover-models truelists them automatically.
2b. Path B: Anthropic-compatible (Claude / Gemini)
crush provider add cg-anthropic --type anthropic \
--base-url "https://api.codegateway.dev" \
--api-key "sk-cg-your-key" \
--extra-header "anthropic-version" "2023-06-01"
crush model add cg-anthropic/claude-sonnet-4-6 --context-window 200000On the Messages protocol, Claude and Gemini models work (e.g. claude-sonnet-4-6, gemini-3.8-flash). --extra-header carries the required Anthropic version header.
3. Verify
crush -p "Reply with only: hello" --model cg/deepseek-v4-pro(If your Crush version uses different flags, just launch crush and send a message.) A reply means it works.
Recommended models
OpenAI-compatible path:
deepseek-v4-pro,kimi-k2.7-code,glm-5.3.Anthropic path:
claude-sonnet-4-6,gemini-3.8-flash.
Note: GPT-series models are region-restricted upstream; Claude / Gemini are not for the OpenAI-compatible path.
FAQ
Q: `openai` vs `openai-compat`? openai targets the official OpenAI API; openai-compat targets any compatible endpoint — use openai-compat for CodeGateway.
Q: How do I list providers/models? crush provider list / crush model list.
Q: My model doesn't show up? Make sure the provider prefix (e.g. cg/) in crush model add matches the id from provider add; --discover-models true helps too.
Q: Can I use both protocol paths? Yes — each is an independent provider (cg and cg-anthropic); pick per model.
Q: Where is the config stored? In crushrc (built-in bash config) and JSON config; crush provider add writes them automatically.