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

オープン
#17,148 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
55/100
issue の種類
機能追加
明瞭さ
おおむね明確
活発さ
活発
技術スタック
csharp
領域
api

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

説明

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/
主要言語
C#
スター
15.1k
フォーク
1.4k
平均マージ
1時間 58分
マージ済み PR(30日)
564

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

SubtitleEdit/subtitleedit のほかの issue

SubtitleEdit/subtitleedit の issue をすべて見る

似ている issue

C# の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。