on main help sign in
crush/README.md
994 lines 31 kB history raw
1# Crush
3> [!NOTE]
4> This is a personal fork of [charmbracelet/crush](https://github.com/charmbracelet/crush) with UI/UX tweaks and performance improvements.
6<p align="center">
7 <a href="https://stuff.charm.sh/crush/charm-crush.png"><img width="450" alt="Charm Crush Logo" src="https://github.com/user-attachments/assets/cf8ca3ce-8b02-43f0-9d0f-5a331488da4b" /></a><br />
8 <a href="https://github.com/charmbracelet/crush/releases"><img src="https://img.shields.io/github/release/charmbracelet/crush" alt="Latest Release"></a>
9 <a href="https://github.com/charmbracelet/crush/actions"><img src="https://github.com/charmbracelet/crush/actions/workflows/build.yml/badge.svg" alt="Build Status"></a>
10</p>
12<p align="center">Your new coding bestie, now available in your favourite terminal.<br />Your tools, your code, and your workflows, wired into your LLM of choice.</p>
13<p align="center">终端里的编程新搭档,<br />无缝接入你的工具、代码与工作流,全面兼容主流 LLM 模型。</p>
15<p align="center"><img width="800" alt="Crush Demo" src="https://github.com/user-attachments/assets/58280caf-851b-470a-b6f7-d5c4ea8a1968" /></p>
17## Features
19- **Multi-Model:** choose from a wide range of LLMs or add your own via OpenAI- or Anthropic-compatible APIs
20- **Flexible:** switch LLMs mid-session while preserving context
21- **Session-Based:** maintain multiple work sessions and contexts per project
22- **LSP-Enhanced:** Crush uses LSPs for additional context, just like you do
23- **Extensible:** add capabilities via MCPs (`http`, `stdio`, and `sse`)
24- **Works Everywhere:** first-class support in every terminal on macOS, Linux, Windows (PowerShell and WSL), Android, FreeBSD, OpenBSD, and NetBSD
25- **Industrial Grade:** built on the Charm ecosystem, powering 25k+ applications, from leading open source projects to business-critical infrastructure
27## Installation
29Use a package manager:
31```bash
32# Homebrew
33brew install charmbracelet/tap/crush
35# NPM
36npm install -g @charmland/crush
38# Arch Linux (btw)
39yay -S crush-bin
41# Nix
42nix run github:numtide/nix-ai-tools#crush
44# FreeBSD
45pkg install crush
46```
48Windows users:
50```bash
51# Winget
52winget install charmbracelet.crush
54# Scoop
55scoop bucket add charm https://github.com/charmbracelet/scoop-bucket.git
56scoop install crush
57```
59<details>
60<summary><strong>Nix (NUR)</strong></summary>
62Crush is available via the official Charm [NUR](https://github.com/nix-community/NUR) in `nur.repos.charmbracelet.crush`, which is the most up-to-date way to get Crush in Nix.
64You can also try out Crush via the NUR with `nix-shell`:
66```bash
67# Add the NUR channel.
68nix-channel --add https://github.com/nix-community/NUR/archive/main.tar.gz nur
69nix-channel --update
71# Get Crush in a Nix shell.
72nix-shell -p '(import <nur> { pkgs = import <nixpkgs> {}; }).repos.charmbracelet.crush'
73```
75### NixOS & Home Manager Module Usage via NUR
77Crush provides NixOS and Home Manager modules via NUR.
78You can use these modules directly in your flake by importing them from NUR. Since it auto detects whether its a home manager or nixos context you can use the import the exact same way :)
80```nix
82 inputs = {
83 nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
84 nur.url = "github:nix-community/NUR";
85 };
87 outputs = { self, nixpkgs, nur, ... }: {
88 nixosConfigurations.your-hostname = nixpkgs.lib.nixosSystem {
89 system = "x86_64-linux";
90 modules = [
91 nur.modules.nixos.default
92 nur.repos.charmbracelet.modules.crush
93 {
94 programs.crush = {
95 enable = true;
96 settings = {
97 providers = {
98 openai = {
99 id = "openai";
100 name = "OpenAI";
101 base_url = "https://api.openai.com/v1";
102 type = "openai";
103 api_key = "sk-fake123456789abcdef...";
104 models = [
105 {
106 id = "gpt-4";
107 name = "GPT-4";
108 }
109 ];
110 };
111 };
112 lsp = {
113 go = { command = "gopls"; enabled = true; };
114 nix = { command = "nil"; enabled = true; };
115 };
116 options = {
117 context_paths = [ "/etc/nixos/configuration.nix" ];
118 tui = { compact_mode = true; };
119 debug = false;
120 };
121 };
122 };
123 }
124 ];
125 };
126 };
128```
130</details>
132<details>
133<summary><strong>Debian/Ubuntu</strong></summary>
135```bash
136sudo mkdir -p /etc/apt/keyrings
137curl -fsSL https://repo.charm.sh/apt/gpg.key | sudo gpg --dearmor -o /etc/apt/keyrings/charm.gpg
138echo "deb [signed-by=/etc/apt/keyrings/charm.gpg] https://repo.charm.sh/apt/ * *" | sudo tee /etc/apt/sources.list.d/charm.list
139sudo apt update && sudo apt install crush
140```
142</details>
144<details>
145<summary><strong>Fedora/RHEL</strong></summary>
147```bash
148echo '[charm]
149name=Charm
150baseurl=https://repo.charm.sh/yum/
151enabled=1
152gpgcheck=1
153gpgkey=https://repo.charm.sh/yum/gpg.key' | sudo tee /etc/yum.repos.d/charm.repo
154sudo yum install crush
155```
157</details>
159Or, download it:
161- [Packages][releases] are available in Debian and RPM formats
162- [Binaries][releases] are available for Linux, macOS, Windows, FreeBSD, OpenBSD, and NetBSD
164[releases]: https://github.com/charmbracelet/crush/releases
166Or just install it with Go:
168```
169go install github.com/charmbracelet/crush@latest
170```
172> [!WARNING]
173> Productivity may increase when using Crush and you may find yourself nerd
174> sniped when first using the application. If the symptoms persist, join the
175> [Slack][slack] or [Discord][discord] and nerd snipe the rest of us.
177## Getting Started
179The quickest way to get started is to grab an API key for your preferred
180provider such as Anthropic, OpenAI, Groq, OpenRouter, or Vercel AI Gateway and just start
181Crush. You'll be prompted to enter your API key.
183That said, you can also set environment variables for preferred providers.
185| Environment Variable | Provider |
186| --------------------------- | -------------------------------------------------- |
187| `HYPER_API_KEY` | Charm Hyper |
188| `ANTHROPIC_API_KEY` | Anthropic |
189| `OPENAI_API_KEY` | OpenAI |
190| `VERCEL_API_KEY` | Vercel AI Gateway |
191| `GEMINI_API_KEY` | Google Gemini |
192| `SYNTHETIC_API_KEY` | Synthetic |
193| `ZAI_API_KEY` | Z.ai |
194| `MINIMAX_API_KEY` | MiniMax |
195| `HF_TOKEN` | Hugging Face Inference |
196| `CEREBRAS_API_KEY` | Cerebras |
197| `OPENROUTER_API_KEY` | OpenRouter |
198| `IONET_API_KEY` | io.net |
199| `ALIBABA_SINGAPORE_API_KEY` | Alibaba (Singapore) |
200| `ALIBABA_US_API_KEY` | Alibaba (United States) |
201| `GROQ_API_KEY` | Groq |
202| `AVIAN_API_KEY` | Avian |
203| `OPENCODE_API_KEY` | OpenCode Zen & Go |
204| `VERTEXAI_PROJECT` | Google Cloud VertexAI (Gemini) |
205| `VERTEXAI_LOCATION` | Google Cloud VertexAI (Gemini) |
206| `AWS_ACCESS_KEY_ID` | Amazon Bedrock (Claude) |
207| `AWS_SECRET_ACCESS_KEY` | Amazon Bedrock (Claude) |
208| `AWS_REGION` | Amazon Bedrock (Claude) |
209| `AWS_PROFILE` | Amazon Bedrock (Custom Profile) |
210| `AWS_BEARER_TOKEN_BEDROCK` | Amazon Bedrock |
211| `AZURE_OPENAI_API_ENDPOINT` | Azure OpenAI models |
212| `AZURE_OPENAI_API_KEY` | Azure OpenAI models (optional when using Entra ID) |
213| `AZURE_OPENAI_API_VERSION` | Azure OpenAI models |
214| `MOONSHOT_API_KEY` | Moonshot |
216### Subscriptions
218If you prefer subscription-based usage, here are some plans that work well in
219Crush:
221- [Synthetic](https://synthetic.new/pricing)
222- [GLM Coding Plan](https://z.ai/subscribe)
223- [Kimi Code](https://www.kimi.com/membership/pricing)
224- [MiniMax Coding Plan](https://platform.minimax.io/subscribe/coding-plan)
226### By the Way
228Is there a provider you’d like to see in Crush? Is there an existing model that needs an update?
230Crush’s default model listing is managed in [Catwalk](https://github.com/charmbracelet/catwalk), a community-supported, open source repository of Crush-compatible models, and you’re welcome to contribute.
232<a href="https://github.com/charmbracelet/catwalk"><img width="174" height="174" alt="Catwalk Badge" src="https://github.com/user-attachments/assets/95b49515-fe82-4409-b10d-5beb0873787d" /></a>
234## Configuration
236> [!TIP]
237> Crush ships with a builtin `crush-config` skill for configuring itself. In
238> many cases you can simply ask Crush to configure itself.
240Crush runs great with no configuration. That said, if you do need or want to
241customize Crush, configuration can be added either local to the project itself,
242or globally, with the following priority:
2441. `.crush.json`
2452. `crush.json`
2463. `$HOME/.config/crush/crush.json`
248Configuration itself is stored as a JSON object:
250```json
252 "this-setting": { "this": "that" },
253 "that-setting": ["ceci", "cela"]
255```
257As an additional note, Crush also stores ephemeral data, such as application
258state, in one additional location:
260```bash
261# Unix
262$HOME/.local/share/crush/crush.json
264# Windows
265%LOCALAPPDATA%\crush\crush.json
266```
268> [!TIP]
269> You can override the user and data config locations by setting:
271> - `CRUSH_GLOBAL_CONFIG`
272> - `CRUSH_GLOBAL_DATA`
274### LSPs
276Crush can use LSPs for additional context to help inform its decisions, just
277like you would. LSPs can be added manually like so:
279```json
281 "$schema": "https://charm.land/crush.json",
282 "lsp": {
283 "go": {
284 "command": "gopls",
285 "env": {
286 "GOTOOLCHAIN": "go1.24.5"
287 }
288 },
289 "typescript": {
290 "command": "typescript-language-server",
291 "args": ["--stdio"]
292 },
293 "nix": {
294 "command": "nil"
295 }
296 }
298```
300### MCPs
302Crush also supports Model Context Protocol (MCP) servers through three transport
303types: `stdio` for command-line servers, `http` for HTTP endpoints, and `sse`
304for Server-Sent Events.
306Shell-style value expansion (`$VAR`, `${VAR:-default}`, `$(command)`, quoting,
307nesting) works in `command`, `args`, `env`, `headers`, and `url`, so
308file-based secrets work out of the box. You can use values like `"$TOKEN"`
309or `"$(cat /path/to/secret/token)"`. Expansion runs through Crush's embedded
310shell, so the same syntax works on every supported system, Windows included.
312Unset variables expand to the empty string by default, matching bash. For
313required credentials, use `${VAR:?message}` so an unset variable fails loudly
314at load time with `message` instead of silently resolving to empty:
316```json
317{ "api_key": "${CODEBERG_TOKEN:?set CODEBERG_TOKEN}" }
318```
320Headers (both MCP `headers` and provider `extra_headers`) whose value
321resolves to the empty string are dropped from the outgoing request rather
322than sent as `Header:`. That keeps optional env-gated headers like
323`"OpenAI-Organization": "$OPENAI_ORG_ID"` clean when the variable is unset.
325Provider `extra_body` is a non-expanding JSON passthrough; put env-driven
326values in `extra_headers` or the provider's `api_key` / `base_url`, all of
327which do expand.
329> **Security note:** `crush.json` is trusted code. Any `$(...)` in it runs at
330> load time with your shell's privileges, before the UI appears. Don't launch
331> Crush in a directory whose `crush.json` you haven't reviewed.
333```json
335 "$schema": "https://charm.land/crush.json",
336 "mcp": {
337 "filesystem": {
338 "type": "stdio",
339 "command": "node",
340 "args": ["/path/to/mcp-server.js"],
341 "timeout": 120,
342 "disabled": false,
343 "disabled_tools": ["some-tool-name"],
344 "env": {
345 "NODE_ENV": "production"
346 }
347 },
348 "github": {
349 "type": "http",
350 "url": "https://api.githubcopilot.com/mcp/",
351 "timeout": 120,
352 "disabled": false,
353 "disabled_tools": ["create_issue", "create_pull_request"],
354 "headers": {
355 "Authorization": "Bearer $GH_PAT"
356 }
357 },
358 "streaming-service": {
359 "type": "sse",
360 "url": "https://example.com/mcp/sse",
361 "timeout": 120,
362 "disabled": false,
363 "headers": {
364 "API-Key": "$(echo $API_KEY)"
365 }
366 }
367 }
369```
371### Hooks
373Crush has preliminary support for hooks. For details, see
374[the hook guide](./docs/hooks/).
376### Sharing a workspace across clients
378When Crush is run against a shared backend (for example two TUIs talking to
379the same `crush serve`), clients are grouped into **workspaces** keyed by
380their resolved `--cwd`. Two clients with the same `--cwd` join the same
381underlying workspace, so they share the session list, message history,
382permission queue, LSP, and MCP state.
384Joining is implicit: pointing a second client at the same working directory
385attaches it to the existing workspace. Each new invocation, however, starts
386in its own fresh session by default. To pick up the conversation another
387client already has open, use the session manager (the session picker) and
388select it. Sessions surface two signals there:
390- `IsBusy` is set while an agent turn is in flight for that session.
391- `AttachedClients` reports how many clients are currently viewing it.
393A non-zero `AttachedClients` (often combined with `IsBusy`) is the cue that a
394session is "in progress" on another client and joining it will mirror that
395view live.
397The first client to create a workspace fixes its process-wide flags. In
398particular, `--yolo` and `--debug` follow a **first-wins** rule: later
399clients that arrive at the same `--cwd` with different values for those
400flags do not change the running workspace. A debug log line is emitted
401recording the mismatch, and the workspace keeps the flags it was created
402with.
404A workspace lives as long as at least one client has an SSE event stream
405open against it. When the last stream disconnects, the workspace is torn
406down. There is a short grace window right after `POST /v1/workspaces` so a
407client that has created the workspace but not yet opened its event stream
408does not get reaped before it can attach.
410### Global context files
412Crush automatically includes two files for cross-project instructions.
414- `~/.config/crush/CRUSH.md`: Crush-specific rules that would confuse other
415 agentic coding tools. If you only use Crush, this is the only one you need to
416 edit.
417- `~/.config/AGENTS.md`: generic instructions that other coding tools might
418 read. Avoid referring to Crush-specific features or workflows here. You
419 probably only care about this if you use multiple agentic coding tools and
420 want to share instructions between them.
422You can customize these paths using the `global_context_paths` option in your
423configuration:
425```jsonc
427 "$schema": "https://charm.land/crush.json",
428 "options": {
429 "global_context_paths": [
430 "~/path/to/custom/context/file.md",
431 "/full/path/to/folder/of/files/" // recursively load all .md files in folder
432 ]
433 }
435```
437### Ignoring Files
439Crush respects `.gitignore` files by default, but you can also create a
440`.crushignore` file to specify additional files and directories that Crush
441should ignore. This is useful for excluding files that you want in version
442control but don't want Crush to consider when providing context.
444The `.crushignore` file uses the same syntax as `.gitignore` and can be placed
445in the root of your project or in subdirectories.
447### Allowing Tools
449By default, Crush will ask you for permission before running tool calls. If
450you'd like, you can allow tools to be executed without prompting you for
451permissions. Use this with care.
453```json
455 "$schema": "https://charm.land/crush.json",
456 "permissions": {
457 "allowed_tools": [
458 "view",
459 "ls",
460 "grep",
461 "edit",
462 "mcp_context7_get-library-doc"
463 ]
464 }
466```
468You can also skip all permission prompts entirely by running Crush with the
469`--yolo` flag. Be very, very careful with this feature.
471### Disabling Built-In Tools
473If you'd like to prevent Crush from using certain built-in tools entirely, you
474can disable them via the `options.disabled_tools` list. Disabled tools are
475completely hidden from the agent.
477```json
479 "$schema": "https://charm.land/crush.json",
480 "options": {
481 "disabled_tools": ["bash", "sourcegraph"]
482 }
484```
486To disable tools from MCP servers, see the [MCP config section](#mcps).
488### Disabling Skills
490If you'd like to prevent Crush from using certain skills entirely, you can
491disable them via the `options.disabled_skills` list. Disabled skills are hidden
492from the agent, including builtin skills and skills discovered from disk.
494```json
496 "$schema": "https://charm.land/crush.json",
497 "options": {
498 "disabled_skills": ["crush-config"]
499 }
501```
503### Agent Skills
505Crush supports the [Agent Skills](https://agentskills.io) open standard for
506extending agent capabilities with reusable skill packages. Skills are folders
507containing a `SKILL.md` file with instructions that Crush can discover and
508activate on demand.
510The global paths we looks for skills are:
512* `$CRUSH_SKILLS_DIR`
513* `$XDG_CONFIG_HOME/agents/skills` or `~/.config/agents/skills/`
514* `$XDG_CONFIG_HOME/crush/skills` or `~/.config/crush/skills/`
515* `~/.agents/skills/`
516* `~/.claude/skills/`
517* On Windows, we _also_ look at
518 * `%LOCALAPPDATA%\agents\skills\` or `%USERPROFILE%\AppData\Local\agents\skills\`
519 * `%LOCALAPPDATA%\crush\skills\` or `%USERPROFILE%\AppData\Local\crush\skills\`
520* Additional paths configured via `options.skills_paths`
522On top of that, we _also_ load skills in your project from the following
523relative paths:
525* `.agents/skills`
526* `.crush/skills`
527* `.claude/skills`
528* `.cursor/skills`
530```jsonc
532 "$schema": "https://charm.land/crush.json",
533 "options": {
534 "skills_paths": [
535 "~/.config/crush/skills", // Windows: "%LOCALAPPDATA%\\crush\\skills",
536 "./project-skills",
537 ],
538 },
540```
542You can get started with example skills from [anthropics/skills](https://github.com/anthropics/skills):
544```bash
545# Unix
546mkdir -p ~/.config/crush/skills
547cd ~/.config/crush/skills
548git clone https://github.com/anthropics/skills.git _temp
549mv _temp/skills/* . && rm -rf _temp
550```
552```powershell
553# Windows (PowerShell)
554mkdir -Force "$env:LOCALAPPDATA\crush\skills"
555cd "$env:LOCALAPPDATA\crush\skills"
556git clone https://github.com/anthropics/skills.git _temp
557mv _temp/skills/* . ; rm -r -force _temp
558```
560#### User-Invocable Skills
562Skills can be made invocable as commands from the commands palette (Ctrl+P). Add `user-invocable: true` to the skill's YAML frontmatter:
564```yaml
565---
566name: my-skill
567description: A skill that can be invoked as a command.
568user-invocable: true
569---
570```
572User-invocable skills appear in the commands palette with a `user:` or `project:` prefix:
573- Skills from global directories show as `user:skill-name`
574- Skills from project directories show as `project:skill-name`
576When invoked, the skill's instructions are loaded into the conversation context.
578To prevent the model from auto-triggering a skill (while still allowing user invocation), add `disable-model-invocation: true`:
580```yaml
581---
582name: my-skill
583description: Only invocable by users, not the model.
584user-invocable: true
585disable-model-invocation: true
586---
587```
589Skills with `disable-model-invocation` won't appear in the model's available skills list but can still be invoked manually by users.
591### Desktop notifications
593Crush sends desktop notifications when a tool call requires permission and when
594the agent finishes its turn. They're only sent when the terminal window isn't
595focused _and_ your terminal supports reporting the focus state.
597```jsonc
599 "$schema": "https://charm.land/crush.json",
600 "options": {
601 "disable_notifications": false, // default
602 },
604```
606To disable desktop notifications, set `disable_notifications` to `true` in your
607configuration. On macOS, notifications currently lack icons due to platform
608limitations.
610### Initialization
612When you initialize a project, Crush analyzes your codebase and creates
613a context file that helps it work more effectively in future sessions.
614By default, this file is named `AGENTS.md`, but you can customize the
615name and location with the `initialize_as` option:
617```json
619 "$schema": "https://charm.land/crush.json",
620 "options": {
621 "initialize_as": "AGENTS.md"
622 }
624```
626This is useful if you prefer a different naming convention or want to
627place the file in a specific directory (e.g., `CRUSH.md` or
628`docs/LLMs.md`). Crush will fill the file with project-specific context
629like build commands, code patterns, and conventions it discovered during
630initialization.
632### Attribution Settings
634By default, Crush adds attribution information to Git commits and pull requests
635it creates. You can customize this behavior with the `attribution` option:
637```json
639 "$schema": "https://charm.land/crush.json",
640 "options": {
641 "attribution": {
642 "trailer_style": "co-authored-by",
643 "generated_with": true
644 }
645 }
647```
649- `trailer_style`: Controls the attribution trailer added to commit messages
650 (default: `assisted-by`)
651 - `assisted-by`: Adds `Assisted-by: Crush:[ModelID]` as specified in [the convention](https://docs.kernel.org/process/coding-assistants.html#attribution)
652 - `co-authored-by`: Adds `Co-Authored-By: Crush <crush@charm.land>`
653 - `none`: No attribution trailer
654- `generated_with`: When true (default), adds `💘 Generated with Crush` line to
655 commit messages and PR descriptions
657### Custom Providers
659Crush supports custom provider configurations for both OpenAI-compatible and
660Anthropic-compatible APIs.
662> [!NOTE]
663> Note that we support two "types" for OpenAI. Make sure to choose the right one
664> to ensure the best experience!
666> - `openai` should be used when proxying or routing requests through OpenAI.
667> - `openai-compat` should be used when using non-OpenAI providers that have OpenAI-compatible APIs.
669#### OpenAI-Compatible APIs
671Here’s an example configuration for Deepseek, which uses an OpenAI-compatible
672API. Don't forget to set `DEEPSEEK_API_KEY` in your environment.
674```json
676 "$schema": "https://charm.land/crush.json",
677 "providers": {
678 "deepseek": {
679 "type": "openai-compat",
680 "base_url": "https://api.deepseek.com/v1",
681 "api_key": "$DEEPSEEK_API_KEY",
682 "models": [
683 {
684 "id": "deepseek-chat",
685 "name": "Deepseek V3",
686 "cost_per_1m_in": 0.27,
687 "cost_per_1m_out": 1.1,
688 "cost_per_1m_in_cached": 0.07,
689 "cost_per_1m_out_cached": 1.1,
690 "context_window": 64000,
691 "default_max_tokens": 5000
692 }
693 ]
694 }
695 }
697```
699#### Anthropic-Compatible APIs
701Custom Anthropic-compatible providers follow this format:
703```json
705 "$schema": "https://charm.land/crush.json",
706 "providers": {
707 "custom-anthropic": {
708 "type": "anthropic",
709 "base_url": "https://api.anthropic.com/v1",
710 "api_key": "$ANTHROPIC_API_KEY",
711 "extra_headers": {
712 "anthropic-version": "2023-06-01"
713 },
714 "models": [
715 {
716 "id": "claude-sonnet-4-20250514",
717 "name": "Claude Sonnet 4",
718 "cost_per_1m_in": 3,
719 "cost_per_1m_out": 15,
720 "cost_per_1m_in_cached": 3.75,
721 "cost_per_1m_out_cached": 0.3,
722 "context_window": 200000,
723 "default_max_tokens": 50000,
724 "can_reason": true,
725 "supports_attachments": true
726 }
727 ]
728 }
729 }
731```
733### Amazon Bedrock
735Crush currently supports running Anthropic models through Bedrock, with caching disabled.
737- A Bedrock provider will appear once you have AWS configured, i.e. `aws configure`
738- Crush also expects the `AWS_REGION` or `AWS_DEFAULT_REGION` to be set
739- To use a specific AWS profile set `AWS_PROFILE` in your environment, i.e. `AWS_PROFILE=myprofile crush`
740- Alternatively to `aws configure`, you can also just set `AWS_BEARER_TOKEN_BEDROCK`
742### Vertex AI Platform
744Vertex AI will appear in the list of available providers when `VERTEXAI_PROJECT` and `VERTEXAI_LOCATION` are set. You will also need to be authenticated:
746```bash
747gcloud auth application-default login
748```
750To add specific models to the configuration, configure as such:
752```json
754 "$schema": "https://charm.land/crush.json",
755 "providers": {
756 "vertexai": {
757 "models": [
758 {
759 "id": "claude-sonnet-4@20250514",
760 "name": "VertexAI Sonnet 4",
761 "cost_per_1m_in": 3,
762 "cost_per_1m_out": 15,
763 "cost_per_1m_in_cached": 3.75,
764 "cost_per_1m_out_cached": 0.3,
765 "context_window": 200000,
766 "default_max_tokens": 50000,
767 "can_reason": true,
768 "supports_attachments": true
769 }
770 ]
771 }
772 }
774```
776### Local Models
778Crush can auto-discovers models from local providers. Add a custom provider
779with `type` set to `llamacpp`, `omlx`, `lmstudio`, `litellm`, or `ollama`
780and leave out the models list. Crush will populate the model list
781automatically.
783```json
785 "providers": {
786 "ollama": {
787 "name": "Ollama",
788 "base_url": "http://localhost:11434/v1/",
789 "type": "ollama"
790 }
791 }
793```
795For llama.cpp (`llama-server`), point at the server's base URL:
797```json
799 "providers": {
800 "llamacpp": {
801 "name": "llama.cpp",
802 "base_url": "http://localhost:2222",
803 "type": "llamacpp"
804 }
805 }
807```
809#### Manual Model Configuration
811You can still list models explicitly. User-defined models always take
812precedence over discovered ones, and any fields you set won't be overwritten
813by auto-discovery. Auto discovery will run if the model list is empty for any
814`openai-compat` provider or if you pass `"discover_models": true` it will merge
815 the found models with your hand configured ones.
817```json
819 "providers": {
820 "ollama": {
821 "name": "Ollama",
822 "base_url": "http://localhost:11434/v1/",
823 "type": "ollama",
824 "models": [
825 {
826 "name": "Qwen 3 30B",
827 "id": "qwen3:30b",
828 "context_window": 256000,
829 "default_max_tokens": 20000
830 }
831 ],
832 "discover_models": true
833 }
834 }
836```
838## Logging
840Sometimes you need to look at logs. Luckily, Crush logs all sorts of
841stuff. Logs are stored in `./.crush/logs/crush.log` relative to the project.
843The CLI also contains some helper commands to make perusing recent logs easier:
845```bash
846# Print the last 1000 lines
847crush logs
849# Print the last 500 lines
850crush logs --tail 500
852# Follow logs in real time
853crush logs --follow
854```
856Want more logging? Run `crush` with the `--debug` flag, or enable it in the
857config:
859```json
861 "$schema": "https://charm.land/crush.json",
862 "options": {
863 "debug": true,
864 "debug_lsp": true
865 }
867```
869## Provider Auto-Updates
871By default, Crush automatically checks for the latest and greatest list of
872providers and models from [Catwalk](https://github.com/charmbracelet/catwalk),
873the open source Crush provider database. This means that when new providers and
874models are available, or when model metadata changes, Crush automatically
875updates your local configuration.
877### Disabling automatic provider updates
879For those with restricted internet access, or those who prefer to work in
880air-gapped environments, this might not be want you want, and this feature can
881be disabled.
883To disable automatic provider updates, set `disable_provider_auto_update` into
884your `crush.json` config:
886```json
888 "$schema": "https://charm.land/crush.json",
889 "options": {
890 "disable_provider_auto_update": true
891 }
893```
895Or set the `CRUSH_DISABLE_PROVIDER_AUTO_UPDATE` environment variable:
897```bash
898export CRUSH_DISABLE_PROVIDER_AUTO_UPDATE=1
899```
901### Manually updating providers
903Manually updating providers is possible with the `crush update-providers`
904command:
906```bash
907# Update providers remotely from Catwalk.
908crush update-providers
910# Update providers from a custom Catwalk base URL.
911crush update-providers https://example.com/
913# Update providers from a local file.
914crush update-providers /path/to/local-providers.json
916# Reset providers to the embedded version, embedded at crush at build time.
917crush update-providers embedded
919# For more info:
920crush update-providers --help
921```
923## Metrics
925Crush records pseudonymous usage metrics (tied to a device-specific hash),
926which maintainers rely on to inform development and support priorities. The
927metrics include solely usage metadata; prompts and responses are NEVER
928collected.
930Details on exactly what’s collected are in the source code ([here](https://github.com/charmbracelet/crush/tree/main/internal/event)
931and [here](https://github.com/charmbracelet/crush/blob/main/internal/llm/agent/event.go)).
933You can opt out of metrics collection at any time by setting the environment
934variable by setting the following in your environment:
936```bash
937export CRUSH_DISABLE_METRICS=1
938```
940Or by setting the following in your config:
942```json
944 "options": {
945 "disable_metrics": true
946 }
948```
950Crush also respects the [`DO_NOT_TRACK`](https://donottrack.sh/) convention
951which can be enabled via `export DO_NOT_TRACK=1`.
953## Q&A
955### Why is clipboard copy and paste not working?
957Installing an extra tool might be needed on Unix-like environments.
959| Environment | Tool |
960| ------------------- | ------------------------ |
961| Windows | Native support |
962| macOS | Native support |
963| Linux/BSD + Wayland | `wl-copy` and `wl-paste` |
964| Linux/BSD + X11 | `xclip` or `xsel` |
966## Contributing
968See the [contributing guide](https://github.com/charmbracelet/crush?tab=contributing-ov-file#contributing).
970## Whatcha think?
972We’d love to hear your thoughts on this project. Need help? We gotchu. You can find us on:
974- [Twitter](https://twitter.com/charmcli)
975- [Slack][slack]
976- [Discord][discord]
977- [The Fediverse](https://mastodon.social/@charmcli)
978- [Bluesky](https://bsky.app/profile/charm.land)
980[slack]: https://charm.land/slack
981[discord]: https://charm.land/discord
983## License
985[FSL-1.1-MIT](https://github.com/charmbracelet/crush/raw/main/LICENSE.md)
987---
989Part of [Charm](https://charm.land).
991<a href="https://charm.land/"><img alt="The Charm logo" width="400" src="https://stuff.charm.sh/charm-banner-softy.jpg" /></a>
993<!--prettier-ignore-->
994Charm热爱开源 • Charm loves open source