# Goose

> Connect Goose CLI and Goose Desktop to HeyEly with a custom provider JSON file.

Goose supports custom inference gateways through a standalone JSON provider definition. Selecting the `openai` engine routes requests over Chat Completions to `https://heyely.si/v1`.

## Set up

1. Create a key in [Developers](https://heyely.si/keys) and export it as `HEYELY_API_KEY` in the shell launching Goose.
2. Save `heyely.json` inside Goose's custom providers directory: `~/.config/goose/custom_providers/` on macOS and Linux, or `%APPDATA%\Block\goose\config\custom_providers\` on Windows.

```json
{
  "name": "heyely",
  "engine": "openai",
  "display_name": "HeyEly",
  "api_key_env": "HEYELY_API_KEY",
  "base_url": "https://heyely.si/v1",
  "supports_streaming": true,
  "dynamic_models": true,
  "models": [
    {
      "name": "anthropic/claude-sonnet-5.5",
      "context_limit": 1000000,
      "max_tokens": 128000
    }
  ]
}
```

3. Point Goose at your new provider and start a session.

**macOS and Linux**

```bash
export GOOSE_PROVIDER=heyely
export GOOSE_MODEL=anthropic/claude-sonnet-5.5
goose session
```

**Windows**

```powershell
$env:GOOSE_PROVIDER = "heyely"
$env:GOOSE_MODEL = "anthropic/claude-sonnet-5.5"
goose session
```

Using Goose Desktop? Open **Settings**, **Models**, **Configure providers**, click **Add Custom Provider**, and enter the same values. Goose Desktop saves your key directly in your OS keychain.

Make sure `name` uses only lowercase letters, digits, `_`, or `-`. Never place your key inside `config.yaml`, since Goose ignores keys stored there.

## Verify

1. Run `goose info -v` to inspect active configuration paths and provider settings.
2. Send a one-shot verification prompt:

**macOS and Linux**

```bash
GOOSE_PROVIDER=heyely GOOSE_MODEL=anthropic/claude-sonnet-5.5 \
  goose run -t "Reply with exactly: gateway-ok"
```

**Windows**

```powershell
$env:GOOSE_PROVIDER = "heyely"
$env:GOOSE_MODEL = "anthropic/claude-sonnet-5.5"
goose run -t "Reply with exactly: gateway-ok"
```

3. Check [Credit and usage](https://heyely.si/usage) to confirm the call appears first under **Spend** with your selected model.

## Pick a model

* Enabling `dynamic_models` lets Goose pull available models from `GET /v1/models`, while your `models` array defines exact context and output token caps.
* Context and output limits default to `context_limit` and `max_tokens`, and can be overridden per session via `GOOSE_CONTEXT_LIMIT` and `GOOSE_MAX_TOKENS`.
* Prefer Anthropic Messages? Switch `engine` to `anthropic` and drop `/v1` so `base_url` is `https://heyely.si`.
* `GOOSE_PROVIDER` and `GOOSE_MODEL` override your saved defaults for a single shell. You can also pass `--provider heyely` directly on `goose session start --provider heyely` or `goose run --provider heyely`.

## Troubleshooting

| You see                                       | Cause                                                            | Fix                                                                                             |
| --------------------------------------------- | ---------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
| `missing required key HEYELY_API_KEY`         | Variable not exported in Goose's shell                           | Export it in your terminal, or save it via Goose Desktop                                        |
| `401 missing_api_key`, "No api key passed in" | Key was put inside `config.yaml`, which Goose skips              | Export `HEYELY_API_KEY` or configure it in Desktop                                              |
| Provider missing from list                    | Invalid filename, invalid `name`, or broken JSON                 | Validate `name` characters and JSON syntax                                                      |
| `404 model_not_found`                         | Model name does not match HeyEly's catalog                       | Copy the exact ID from the Models page                                                          |
| `402 insufficient_credit`                     | No credit available on the account                               | [Add credit](https://heyely.si/credit?step=add)                                                                  |
| `402 free_credit_not_eligible`                | Account holds only free credit and this request does not qualify | Pick an eligible open-weight text model, reduce `max_tokens`, or [add credit](https://heyely.si/credit?step=add) |
| `402 key_limit_reached`                       | This API key hit its dollar cap                                  | Raise the cap in Developers or swap keys                                                        |
