OpenCode Go sends some models through an unsupported API format
- Lenguaje dominante
- Rust
- Estrellas
- 54.2k
- Forks
- 6.2k
- Merge medio
- 3 d 4 h
- PR fusionados (30 d)
- 240
Descripción
**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).
Guía de contribución
Línea de trabajo
Examina la implementación del proveedor `opencode_go`, probablemente en un módulo de proveedores. El error consiste en que utiliza un único endpoint para todos los modelos. Primero, comprende cómo se descubren los modelos desde `/zen/go/v1/models` y cómo se enrutan las solicitudes. Revisa la configuración del proveedor y la lógica de construcción de solicitudes. La corrección implica asignar los modelos a sus formatos de API correctos (por ejemplo, `/responses`, `/messages`, `/chat/completions`) según el ID del modelo. Para probarlo, es necesario configurar el proveedor y ejecutar el comando proporcionado para verificar que el error se haya resuelto.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Área
- api, backend
- Tipo de issue
- Error
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Activo
- Claridad
- Bien especificado
- Aptitud para principiantes
- 45/100