- Update test assertions for bare model IDs - Add deduplication guard for models with same bare ID - Add validation for empty model IDs after prefix stripping - Add test for API key forwarded as env var to spawn - Add test for deduplication and empty model ID guard - Extract shared handleOpencodeGoApiKeySaved helper - Add changeset for the published package
1.2 KiB
@runfusion/fusion
| @runfusion/fusion |
|---|
| patch |
Fix opencode-go model sync: pass API key to CLI and strip provider prefix from model IDs
Two bugs when using OpenCode Go as a provider:
-
Model discovery only returned free models — the saved Go API key was never passed as
OPENCODE_API_KEYto the spawnedopencode models opencode --refreshprocess. The CLI's internal plugin checks this env var and, when absent, disables all paid models (those withcost.input > 0). Only 20 free models appeared instead of all 67. -
API requests failed with 401 —
normalizeOpencodeGoModelwas registering models with prefixed IDs likeopencode-go/deepseek-v4-flash. The Pi SDK sendsmodel.idverbatim in API requests; the OpenCode API expects bare model names (e.g.deepseek-v4-flash). The prefix is now stripped during normalization.
Also deduplicates models when the CLI emits both opencode/foo and opencode-go/foo for the same model, guards against empty model IDs, and refactors the duplicated onApiKeySaved handler into a shared handleOpencodeGoApiKeySaved helper.
After this change, users must re-select their opencode-go model in Settings because model IDs have changed from prefixed to bare names.