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

# Goose

> Connect Goose Desktop or Goose CLI to Hostlinku via custom_providers/hostlinku.json or the Custom Provider menu.

[Goose](https://github.com/aaif-goose/goose) supports declarative custom provider JSON files that appear directly in **Connect to a Provider** in Goose Desktop and in `goose configure` on the CLI. With `dynamic_models: true`, Goose fetches the active model list directly from `GET https://api.hostlinku.com/v1/models` scoped to your API key's Service Mode.

> [!NOTE]
>
> **One API key = one Service Mode**
>
> Create an API key in the [Hostlinku Console](https://console.hostlinku.com) for the [Service Mode](https://docs.hostlinku.com/en/service-modes.md) you need (**Economy**, **Performance**, or **Dedicated**). Never place real API keys inside `hostlinku.json` so the config file stays safe to share across teams or repositories.

## Option 1: `custom_providers/hostlinku.json` (Recommended)

**1. Create `hostlinku.json`**

Create the JSON file inside Goose's `custom_providers` directory for your OS (create the folder first if it does not exist):

* **macOS / Linux:** `~/.config/goose/custom_providers/hostlinku.json`
* **Windows:** `%APPDATA%\Block\goose\config\custom_providers\hostlinku.json`

Save the following configuration into `hostlinku.json`:

```json theme={null}
{
  "name": "hostlinku",
  "engine": "openai",
  "display_name": "Hostlinku",
  "description": "Hostlinku unified AI gateway (OpenAI-compatible /v1 with dynamic model discovery)",
  "api_key_env": "HOSTLINKU_API_KEY",
  "base_url": "https://api.hostlinku.com/v1",
  "dynamic_models": true,
  "models": [
    { "name": "claude-sonnet-5-5", "context_limit": 1000000 },
    { "name": "gpt-6-2-sol", "context_limit": 1050000 },
    { "name": "gemini-4-hydrogen", "context_limit": 1048576 },
    { "name": "deepseek-v4-1-flash-hyper", "context_limit": 1048576 },
    { "name": "glm-5-3-flash", "context_limit": 1048576 }
  ],
  "supports_streaming": true,
  "requires_auth": true
}
```

The `models` array acts as a fallback list if discovery is temporarily unreachable. Once your API key is configured, Goose queries `GET https://api.hostlinku.com/v1/models` automatically and displays the exact models enabled for your key's Service Mode.

**2. Configure your API key**

Choose either credential storage option:

* **Goose Desktop (system keychain — recommended):** restart Goose Desktop, open **Settings → Models → Configure providers**, select **Hostlinku**, paste your Hostlinku API key (`sk-...`), and click **Submit**.
* **Environment variable (CLI / terminal):**

```bash theme={null}
# macOS / Linux
export HOSTLINKU_API_KEY="sk-your-api-key"
goose session start --provider hostlinku
```

```powershell theme={null}
# Windows PowerShell
$env:HOSTLINKU_API_KEY = "sk-your-api-key"
goose session start --provider hostlinku
```

**3. Select a model and start a session**

In Goose Desktop, open **Settings → Models → Switch models** (or click the active model name at the bottom of the window), choose **Hostlinku**, and pick any model discovered for your API key. On the CLI, run `goose configure` → **Configure Providers** → **Hostlinku**.

## Option 2: Goose Desktop GUI or `goose configure`

If you prefer not to create the JSON file manually:

* **Goose Desktop:** open **Settings → Models → Configure providers → Add Custom Provider**, then enter:
  * **Provider Type:** `OpenAI Compatible`
  * **Display Name:** `Hostlinku`
  * **API URL:** `https://api.hostlinku.com/v1`
  * **API Key:** your Hostlinku API key (`sk-...`)
  * **Available Models:** comma-separated Hostlinku slugs available to your key's mode, e.g. `claude-sonnet-5-5, gpt-6-2-sol, deepseek-v4-1-flash-hyper`
  * **Streaming Support:** enabled, then click **Create Provider**
* **Goose CLI:** run `goose configure` → **Custom Providers** → **Add A Custom Provider** and enter the same values.

## Optional Anthropic Messages Dialect

To use the [Anthropic Messages](https://docs.hostlinku.com/en/anthropic-messages.md) dialect directly (for example with Claude models), create a separate file `custom_providers/hostlinku_anthropic.json` with `"engine": "anthropic"` and `"base_url": "https://api.hostlinku.com"`.

## Troubleshooting

* **Hostlinku does not appear in the provider list** — check that the file is saved at `~/.config/goose/custom_providers/hostlinku.json` (macOS/Linux) or `%APPDATA%\Block\goose\config\custom_providers\hostlinku.json` (Windows) with valid JSON, then restart Goose.
* **`401 Unauthorized`** — verify `HOSTLINKU_API_KEY` is saved in Goose Desktop's keychain or exported in the shell running `goose`.
* **`404 model_not_found` or `MODEL_NOT_IN_SERVICE_MODE`** — confirm the model slug is enabled for your API key's Service Mode in the [model catalog](https://docs.hostlinku.com/en/models.md) or via `GET /v1/models`.

See the official [Goose Custom Provider documentation](https://github.com/aaif-goose/goose/blob/main/documentation/docs/getting-started/providers.md#configure-custom-provider) for full schema details.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.