Skip to content

feat(provider): add OpenCode Free -- keyless public-tier provider#128

Merged
lidge-jun merged 11 commits into
lidge-jun:mainfrom
Wibias:codex/opencode-free-provider
Jul 15, 2026
Merged

feat(provider): add OpenCode Free -- keyless public-tier provider#128
lidge-jun merged 11 commits into
lidge-jun:mainfrom
Wibias:codex/opencode-free-provider

Conversation

@Wibias

@Wibias Wibias commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

What

Adds OpenCode Free (opencode-free) as a new provider, giving users access to opencode.ai public bearer-token tier without any API key.

How it works

opencode.ai exposes a public desktop tier authenticated with Authorization: Bearer public and x-opencode-client: desktop -- the same credentials their own desktop app sends.

Infrastructure: staticHeaders on registry entries

Adds a staticHeaders field to ProviderRegistryEntry propagated as provider.headers. Also fixes merge order in createOpenAIChatAdapter so static headers apply first and a user-supplied apiKey can override them.

GUI: Free badge + optional key field

  • Exposes keyOptional through DerivedProviderPreset and entryToPreset so /api/provider-presets surfaces it to the GUI picker
  • AddProviderModal: green Free badge in picker list, no API key field by default (replaced with a green Free tier banner), collapsible Use your own key instead section for power users

Tests

9 new unit tests in tests/opencode-free-provider.test.ts: registry shape, staticHeaders propagation, providerConfigSeed, key-login map presence, featured list, no-key request headers, user-key override, note content, and deriveProviderPresets keyOptional exposure. All 9 tests pass.

Risk

Low. The staticHeaders mechanism is additive; no existing provider uses it. The public tier may be rate-limited or revoked by opencode.ai at any time.

@Wibias Wibias marked this pull request as ready for review July 15, 2026 00:25
@lidge-jun lidge-jun merged commit e75ebc0 into lidge-jun:main Jul 15, 2026
0 of 6 checks passed
@Wibias Wibias mentioned this pull request Jul 15, 2026
2 tasks
@lidge-jun

Copy link
Copy Markdown
Owner

Merged into dev and released in v2.7.19 — thanks! The Zen endpoints checked out against OpenCode's official docs/source. Stacked fixes (3932acb): restored the pre-existing header precedence in openai-chat (registry staticHeaders still flow via derive), fixed the unused hints lint error that was failing CI on the branch, bounded the non-JSON error-body log inspection to an 8 KiB prefix (full response still reaches the client), and added a free-tier data-use warning to the provider note.

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