Crush Integration with CodeGateway: Custom Provider Setup

(Unofficial)

This guide is independently community-maintained. It is not affiliated with, endorsed by, or sponsored by the vendor of the third-party tool it covers. All third-party trademarks are the property of their respective owners.

Two crush provider add commands (OpenAI-compatible or Anthropic-compatible) connect Crush to CodeGateway.

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

bash
brew install charmbracelet/tap/crush

Or npm install -g @charmland/crush (Windows: winget install charmbracelet.crush).

2a. Path A: OpenAI-compatible (DeepSeek / Kimi / GLM / Qwen)

bash
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-compat is for non-OpenAI OpenAI-compatible endpoints (use --type openai only for the official OpenAI API).

  • Model ids match the model list; --discover-models true lists them automatically.

2b. Path B: Anthropic-compatible (Claude / Gemini)

bash
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 200000

On 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

bash
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.

  • 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.

References

Turn this doc into a real API call

Lacking an official key or facing overseas card payment issues? Create an sk-cg- key after signing up, point your base URL at CodeGateway, and keep your existing SDK or CLI unchanged. Pay per token; binding a card adds free credit.

Sign up free
Author:CodeGateway Team