feat(opencode-go): route by request format via transports + per-model guard
opencode-go hard-coded targetFormat: claude per model, so every client format was force-routed to /messages (Codex/OpenAI clients paid a lossy Responses->OpenAI->Claude double translation). Declare the existing upstream multi-endpoint transports [openai, claude, openai-responses] and guard per model via registry supportedFormats: kimi/glm/mimo only support /chat/completions, minimax/qwen add /messages, deepseek adds /responses. Undeclared models keep the upstream default. Drop the bespoke OpenCodeGoExecutor (its shared _lastModel cache could cross auth headers between concurrent requests); DefaultExecutor already consumes runtimeTransport and injects reasoning content.
This commit is contained in:
@@ -38,3 +38,11 @@ export function modelStrip(model) {
|
||||
export function modelTargetFormat(model) {
|
||||
return model?.targetFormat || MODEL_DEFAULTS.targetFormat;
|
||||
}
|
||||
|
||||
// Per-model declared upstream formats (e.g. ["openai", "claude"]). Guards the
|
||||
// sourceFormat-matched transport for multi-endpoint providers whose models differ
|
||||
// in endpoint support (opencode-go: kimi/glm only do /chat/completions, minimax/qwen
|
||||
// also do /messages, deepseek also does /responses).
|
||||
export function modelSupportedFormats(model) {
|
||||
return model?.supportedFormats || null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user