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