Skip to content

Latest commit

 

History

History
103 lines (73 loc) · 2.88 KB

File metadata and controls

103 lines (73 loc) · 2.88 KB
title Crush
description Inject provider API keys into Crush with varlock run

import OpExamplesTip from '@/components/OpExamplesTip.astro';

Crush is Charm's terminal coding agent. It supports many model providers and reads API keys from the environment. Use varlock to inject those keys at runtime so they never sit in a plain text .env or shell history.

For install, schema setup, and shared patterns, see the AI Tools overview.

Launch command: crush

Environment variables (from the Crush README):

  • ANTHROPIC_API_KEY, OPENAI_API_KEY, OPENROUTER_API_KEY, GEMINI_API_KEY, and many other provider keys
  • HYPER_API_KEY for Charm Hyper (Crush's built-in provider)

You can also paste a key in the TUI model picker (ctrl+l). Prefer env injection so the key is not typed into the UI or stored in project config.

OrcaRouter

OrcaRouter is an OpenAI-compatible AI gateway that exposes many models behind one endpoint, with adaptive routing, automatic failover, zero-markup inference, observability, and guardrails. It works with Crush as a custom openai-compat provider, so Crush's model calls can route through OrcaRouter without treating it as an anonymous custom base URL.

Add the provider to ~/.config/crush/crush.json and reference an env var for the key:

{
  "providers": {
    "orcarouter": {
      "type": "openai-compat",
      "base_url": "https://api.orcarouter.ai/v1",
      "api_key": "$ORCAROUTER_API_KEY",
      "models": [
        {
          "id": "orcarouter/auto",
          "name": "OrcaRouter Auto"
        }
      ]
    }
  }
}

Then declare the key in your schema and run Crush through varlock:

# @sensitive
ORCAROUTER_API_KEY=op(op://api-local/orcarouter/api-key)
varlock run -- crush

In a project

Add to .env.schema:

# @sensitive @required
ANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)

# @sensitive
OPENAI_API_KEY=op(op://api-local/openai/api-key)

# @sensitive
OPENROUTER_API_KEY=op(op://api-local/openrouter/api-key)
varlock run -- crush

From any directory

Personal schema at ~/.env.crush:

# @sensitive @required
ANTHROPIC_API_KEY=op(op://api-local/anthropic/api-key)

# @sensitive
OPENAI_API_KEY=op(op://api-local/openai/api-key)
varlock run -p ~/.env.crush -- crush

Shell alias (optional)

alias vcrush='varlock run -p ~/.env.crush --no-redact-stdout -- crush'

--no-redact-stdout keeps Crush's own terminal output unredacted while secrets stay out of your shell history.

:::tip Treat project crush.json as trusted code. Review it before running Crush in a directory you did not author. :::