1> [!WARNING]
2> 🚧 This is a pre-release under heavy, active development. Things are still in flux but we’re excited to share early progress.
3
4# Crush
5
6<p>
7 <a href="https://github.com/charmbracelet/crush/releases"><img src="https://img.shields.io/github/release/charmbracelet/crush" alt="Latest Release"></a>
8 <a href="https://github.com/charmbracelet/crush/actions"><img src="https://github.com/charmbracelet/crush/workflows/build/badge.svg" alt="Build Status"></a>
9</p>
10
11Crush is a tool for building software with AI.
12
13## Installation
14
15Nightly builds are available while Crush is in development.
16
17- [Packages](https://github.com/charmbracelet/crush/releases/tag/nightly) are available in Debian and RPM formats
18- [Binaries](https://github.com/charmbracelet/crush/releases/tag/nightly) are available for Linux and macOS
19
20You can also just install it with go:
21
22```
23git clone git@github.com:charmbracelet/crush.git
24cd crush
25go install
26```
27
28Note that Crush doesn't support Windows yet, however Windows support is planned and in progress.
29
30## Getting Started
31
32For now, the quickest way to get started is to set an environment variable for
33your preferred provider. Note that you can switch between providers mid-
34sessions, so you're welcome to set environment variables for multiple
35providers.
36
37| Environment Variable | Provider |
38| -------------------------- | -------------------------------------------------- |
39| `ANTHROPIC_API_KEY` | Anthropic |
40| `OPENAI_API_KEY` | OpenAI |
41| `GEMINI_API_KEY` | Google Gemini |
42| `VERTEXAI_PROJECT` | Google Cloud VertexAI (Gemini) |
43| `VERTEXAI_LOCATION` | Google Cloud VertexAI (Gemini) |
44| `GROQ_API_KEY` | Groq |
45| `AWS_ACCESS_KEY_ID` | AWS Bedrock (Claude) |
46| `AWS_SECRET_ACCESS_KEY` | AWS Bedrock (Claude) |
47| `AWS_REGION` | AWS Bedrock (Claude) |
48| `AZURE_OPENAI_ENDPOINT` | Azure OpenAI models |
49| `AZURE_OPENAI_API_KEY` | Azure OpenAI models (optional when using Entra ID) |
50| `AZURE_OPENAI_API_VERSION` | Azure OpenAI models |
51
52## Configuration
53
54For many use cases, Crush can be run with no config. That said, if you do need config, it can be added either local to the project itself, or globally. Configuration has the following priority:
55
561. `.crush.json`
572. `crush.json`
583. `$HOME/.config/crush/crush.json`
59
60### LSPs
61
62Crush can use LSPs for additional context to help inform its decisions, just like you would. LSPs can be added manually like so:
63
64```json
65{
66 "lsp": {
67 "go": {
68 "disabled": false,
69 "command": "gopls"
70 },
71 "typescript": {
72 "disabled": false,
73 "command": "typescript-language-server",
74 "args": ["--stdio"]
75 },
76 "nix": {
77 "command": "alejandra"
78 }
79 }
80}
81```
82
83### Amazon Bedrock
84
85To use AWS Bedrock with Claude models, configure your AWS credentials and region:
86
87```json
88{
89 "providers": [
90 {
91 "id": "bedrock",
92 "provider_type": "bedrock",
93 "extra_params": {
94 "region": "us-east-1"
95 }
96 }
97 ]
98}
99```
100
101Bedrock uses your AWS credentials from environment variables (`AWS_ACCESS_KEY_ID`, `AWS_SECRET_ACCESS_KEY`) or AWS credential profiles. The region can be specified in the configuration or via the `AWS_REGION` environment variable.
102
103### Google Vertex AI
104
105For Google Cloud Vertex AI with Gemini models, configure your project and location:
106
107```json
108{
109 "providers": [
110 {
111 "id": "vertexai",
112 "provider_type": "vertexai",
113 "extra_headers": {
114 "project": "your-gcp-project-id",
115 "location": "us-central1"
116 }
117 }
118 ]
119}
120```
121
122Vertex AI uses Google Cloud authentication. Ensure you have the `GOOGLE_APPLICATION_CREDENTIALS` environment variable set or are authenticated via `gcloud auth application-default login`.
123
124### OpenAI-Compatible APIs
125
126Crush supports all OpenAI-compatible APIs, including local models via Ollama:
127
128```json
129{
130 "providers": [
131 {
132 "id": "ollama",
133 "provider_type": "openai",
134 "base_url": "http://localhost:11434/v1",
135 "models": [
136 {
137 "id": "llama3.2:3b",
138 "name": "Llama 3.2 3B",
139 "context_window": 8192,
140 "default_max_tokens": 4096
141 }
142 ]
143 }
144 ]
145}
146```
147
148For other OpenAI-compatible providers, adjust the `base_url` and provide an `api_key` if required:
149
150```json
151{
152 "providers": [
153 {
154 "id": "custom-openai",
155 "provider_type": "openai",
156 "base_url": "https://api.example.com/v1",
157 "api_key": "your-api-key"
158 }
159 ]
160}
161```
162
163## Whatcha think?
164
165We’d love to hear your thoughts on this project. Feel free to drop us a note!
166
167- [Twitter](https://twitter.com/charmcli)
168- [The Fediverse](https://mastodon.social/@charmcli)
169- [Discord](https://charm.sh/chat)
170
171## License
172
173[MIT](https://github.com/charmbracelet/crush/raw/main/LICENSE)
174
175---
176
177Part of [Charm](https://charm.land).
178
179<a href="https://charm.sh/"><img alt="The Charm logo" width="400" src="https://stuff.charm.sh/charm-banner-next.jpg" /></a>
180
181<!--prettier-ignore-->
182Charm热爱开源 • Charm loves open source