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

Aperta
#17,148 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
55/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
csharp
Ambito
api

Direzione di ricerca

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.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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/
Lingua principale
C#
Stelle
15.1k
Fork
1.4k
Merge medio
1h 58m
PR unite (30g)
564

Preparare l'ambiente

Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di SubtitleEdit/subtitleedit

Tutte le issue di SubtitleEdit/subtitleedit

Issue simili

Altre issue su C#

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.