Repository navigation
Conversation
Three OpenAI-compatible providers, wired through the existing transport: - Command Code (https://api.commandcode.ai/provider/v1) and OpenCode Go (https://opencode.ai/inference/go/openai/v1) serve their model catalog without auth, so keys are validated with a single authenticated 1-token probe instead of the shared GET /models path. That also surfaces upgrade_required (Command Code's Go plan has no API access) as its own message instead of "invalid key". - DeepSeek (https://api.deepseek.com) validates through GET /models, which does require auth. - Command Code's catalog marks Claude models as /messages-only. The picker filters on supported_endpoints so it never offers a model that would 400 on /chat/completions. Key storage is now per provider (keys_array_<provider>) instead of one shared pool: switching providers used to send the previous vendor's keys to the new endpoint, where they 401'd and were benched. The pre-provider pool migrates once to the active provider, and only for the three providers that existed while it was in use. upgrade_required no longer burns the rotation (it is account-level), and extractApiErrorCode now falls back to error.type / root code so gateways that report the reason there are still classified correctly. Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
Resources the new provider layer needs: display names for Command Code, OpenCode Go and DeepSeek, and the message used when a provider answers 403 upgrade_required (the account's plan has no API access). Co-authored-by: CommandCodeBot <noreply@commandcode.ai>
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.
What
Adds three OpenAI-compatible providers to the existing transport:
https://api.commandcode.ai/provider/v1deepseek/deepseek-v4-flashhttps://opencode.ai/inference/go/openai/v1glm-5.3-flashhttps://api.deepseek.comdeepseek-flashWhy key validation is provider-specific
/modelswithout auth, so the shared GET validator accepted any string (a placeholder key reported "Valid key added!"). They validate with a single authenticated 1-token probe instead. That also surfaces Command Code's403 upgrade_required(the Go plan has no API access) as its own message instead of "invalid key"./modelsdoes require auth, so it keeps the free GET path.ApiClientUtils.probeAcceptsKey) covered by a table test: 2xx and auth-passed 4xx pass, 401/403 fail, 404 passes only when the body indicates the model was unavailable (a valid key must not be rejected because the fixed probe model is not provisioned), 405/5xx fail.Catalog correctness
Command Code's catalog lists every model and marks routes in
supported_endpoints; its Claude models answer/messagesonly and return 400 on/chat/completions.parseChatCompletionModelIdsfilters on that metadata and treats it as authoritative once present, so the picker cannot regress to offering models that can never work. Catalogs without the field still fall back to the plain parser.Per-provider key storage
Keys move from one shared pool to
keys_array_<provider>. The shared pool meant switching providers sent the previous vendor's keys to the new endpoint, where they 401'd and were benched; switching back could then find nothing. The pre-provider pool is migrated once to the provider active at first read — and only for the three providers that existed while it was in use.upgrade_requiredis account-level, so it no longer rotates through every key, andextractApiErrorCodefalls back toerror.type/ rootcodefor gateways that report the reason there.Tests
./gradlew testDebugUnitTest— 209 tests passing, including new coverage for provider routing/defaults, catalogs, per-provider scoping and cache invalidation, legacy migration, parser filtering and the probe status table. Also exercised on a physical device against the live endpoints.This is the first of two PRs; the Settings UI change follows in a stacked PR that builds on this one.