aaif-goose / aaif-goose/goose

OpenCode Go sends some models through an unsupported API format

オープン
#11,980 コメント 2 件 リアクション 0 件 担当者 2 名 @michaelneale が担当を希望しています GitHub で見る
主要言語
Rust
スター
54.2k
フォーク
6.2k
平均マージ
3日 4時間
マージ済み PR(30日)
240

説明

**Describe the bug**

The `opencode_go` provider discovers models from `/zen/go/v1/models` but sends every request through the OpenAI Chat Completions endpoint (`/zen/go/v1/chat/completions`). OpenCode Go serves models that require other API formats; for example, `grok-4.6` requires the OpenAI Responses endpoint (`/zen/go/v1/responses`).

As a result, Goose cannot use such models. OpenCode responds with HTTP 401 and Goose reports this as an authentication failure, although the API key is not the problem:

```text
error: Ran into this error: Authentication error: Authentication failed for https://opencode.ai/zen/go/v1/chat/completions. Status: 401 Unauthorized. Response: Model grok-4.6 is not supported for format oa-compat.

Please retry if you think this is a transient or recoverable error.
```

---

**To Reproduce**
Steps to reproduce the behavior:
1. Configure the `opencode_go` provider.
2. Run:
```bash
./target/debug/goose run \
--provider opencode_go \
--model grok-4.6 \
--text "Reply exactly: OK" \
--no-profile \
--max-turns 1 \
--quiet
```
3. Observe that Goose sends the request to `/zen/go/v1/chat/completions` and reports the 401 error above.

---

**Expected behavior**
Goose should send requests using the API format supported by the selected OpenCode Go model and report an unsupported model/API-format combination accurately rather than as an authentication failure.

---

**Screenshots**
Not applicable.

---

**Please provide the following information**
- **OS & Arch:** macOS 26.6.2
- **Interface:** CLI
- **Version:** [not provided]
- **Extensions enabled:** [not provided]
- **Provider & Model:** OpenCode Go – `grok-4.6`

---

**Additional context**

`opencode_go` is currently configured as a declarative provider:

```json
{
"engine": "openai",
"base_url": "https://opencode.ai/zen/go/v1",
"dynamic_models": true
}
```

Goose gets the complete model list from `/zen/go/v1/models`, but this endpoint does not include the API format required for each model. For example:

```json
{
"id": "grok-4.6",
"object": "model",
"created": 1789022093,
"owned_by": "opencode"
}
```

The current OpenCode Go catalog includes at least these endpoint groups:

- `grok-4.6`, `gpt-5.6-luna`, `muse-spark-*` → `/responses`
- `minimax-*`, `qwen*` → `/messages`
- `glm-*`, `kimi-*`, `deepseek-*`, `mimo-*`, `hy*` → `/chat/completions`

The declarative provider configuration currently selects one engine/API format for all dynamically discovered models, so it cannot route requests per model.

OpenCode Go documentation: https://opencode.ai/docs/go/#endpoints

Do not begin implementation until the issue reaches **Ready** on the [Goose Issues board](https://github.com/orgs/aaif-goose/projects/1).

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Look at the `opencode_go` provider implementation, likely in a providers module. The bug is that it uses a single endpoint for all models. First, understand how models are discovered from `/zen/go/v1/models` and how requests are routed. Check the provider's configuration and request-building logic. The fix involves mapping models to their correct API formats (e.g., `/responses`, `/messages`, `/chat/completions`) based on the model ID. Testing requires configuring the provider and running the provided command to verify the error is resolved.

索引モデルが issue の本文から書いたものです。

評価

領域
api, backend
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。