> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scitix.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Crush

> Learn how to connect Crush to ScitiX Model Inference so the terminal AI coding agent can use ScitiX model endpoints.

[Crush](https://github.com/charmbracelet/crush) is a terminal AI coding agent from Charm. It connects to any OpenAI-compatible service through an `openai-compat` provider type, so you can point it at the ScitiX Model Inference API. See the [Models](https://console.scitix.ai/model-inference/models) page for available models (e.g. `glm-5.2`).

## Configure

Crush reads config in this order: project-level `.crush.json` / `crush.json`, then the global `~/.config/crush/crush.json`. Create an API key on the ScitiX [API Keys](https://console.scitix.ai/model-inference/api_keys) page, then create `crush.json` in your project root:

```json theme={null}
{
  "$schema": "https://charm.land/crush.json",
  "models": {
    "large": { "provider": "scitix", "model": "glm-5.2" },
    "small": { "provider": "scitix", "model": "glm-5.2" }
  },
  "providers": {
    "scitix": {
      "name": "ScitiX",
      "type": "openai-compat",
      "base_url": "https://api.scitix.ai/model-api/v1",
      "api_key": "$SCITIX_API_KEY",
      "models": [
        {
          "id": "glm-5.2",
          "name": "glm-5.2",
          "context_window": 131072,
          "default_max_tokens": 8192,
          "cost_per_1m_in": 0,
          "cost_per_1m_out": 0,
          "cost_per_1m_in_cached": 0,
          "cost_per_1m_out_cached": 0,
          "can_reason": true,
          "supports_attachments": false
        }
      ]
    }
  }
}
```

The top-level `models.large`/`models.small` explicitly set ScitiX as the default. This matters if your shell has leftover variables like `OPENAI_API_KEY` or `ANTHROPIC_API_KEY` — without an explicit default, Crush may auto-discover and use those official providers instead.

Export the key referenced by `api_key`:

```bash theme={null}
export SCITIX_API_KEY="<Your API Key>"
```

| Field                                                   | Description                                                                                                                                                               |
| ------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| type                                                    | Must be `openai-compat` (not `openai`)                                                                                                                                    |
| base\_url                                               | ScitiX OpenAI-compatible endpoint: `https://api.scitix.ai/model-api/v1`                                                                                                   |
| api\_key                                                | Environment variable reference, or the key itself (avoid committing it). `$VAR`, `${VAR:-default}`, and `$(command)` expansion all work                                   |
| context\_window / default\_max\_tokens                  | Set to match the chosen model's real limits                                                                                                                               |
| cost\_per\_1m\_\* / can\_reason / supports\_attachments | Required by the config schema for custom-provider models — `0` costs are fine                                                                                             |
| models.large / models.small                             | Explicit default model — prevents other providers' env vars from taking over. Choose a model with native tool calling; otherwise Crush can't run file or command actions. |

To ignore auto-discovered official providers entirely, set `"options": { "disable_default_providers": true }` — then only fully-specified providers from your config are used.

To keep the model list in sync automatically, add `"discover_models": true` under the provider — Crush merges the models fetched from `https://api.scitix.ai/model-api/v1/models` with your hand-written entries (yours win); leaving `models` empty also triggers auto-discovery for `openai-compat` providers.

An `export` only lasts for the current shell — add the line to `~/.bashrc` / `~/.zshrc` to persist it.

## Verify

```bash theme={null}
cd your-project
crush
```

Crush starts directly on `glm-5.2` — the `models.large`/`models.small` entries pin it as the default, no picking needed. Send a task (e.g. "list the current directory and summarize it") to confirm tool calls and responses work. (`Ctrl+L` opens the model picker to switch.)

You can also run a single task non-interactively:

```bash theme={null}
crush run "introduce this project in one sentence"
```

Useful flags for `crush run`: `-m provider/model` (pick the model for this run, e.g. `-m scitix/glm-5.2`), `-q` (quiet, no spinner), and stdin piping (`curl -s https://example.com | crush run "Summarize this"`). Note that `run` does **not** accept `--yolo` (verified on 0.86.0 and 0.88.0) — pre-allow the tools it needs via `permissions.allowed_tools`:

```json theme={null}
{
  "permissions": {
    "allowed_tools": ["view", "ls", "grep", "glob", "edit", "write", "bash"]
  }
}
```

## FAQ

* **The model doesn't appear in the picker, or requests go to the official OpenAI API**: Confirm `crush.json` is in the launch directory (or the global path) and is valid JSON; `type` must be `openai-compat`; if other providers' API keys are set in your environment, add `models.large`/`models.small` to force the default.
* **I see 401 errors**: If `api_key` references an environment variable, confirm it's exported — or set the key directly, but never commit it.

Verified on Crush 0.88.0 (installed via `npm i -g @charmland/crush`; Crush is a Go static binary, so the npm `EBADENGINE` warnings on older Node are harmless).
