Auto-translate: add support for OpenCode Go (OpenAI-compatible, requires custom "x-opencode-session" header)

Abierto
#17,148 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
55/100
Tipo de issue
Nueva funcionalidad
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
csharp
Área
api

Línea de trabajo

Start by locating the auto-translate engine implementations — the existing ChatGPT / OpenAI-compatible engine that already parses OpenAI-shaped responses — and the engine picker plus the settings model where the API key and endpoint URL are persisted. Reproduce the HTTP 400 by pointing that engine at https://opencode.ai/inference/go/openai/v1/chat/completions with an oc_sk_ key, then confirm the /v1/models list loads without auth. The cheapest path is the issue's option 2: a free-text "extra headers" field on the generic engine, appended to the outgoing request, with a generated x-opencode-session value saved in settings. Done looks like: any engine can send configured headers, the session id survives a restart, and a translation round-trip against the OpenCode Go endpoint succeeds.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Description

OpenCode Go is a low-cost subscription from OpenCode giving access to a curated set of strong open models (GLM-5.3(-Flash), DeepSeek V4, Kimi K3, MiniMax, Qwen, etc.) via standard OpenAI-compatible endpoints. It would work as an auto-translate provider, but requests fail because of one required custom HTTP header that Subtitle Edit cannot send.

Endpoint
  • Chat Completions: https://opencode.ai/inference/go/openai/v1/chat/completions
  • Model list (no auth): https://opencode.ai/inference/go/v1/models
  • Auth: Authorization: Bearer <key> (keys look like oc_sk_..., from the Console)
The blocker

OpenCode Go requires a stable session id header on every request:

x-opencode-session: <stable id, e.g. a persisted GUID>

Without it the gateway answers HTTP 400:

{
  "type": "error",
  "error": {
    "type": "MissingSessionID",
    "message": "Request is missing x-opencode-session and cannot be routed efficiently."
  }
}
Subtitle Edit's auto-translate engines cannot send custom HTTP headers, so the request fails even with URL, key and model configured correctly. With the header present, the endpoint returns a normal OpenAI-shaped response that SE's ChatGPT / OpenAI-compatible engines already parse fine.
Feature request
Any of these would enable it (in order of preference):
1. A dedicated "OpenCode Go" engine — fixed URL, API key field, model dropdown from /v1/models, and automatic x-opencode-session with a generated id persisted in settings.
2. Optional extra HTTP headers on the generic OpenAI-compatible / ChatGPT engine (one Name: value per line). Useful for other gateways requiring tenant/project headers too.
3. Minimal: send a generated x-opencode-session automatically from the OpenAI-compatible engine when the configured URL points at opencode.ai.
Docs: https://opencode.ai/docs/console/go/ · https://opencode.ai/docs/console/harnesses/
Lenguaje dominante
C#
Estrellas
15.1k
Forks
1.4k
Merge medio
1 h 58 min
PR fusionados (30 d)
564

Preparar el entorno

Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de SubtitleEdit/subtitleedit

Todos los issues de SubtitleEdit/subtitleedit

Issues similares

Más issues de C#

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.