fix(external-llm): correct opencode CLI syntax and gemini routing

- OpenCode: use `opencode run -m MODEL "prompt"` syntax
- OpenCode: set correct binary path (/home/linuxbrew/.linuxbrew/bin/opencode)
- Gemini: route long-context to gemini-2.5-pro (gemini-3 not available yet)

Tested working:
- opencode/big-pickle
- github-copilot/claude-sonnet-4.5
- zai-coding-plan/glm-4.7
- gemini/gemini-2.5-pro
- gemini/gemini-2.5-flash

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
OpenCode Test
2026-01-08 13:46:38 -08:00
parent d2daf74fca
commit fb4cf1b035
2 changed files with 7 additions and 3 deletions

View File

@@ -4,6 +4,9 @@
import subprocess
from typing import List
# OpenCode binary path (linuxbrew installation)
OPENCODE_BIN = "/home/linuxbrew/.linuxbrew/bin/opencode"
def invoke(cli_args: List[str], prompt: str, timeout: int = 300) -> str:
"""
@@ -22,9 +25,10 @@ def invoke(cli_args: List[str], prompt: str, timeout: int = 300) -> str:
TimeoutError: If request exceeds timeout
Example invocation:
opencode -m github-copilot/gpt-5.2 -p "Hello world"
opencode run -m github-copilot/gpt-5.2 "Hello world"
"""
cmd = ["opencode"] + cli_args + ["-p", prompt]
# Build command: opencode run -m MODEL "prompt"
cmd = [OPENCODE_BIN, "run"] + cli_args + [prompt]
try:
result = subprocess.run(