# Zed

> Connect Zed's Agent panel and edit predictions to HeyEly as an OpenAI-compatible provider.

Zed configures custom OpenAI-compatible gateways under `language_models.openai_compatible` in `settings.json`. Because Zed defaults to Chat Completions, point `api_url` at `https://heyely.si/v1`.

## Set up

1. Generate an API key in [Developers](https://heyely.si/keys).
2. Open Zed's settings via the command palette action `zed: open settings file` (`~/.config/zed/settings.json` on macOS/Linux, or `%APPDATA%\Zed\settings.json` on Windows).
3. Add the HeyEly provider block:

```json
{
  "language_models": {
    "openai_compatible": {
      "HeyEly": {
        "api_url": "https://heyely.si/v1",
        "available_models": [
          {
            "name": "anthropic/claude-sonnet-5.5",
            "display_name": "Claude Sonnet 5.5",
            "max_tokens": 1000000,
            "max_output_tokens": 128000,
            "capabilities": {
              "tools": true,
              "images": true,
              "parallel_tool_calls": false,
              "prompt_cache_key": false
            }
          }
        ]
      }
    }
  }
}
```

4. Open the Agent panel settings, select **HeyEly**, and paste your key. Zed stores it securely in your OS keychain rather than in `settings.json`.

Here, `max_tokens` defines the context budget Zed targets and `max_output_tokens` sets the reply ceiling. Match the figures on [Models](https://heyely.si/docs/models) or dial them down if you want Zed to summarize sooner and spend less.

Prefer an environment variable over the keychain? Export `HEYELY_API_KEY` (the uppercase provider name plus `_API_KEY`) and launch Zed from that terminal with `zed .`. Launching Zed from the Dock or Start menu skips terminal exports.

## Verify

Open Zed's Agent panel, pick your model under **HeyEly**, and send a short prompt. Once the reply streams back, check [Credit and usage](https://heyely.si/usage) to confirm the request shows at the top of **Spend** under your selected model.

## Pick a model

* Add an entry inside `available_models` for every model you want, setting `name` to the exact catalog ID.
* `tools` defaults to enabled; flip it to `false` for models that do not advertise `tools` support.
* To route a specific model to `POST /v1/responses`, add `"chat_completions": false` inside its `capabilities` object.
* Zed's OpenAI-compatible edit predictions call `POST /v1/completions`, which HeyEly serves. Configure `edit_predictions` with `api_url` pointed at `https://heyely.si/v1/completions`. This endpoint requires `prompt` and a compatible model supporting Zed's prompt structure. See [Zed's edit prediction settings](https://zed.dev/docs/ai/edit-prediction#openai-compatible-servers).

## Troubleshooting

| You see                          | Cause                                 | Fix                                                      |
| -------------------------------- | ------------------------------------- | -------------------------------------------------------- |
| Model missing from picker        | Invalid JSON syntax or typo in `name` | Fix the JSON and copy the exact catalog ID from Models   |
| Zed repeatedly prompts for a key | System keychain write failed          | Export `HEYELY_API_KEY` and start Zed from that terminal |
| `401 invalid_api_key`            | Stale key saved in provider settings  | Clear the saved key and re-enter your current key        |
| `404 model_not_found`            | `name` differs from HeyEly's catalog  | Copy the exact ID from the Models page                   |
| Tool execution fails             | Selected model lacks tool support     | Set `"tools": false` in its `capabilities`               |
| `402 insufficient_credit`        | No credit available on the account    | [Add credit](https://heyely.si/credit?step=add)                           |
