Skip to content
Sign Up Free
Coding Agent setup

Crush setup: API key, Base URL, and models

Install Crush, configure BetterToken in crushrc with an API Key and Base URL, select a model, and troubleshoot No providers configured.

Connect Crush to BetterToken with an openai-compat provider in crushrc. In macOS testing with a GPT model, Crush 0.98.2 completed three out of three cold-start text requests and a file-reading tool call through /v1/chat/completions.

Key settings

FieldValue
API KeyBetterToken API Key, passed with --api-key
Base URLhttps://bettertoken.ai/v1, passed with --base-url
Modelbettertoken/YOUR_MODEL_ID
Provider typeopenai-compat
Configuration file~/.config/crush/crushrc

Prerequisites

Install

Use the Homebrew command from the official Crush repository:

Terminal window
brew install charmbracelet/tap/crush
crush --version

Manual setup

Set your BetterToken API Key in the terminal that will run Crush:

Terminal window
export BETTERTOKEN_API_KEY="YOUR_API_KEY"

Create ~/.config/crush/crushrc using the recommended Bash configuration format. Replace every YOUR_MODEL_ID and set --context-window to your selected model’s documented limit. The example’s 128000 is a client declaration, not a verified BetterToken model limit.

Terminal window
provider add bettertoken --type openai-compat --base-url "https://bettertoken.ai/v1" --api-key "$BETTERTOKEN_API_KEY"
model add bettertoken/YOUR_MODEL_ID --name "YOUR_MODEL_ID" --context-window 128000
model large bettertoken/YOUR_MODEL_ID
model small bettertoken/YOUR_MODEL_ID
permissions allow view

Save these commands in crushrc; Crush runs them when it starts. permissions allow view permits the file-viewing tool. The older JSON configuration format is deprecated upstream but still works; its text request also passed in testing.

Verify the connection

Run from your project in the same terminal:

Terminal window
crush run "Reply with only: OK"

Check that the final answer is OK. For file access, ask Crush to read a known file in your project and check both the view tool result and final answer.

Switch models

Add another model with model add, update the model large and model small selections in crushrc, and start a new run.

Common errors

SymptomWhat to check
No providers configuredCrush reports this before sending a request when no usable provider is loaded. Check the location and contents of crushrc, including project configuration that may override it.
401Export BETTERTOKEN_API_KEY before starting Crush and check its value.
No explicit models in the configWith only a provider configured, Crush discovered models through /v1/models in testing. Explicit model add entries let you name the model used by this example.
File access needs approvalCheck permissions allow view in the loaded configuration.

Technical details

The tested openai-compat provider sent generation requests to /v1/chat/completions. Model discovery used /v1/models when explicit model entries were omitted.