aaif-goose / aaif-goose/goose

OpenCode Go sends some models through an unsupported API format

Đang mở
#11,980 1 bình luận 0 reaction 1 người được giao Được @michaelneale nhận Xem trên GitHub
Ngôn ngữ chính
Rust
Star
54.2k
Fork
6.2k
Merge trung bình
3 ngày 2 giờ
Pull request đã merge (30 ngày)
262

Mô tả

**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).

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.