OpenCode Go sends some models through an unsupported API format
- Langage dominant
- Rust
- Étoiles
- 54.2k
- Forks
- 6.2k
- Merge moyen
- 3 j 4 h
- PR mergées (30 j)
- 240
Description
**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).
Guide de contribution
Ouvrir le guide de contribution
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Évaluation
- Domaine
- api, backend
- Type d'issue
- Bug
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Activité
- Active
- Clarté
- Clairement spécifiée
- Accessibilité débutants
- 45/100