Crush API key setup

Crush API Key: Set Your Own Key in crushrc

Paste the block below into crushrc, swap in your own API key, and Crush can use Claude and other models. Pay as you go.

~/.config/crush/crushrccrushrc
config
# ~/.config/crush/crushrc
provider add aicodewith --type openai-compat \
  --base-url "https://api.aicodewith.ai/v1" \
  --api-key "sk-***"
model add aicodewith/claude-haiku-4-5-20251001 --name "Claude Haiku 4.5"
model add aicodewith/gpt-5.5 --name "GPT-5.5"
model add aicodewith/deepseek-flash --name "DeepSeek Flash"

Setup steps

Save this key for later terminals

Once you are signed in, this command includes your own key. Copy it, run it once, and the tool keeps the key in the location we tested.

bash
mkdir -p "$(dirname "$HOME/.config/crush/crushrc")"
cat > "$HOME/.config/crush/crushrc" << 'EOF'
# ~/.config/crush/crushrc
provider add aicodewith --type openai-compat \
  --base-url "https://api.aicodewith.ai/v1" \
  --api-key "sk-***"
model add aicodewith/claude-haiku-4-5-20251001 --name "Claude Haiku 4.5"
model add aicodewith/gpt-5.5 --name "GPT-5.5"
model add aicodewith/deepseek-flash --name "DeepSeek Flash"
EOF

Signed-out visitors only see a placeholder. Sign in and we fill in your key. Get a key in the console

Copying only puts the command on the clipboard. You still need to run it in a terminal, or paste the key into the tool settings. How to get an API key

These steps were tested on Linux (bash). macOS and Windows have not been tested yet, so they are not listed.

  1. No Crush yet? Install it (skip if installed)

    Run npm i -g @charmland/crush, then crush --version. A version number means it is installed.

    Install Crush with npm i -g @charmland/crush. crush --version then draws its pixel logo and prints crush version v0.98.1
  2. Paste the config into crushrc and add your API key

    Open ~/.config/crush/crushrc, paste the block from the top of this page, and replace sk-*** with your API key (Get an API key). Write the key itself after --api-key, not "$AICODEWITH_API_KEY", so a new terminal keeps it.

    In ~/.config/crush/crushrc, set --api-key to your key (masked as sk-*** here)
  3. Open a new terminal and test Crush

    Open a new terminal and run crush run --quiet -m aicodewith/claude-haiku-4-5-20251001 "Reply with exactly: OK". OK means Crush is using your API key.

    Verify: close the terminal, open a new one, run crush run --quiet -m aicodewith/claude-haiku-4-5-20251001 "Reply with exactly: OK"; an OK reply means it is set up
  4. No OK? Match your error

    Compare the error in your terminal with Common errors below. Each one lists the cause and the fix.

  5. Switch Crush models: change the name after -m

    After -m, write aicodewith/ plus a model you added with model add in crushrc, for example aicodewith/deepseek-flash. Model IDs are on Models and pricing.

Common errors

No key set: Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}.

What you see

Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}.
(English: "Please provide a valid API key in the request.")
Cause
--api-key in crushrc is "$AICODEWITH_API_KEY", and the new terminal has no such variable
How to fix
Write your key directly after --api-key, as in step 2

Go back to step 2: Paste the config into crushrc →

No key set: crushrc references "$AICODEWITH_API_KEY" but the new terminal has no such variable. Running crush run --quiet -m aicodewith/claude-haiku-4-5-20251001 "Reply with exactly: OK" prints, under a red ERROR label: Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}. (English: "Please provide a valid API key in the request.")

Wrong key: Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}.

What you see

Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}.
(English: "Please provide a valid API key in the request.")
Cause
The key in --api-key is wrong; the error is the same as with no key
How to fix
Copy the key from the console again and replace the value in the --api-key quotes

Go back to step 2: Paste the config into crushrc →

Wrong key: grep -n sk-wrong ~/.config/crush/crushrc shows line 3 is --api-key "sk-wrong". Running crush run --quiet -m aicodewith/claude-haiku-4-5-20251001 "Reply with exactly: OK" prints, under a red ERROR label: Agent processing failed: failed to start agent processing stream: unauthorized: {"error":"请在请求中提供有效的 API Key。"}. (English: "Please provide a valid API key in the request.") — the same as with no key

403 Forbidden

What you see

403 Forbidden (the message text varies by network, e.g. Request not allowed or Country, region, or territory not supported)
Cause
The command has no -m aicodewith/<model>, so Crush calls the default Anthropic endpoint (api.anthropic.com)
How to fix
Add -m aicodewith/deepseek-flash (or another model from the config)

Go back to step 3: Open a new terminal and test Crush →

Common error: without -m aicodewith/<model>, Crush calls the default Anthropic endpoint (api.anthropic.com) and gets 403 Forbidden (the message text varies by network, e.g. Request not allowed or Country, region, or territory not supported). Add -m aicodewith/deepseek-flash (or another model from the config)

FAQ

How do I use my own API key in Crush?

In ~/.config/crush/crushrc, provider add an openai-compat provider with --base-url https://api.aicodewith.ai/v1 and write your key after --api-key. A new terminal keeps it.

openai or openai-compat?

Use openai-compat. Keep openai for connecting to OpenAI directly.

Where is the Crush crushrc?

Global: ~/.config/crush/crushrc. A project .crushrc or crushrc takes priority.

Crush says unauthorized. What now?

--api-key in crushrc is empty or wrong. See Common errors above for the fix.

Sources

Related links