---
title: Crush 使用教程
sidebarTitle: Crush
description: 安装 Crush 终端编程工具，创建无限星河AI配置文件并验证模型连接。
---

Crush 是一个终端 AI 编程工具，可以读取和修改项目文件。它的界面比较简洁，但仍需要手动创建配置文件。

## 安装 Crush

Windows：

```powershell
winget install charmbracelet.crush
```

其他系统可查看 [Crush 下载说明](https://github.com/charmbracelet/crush)。

## 配置 API Key

Windows PowerShell：

```powershell
$env:INFISTAR_API_KEY = "你的_API_Key"
```

macOS 或 Linux：

```bash
export INFISTAR_API_KEY="你的_API_Key"
```

## 配置模型

在准备使用 Crush 的项目目录中创建 `.crush.json`：

```json
{
  "$schema": "https://charm.land/crush.json",
  "providers": {
    "infistar": {
      "type": "openai-compat",
      "base_url": "https://infistar.cc/v1",
      "api_key": "$INFISTAR_API_KEY",
      "models": [
        {
          "id": "模型广场中的原始模型ID",
          "name": "模型广场中的原始模型ID"
        }
      ]
    }
  }
}
```

## 开始使用

在这个项目目录运行 `crush`，按 `Ctrl+L`，选择 `infistar` 下的模型。

![Crush 终端界面](/images/tutorials/crush/crush-tui.jpg)

第一次先让它“只回复配置成功，不要修改文件”。

## 遇到问题

- **找不到模型**：确认 `.crush.json` 位于当前项目目录，并重新启动 Crush。
- **提示 401**：在当前终端重新设置 `INFISTAR_API_KEY`。
- **提示 404**：`base_url` 应为 `https://infistar.cc/v1`。
