Skip to content

Add OpenCode Go setup on-ramp#25

Merged
OnlyTerp merged 3 commits into
sybil-solutions:mainfrom
eafire15:codex/opencode-go-easy
Jun 8, 2026
Merged

Add OpenCode Go setup on-ramp#25
OnlyTerp merged 3 commits into
sybil-solutions:mainfrom
eafire15:codex/opencode-go-easy

Conversation

@eafire15

@eafire15 eafire15 commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This adds a small OpenCode Go setup path for codex-shim users:

  • support api_key_env / apiKeyEnv in model settings
  • add codex-shim opencode-go refresh
  • discover the live OpenCode Go model catalog
  • probe each model through /chat/completions and /messages
  • generate prefixed ocgo-* entries with the right provider type
  • document the setup in the custom config section

Why

OpenCode Go subscriptions expose useful models through https://opencode.ai/zen/go/v1, but users currently need to hand-write the codex-shim model config. OpenCode Go also adds and changes models over time, so a static bundled list goes stale.

This gives users a one-key refresh flow:

export OPENCODE_GO_API_KEY="..."
codex-shim opencode-go refresh
codex-shim generate
codex-shim start

The refresh probes both supported surfaces and writes models as either generic-chat-completion-api or anthropic, depending on what works for that model.

Changes

  • Adds api_key_env / apiKeyEnv support, with literal api_key fallback.
  • Adds codex-shim opencode-go refresh.
  • Adds OpenCode Go discovery/probing/generation helpers.
  • Generates ocgo-* slugs to avoid collisions with other providers.
  • Adds README notes for OpenCode Go setup.
  • Adds settings/catalog tests for env-key resolution and refresh behavior.

Model-assisted revision notes

  • GPT-5.5 / Codex: drafted the OpenCode Go on-ramp, including api_key_env, the refresh command, live catalog probing, ocgo-* generation, docs, tests, and live smoke validation.
  • Qwen 3.7 Max: reviewed refresh replacement behavior and helped tighten generated-row detection so manual ocgo-* rows are not removed by URL/slug heuristics alone.
  • GLM 5.1: reviewed generated labels and helped replace fragile model-name prefix handling with a generic letter-plus-digits display-name rule.
  • MiniMax M3: caught the legacy-config migration issue and added preservation of the user's existing settings key (models, customModels, launchModels, or launch_models).

Testing

python -m pytest

Result:

95 passed

Local smoke:

  • Ran codex-shim opencode-go refresh against the live OpenCode Go catalog.
  • It generated 17 current ocgo-* model entries from one OPENCODE_GO_API_KEY.
  • Started this branch on 127.0.0.1:8785 with the refreshed settings.
  • Sent a live /v1/responses request through refreshed ocgo-qwen3-7-max; it returned PR1_REFRESH_QWEN_OK.

eafire15 added 2 commits June 2, 2026 21:16
…ed_by to test

- Replace fragile v/k/m prefix checks in display_name_from_model_id
  with generic isalpha+isdigit pattern
- Remove slug+URL heuristic from _is_opencode_go_row (was matching
  stale rows by URL alone); only check generated_by field
- Add missing generated_by field to test fixture dict
@eafire15 eafire15 changed the title feat: add OpenCode Go model refresh Add OpenCode Go setup on-ramp Jun 2, 2026
write_opencode_go_models used to pop customModels/launchModels/launch_models
and force-write to 'models', silently migrating the user's schema. A user
with only legacy customModels would see their config key replaced and
their existing rows re-mapped without warning.

Pick the first key the user already has; default to 'models' for new
files. The preserved-row logic is unchanged.
@eafire15 eafire15 marked this pull request as ready for review June 2, 2026 14:35
@OnlyTerp OnlyTerp merged commit 08bbfe5 into sybil-solutions:main Jun 8, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants