Skip to content

Commit 85ca6b2

Browse files
nicnori-agent
andcommitted
fix: opencode config, kimi thinking, key model access
- OpenCode: use built-in openai provider + OPENAI_BASE_URL env var (workaround for anomalyco/opencode#5674 custom provider options bug) - OpenCode: add top-level "model" key so it doesn't default to GPT-5.2 - Kimi: disable thinking mode and remove capabilities (avoids hangs) - Kimi: keep openai_legacy provider type (only valid option) 🤖 Generated with [Nori](https://usenori.ai) Co-Authored-By: Nori <[email protected]>
1 parent 63eb0fe commit 85ca6b2

1 file changed

Lines changed: 18 additions & 20 deletions

File tree

‎src/minimax_cli/commands/launch.py‎

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -133,22 +133,23 @@ def _write_codex_config(key: str):
133133
)
134134

135135

136-
def _write_opencode_config(key: str, cwd: str | None = None):
137-
"""Write OpenCode project config (opencode.json) in cwd."""
136+
def _write_opencode_config(cwd: str | None = None):
137+
"""Write OpenCode project config (opencode.json) in cwd.
138+
139+
Uses the built-in openai provider with OPENAI_BASE_URL env var
140+
to work around custom provider options bug (sst/opencode#5674).
141+
API key is passed via OPENAI_API_KEY env var.
142+
"""
138143
target = Path(cwd or os.getcwd()) / "opencode.json"
139144
target.write_text(json.dumps({
140145
"$schema": "https://opencode.ai/config.json",
146+
"model": f"openai/{DEFAULT_MODEL}",
141147
"provider": {
142-
"minimax": {
143-
"npm": "@ai-sdk/openai-compatible",
144-
"name": "MiniMax",
145-
"options": {
146-
"baseURL": PUBLIC_API_V1,
147-
"apiKey": "{env:OPENAI_API_KEY}",
148-
},
148+
"openai": {
149149
"models": {
150150
DEFAULT_MODEL: {
151151
"name": "MiniMax-M2.5",
152+
"limit": {"context": 128000, "output": 16384},
152153
}
153154
},
154155
}
@@ -172,16 +173,14 @@ def _write_kimi_config(key: str):
172173
config_file = config_dir / "config.toml"
173174
config_dir.mkdir(parents=True, exist_ok=True)
174175

175-
# Only write if no config exists, or patch existing
176176
config = (
177177
f'default_model = "{DEFAULT_MODEL}"\n'
178-
f'default_thinking = true\n'
178+
f'default_thinking = false\n'
179179
f'\n'
180180
f'[models."{DEFAULT_MODEL}"]\n'
181181
f'provider = "minimax"\n'
182182
f'model = "{DEFAULT_MODEL}"\n'
183183
f'max_context_size = 131072\n'
184-
f'capabilities = ["thinking"]\n'
185184
f'\n'
186185
f'[providers."minimax"]\n'
187186
f'type = "openai_legacy"\n'
@@ -382,22 +381,21 @@ def opencode(no_docker: bool, extra_args: tuple):
382381

383382
docker_env = {
384383
"OPENAI_API_KEY": key,
384+
"OPENAI_BASE_URL": PUBLIC_API_V1,
385385
}
386-
model_arg = f"minimax/{DEFAULT_MODEL}"
387386

388387
if _has_docker() and not no_docker:
389-
# Write project-level opencode.json in cwd
390-
_write_opencode_config(key)
391-
_docker_run(DOCKER_IMAGES["opencode"], docker_env,
392-
("--model", model_arg) + extra_args)
388+
# Write project-level opencode.json in cwd — model set there
389+
_write_opencode_config()
390+
_docker_run(DOCKER_IMAGES["opencode"], docker_env, extra_args)
393391
else:
394-
binary = _require_binary("opencode", "go install github.com/opencode-ai/opencode@latest")
395-
_write_opencode_config(key)
392+
binary = _require_binary("opencode", "curl -fsSL https://opencode.ai/install | bash")
393+
_write_opencode_config()
396394

397395
env = os.environ.copy()
398396
env.update(docker_env)
399397

400-
args = [binary, "--model", model_arg] + list(extra_args)
398+
args = [binary] + list(extra_args)
401399
console.print()
402400
os.execvpe(binary, args, env)
403401

0 commit comments

Comments
 (0)