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/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.
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"
EOFSigned-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.
No Crush yet? Install it (skip if installed)
Run
npm i -g @charmland/crush, thencrush --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 Paste the config into crushrc and add your API key
Open
~/.config/crush/crushrc, paste the block from the top of this page, and replacesk-***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) 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".OKmeans 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 No OK? Match your error
Compare the error in your terminal with Common errors below. Each one lists the cause and the fix.
Switch Crush models: change the name after -m
After
-m, writeaicodewith/plus a model you added withmodel addin crushrc, for exampleaicodewith/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 →
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 →
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 →
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.