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

# Goose

> 了解如何在 Goose CLI 或桌面端配置 OpenAI provider 和自定义 host，接入 siflow endpoint，让 AI 编程智能体使用算秩模型。

[Goose](https://github.com/block/goose) 是 Block 开源的 AI 编程智能体，提供 CLI 和桌面端形态。它的 OpenAI provider 也支持 OpenAI-compatible endpoints，因此设置自定义 host 后即可接入 siflow endpoint。

本文默认模型为 `glm-5.2`；完整模型列表和价格请查看 [模型广场](https://console.siflow.cn/model-inference/models)。

## 配置

在 [API 密钥](https://console.siflow.cn/model-inference/api_keys) 页面创建 API Key。使用自定义 host 配置 OpenAI provider：运行 `goose configure`（选择 **OpenAI**，然后设置 host/base path），或直接在 `~/.config/goose/config.yaml` 中设置：

```yaml theme={null}
GOOSE_PROVIDER: openai
GOOSE_MODEL: glm-5.2
OPENAI_HOST: https://api.siflow.cn
OPENAI_BASE_PATH: model-api/v1/chat/completions
```

提供 API Key。通过 `goose configure` 配置时，key 会存储在系统 keyring；也可以通过环境变量提供：

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

| 字段                 | 说明                                                                  |
| ------------------ | ------------------------------------------------------------------- |
| `GOOSE_PROVIDER`   | `openai`，表示使用 OpenAI-compatible provider                            |
| `GOOSE_MODEL`      | 模型 ID，例如 `glm-5.2`。Goose 依赖 tool calling，因此请选择原生支持 tool calling 的模型 |
| `OPENAI_HOST`      | 仅填写 host：`https://api.siflow.cn`                                    |
| `OPENAI_BASE_PATH` | 完整 chat-completions path：`model-api/v1/chat/completions`，不是只填 `/v1` |
| `OPENAI_API_KEY`   | 创建的 API Key                                                         |

## 验证

运行一次单次请求。如果返回正常回复，即表示连接成功：

```bash theme={null}
goose run --no-session -t "In one short sentence, which model are you?"
```

header 会显示 `openai glm-5.2`，并且 Goose 会返回正常答案，说明请求已经到达 siflow endpoint。

无论底层模型是什么，Goose 都可能将自己识别为 "goose"。这是 Goose 自身的 agent 身份设定，不是路由问题；session header 会显示实际使用的模型。
