Crush (or similar terminal-based AI agents) is a powerful CLI/TUI tool that handles code generation, debugging, and file operations directly inside your command line.Because terminal agents frequently read massive error logs, command outputs, and local files, they consume huge amounts of input tokens. By routing Crush through LLM Router, you automatically apply Middle-Out Context Compression to bloated terminal outputs and ensure your local .env secrets are Redacted before they are sent to third-party AI providers.
Important: When using LLM Router with custom CLI tools, you must configure
the base URL to point to https://api.llmrouter.app/v1 to ensure OpenAI SDK
compatibility.
Open the crush.json file and add the LLM Router endpoint under your providers list. Make sure to replace sk-router-your-api-key with your actual LLM Router API key.
Once configured, you can use Crush as normal to generate code, execute terminal commands, and debug.Because traffic is now flowing through LLM Router, you instantly gain:
Token Savings on Logs: If Crush runs npm run build and ingests 3,000 lines of terminal output, LLM Router will dynamically compress the repetitive middle sections, saving you up to 80% on API costs.
Zero-Trust Security: If Crush accidentally reads your .npmrc or AWS credentials from your local workspace, LLM Router’s PII engine will redact them into [TOKEN_REDACTED] before sending the context to Claude or GPT-4.
Resilience: If your primary AI provider experiences an outage, LLM Router will automatically fall back to your configured secondary provider without interrupting your CLI session.