Repository navigation
Add OpenCode Go as a model provider - #24
Closed
kelimator1 wants to merge 1 commit into
Closed
kelimator1 wants to merge 1 commit into
kelimator1 wants to merge 1 commit into
Conversation
OpenCode Go's gateway requires x-opencode-session on every request and serves each model over its own wire; the generic OpenAI-compatible provider sends neither. Register a first-class provider under opencode-go, select each model's transport from kwwk's catalog, and stamp the conversation's session id. The key-only sign-in, display name, mark and translations follow the existing provider table.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Refs #23. OpenCode Go cannot be reached through the existing OpenAI-Compatible API provider: every Go request needs an
x-opencode-sessionheader, and kwwk v0.1.100 neither sends it nor registersopencode-goas a provider.Probed against the live gateway on 2026-10-30:
POST https://opencode.ai/inference/go/v1/chat/completionswithoutx-opencode-session→400 MissingSessionID, before auth./go/openai/v1/responses,/go/anthropic/v1/messagesand/go/google/....x-opencode-session: test-session, routing passes and the request reaches auth/model errors.GET https://opencode.ai/inference/go/v1/models→200, 28 models with anapifamily per model.kwwk carries the
opencode-gocatalog and display name, but has noproviderDirectoryentry, noregisterStoredcase, and no occurrence ofx-opencode-session(checked the pinned revision andorigin/main). This PR adds the provider the same way DeepSeek was added.What
AgentProvider.openCodeGo(opencode-go), API-key sign-in only,oc_sk_…placeholder, in the API Keys group after DeepSeek.OpenCodeGoProviderregisters each model on the wire its catalog entry names:https://opencode.ai/inference/go/openai/v1https://opencode.ai/inference/go/anthropichttps://opencode.ai/inference/go/googleOpenCodeGoSessionProviderstampsx-opencode-sessionfrom the conversation's session id (a process id for verification and other requests with no conversation), followingCopilotRequestHeadersProvider; it forwards session cleanup and native compaction.https://opencode.ai/inference/go/v1/models; known catalog ids keep theircompat, reasoning levels, image input and context. Unknown ids fall back to Chat Completions, which Console translates, with a conservative text-only, non-reasoning model.AGENTS.mddecision text and README provider list.Testing
make check— passed locally.swift buildinPackages/ApelinAgent— passed.swift testinPackages/ApelinAgent— 528 tests passed, including the newOpenCodeGoProviderTests,ProviderModelsTests,AccountDeskTestsandProviderKeyVerificationTestsadditions.swift test --filter OpenCodeGoLiveTests— compiles and skips withoutAPELIN_LIVE_OAUTH_PATH; not run against a real key here..debwas built locally: this machine has Xcode 26.3 / iOS 26.2, while the repo builds with Xcode 27.1 / iOS 27.1. CI'sbuildjob producesapelin-<sha>for device testing.To run the live test, add an
opencode-goentry to a kwwk-format credential file and run:Not included
x-opencode-sessionand is already reachable through OpenAI-Compatible athttps://opencode.ai/inference/v1. A named.openCodeZencan follow separately.opencode-goitself.Follow-ups
opencode-goregistration and the session header..deb: sign in, enable one Chat model and one Anthropic model, run a tool-call round trip on each.