Skip to content

feat(providers): add ClinePass and Command Code GOAT - #3927

Merged
Yeachan-Heo merged 1 commit into
devfrom
feat/commandcode-and-clinepass-provider
Aug 6, 2026
Merged

feat(providers): add ClinePass and Command Code GOAT#3927
Yeachan-Heo merged 1 commit into
devfrom
feat/commandcode-and-clinepass-provider

Conversation

@Yeachan-Heo

Copy link
Copy Markdown
Owner

Summary

  • add first-class cline-pass and commandcode-goat provider presets
  • discover both catalogs dynamically instead of hardcoding model lists
  • route every Command Code claude-* model through Anthropic Messages and all other models through OpenAI Chat Completions
  • add setup/help/docs/changelog/schema coverage and focused regression tests
  • keep discovery bearer credentials request-local so they are not persisted in model metadata/cache

Provider contracts

ClinePass

  • base URL: https://api.cline.bot/api/v1
  • credential: CLINE_API_KEY
  • inference: OpenAI-compatible /chat/completions
  • catalog: live cline-pass provider data from https://models.dev/api.json

Cline's inference API does not expose a working ClinePass /models route, so this follows Cline's own upstream catalog-generation source.

Command Code GOAT

  • base URL: https://api.commandcode.ai/provider/v1
  • credential: CMD_API_KEY
  • catalog: live /models
  • claude-*: /messages via anthropic-messages
  • all other IDs: /chat/completions via openai-completions

Verification

  • provider onboarding/ranking/setup/slash-command tests: 59 passed
  • focused model-registry discovery/security tests: 2 passed
  • bun --cwd=packages/coding-agent run check
  • bun run check:schemas
  • git diff --check
  • cleaner: CLEAN
  • architect: CLEAR / APPROVE
  • executor QA/red-team: passed
  • terminal critic: OKAY

Live QA

  • ClinePass: real authorized credential produced 11 available cline-pass/* models through models.dev
  • Cline /api/v1/models: 404, confirming the alternate catalog source is required
  • Cline Chat Completions accepted authentication but returned account quota 429
  • Command Code live catalog: 52 models; all 7 Claude IDs routed to Anthropic Messages and all 45 other IDs routed to OpenAI Chat Completions

Authenticated Command Code inference was not exercised because the authorized remote configuration did not contain a Command Code credential.

Coding-plan users need first-class setup without maintaining stale model catalogs. Dynamic discovery keeps ClinePass and Command Code routing aligned with their authoritative provider sources.

Lore-id: 66fc75f6

Constraint: provider model catalogs must remain dynamic and Claude Command models must use Anthropic Messages

Rejected: hardcoded provider model lists | they become stale and can route newly added Claude models incorrectly

Confidence: high

Scope-risk: wide

Reversibility: simple

Tested: focused provider onboarding, ranking, setup, slash-command, registry discovery, routing, schema sync, package typecheck, and live catalog probes

Not-tested: authenticated Command Code inference because no credential was available; Cline inference completion because the account was quota-limited

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 286f0e8e8b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2785 to +2786
contextWindow: item.context_length ?? referenceModel?.contextWindow ?? UNK_CONTEXT_WINDOW,
maxTokens: referenceModel?.maxTokens ?? UNK_MAX_TOKENS,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Cap discovered output tokens to the advertised context

When an OpenAI-compatible /models endpoint reports a smaller context_length for a known model—such as a local proxy exposing a bundled Claude ID with a reduced context—the resulting model combines that server limit with the bundled model's potentially larger maxTokens. This can advertise an impossible output allowance and, for Anthropic-routed models, cause buildParams to derive a max_tokens value that exceeds the endpoint's total context; clamp the reference output limit to the discovered context or use endpoint-provided output metadata.

Useful? React with 👍 / 👎.

Comment on lines 2749 to +2751
const response = await fetch(modelsUrl, {
headers,
signal: AbortSignal.timeout(250),
headers: requestHeaders,
signal: AbortSignal.timeout(5_000),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve the short timeout for local model discovery

When implicit LM Studio discovery is uncached and its endpoint accepts a connection but does not respond—or LM_STUDIO_BASE_URL points at a black-holed host—an awaited refresh now stalls for five seconds because lm-studio is dispatched through this same method. This path previously had a 250 ms budget and is awaited by model-selection and task-execution flows, so use the longer timeout only for remote providers such as Command Code while retaining a short timeout for optional local discovery.

Useful? React with 👍 / 👎.

@Yeachan-Heo
Yeachan-Heo force-pushed the feat/commandcode-and-clinepass-provider branch from 286f0e8 to 29c045d Compare August 6, 2026 09:34

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29c045d10e

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +2683 to +2685
for (const [prefix, routedApi] of Object.entries(providerConfig.discovery.apiByModelPrefix ?? {})) {
if (modelId.startsWith(prefix) && prefix.length > matchedPrefixLength) {
api = routedApi;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reapply prefix routing to cached models

When apiByModelPrefix is edited while this provider has a fresh discovery cache, the normal refresh() path uses online-if-uncached and returns the cached model objects without invoking this resolver. Those objects retain the API selected by the previous configuration, so a model can continue using Chat Completions instead of Anthropic Messages (or vice versa) for up to the 24-hour cache lifetime. Reapply the current prefix rules while normalizing cached models, or include these rules in cache invalidation.

Useful? React with 👍 / 👎.

@Yeachan-Heo
Yeachan-Heo force-pushed the feat/commandcode-and-clinepass-provider branch from 29c045d to 26f1ec0 Compare August 6, 2026 11:03

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 26f1ec0d9d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

}

async #discoverModelsDevProvider(providerConfig: DiscoveryProviderConfig): Promise<Model<Api>[]> {
const baseUrl = providerConfig.baseUrl;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Rebind cached models.dev rows to the live base URL

When a models-dev provider's configured baseUrl changes while its 24-hour discovery cache is fresh, each cached model retains the old URL assigned here. #loadCachedDiscoverableModels only restores the live URL for openai-models-list and lm-studio, and online-if-uncached then accepts these rows while recording evidence for the new endpoint, so inference—and its API key—can continue going to the previous endpoint until the cache expires. Normalize cached models-dev rows against the current provider URL as well.

Useful? React with 👍 / 👎.

@Yeachan-Heo
Yeachan-Heo force-pushed the feat/commandcode-and-clinepass-provider branch from 26f1ec0 to 4149e2b Compare August 6, 2026 11:28

@yazzang-homelab yazzang-homelab left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent architect review. This is the first human review — the three prior entries are bot comments.

Both presets are well-formed and the two discovery strategies are correctly matched to their providers.

cline-pass        https://api.cline.bot/api/v1              CLINE_API_KEY
                  discovery: models-dev (modelsDevProvider: "cline-pass")

commandcode-goat  https://api.commandcode.ai/provider/v1    CMD_API_KEY
                  discovery: openai-models-list (apiByModelPrefix)

Using models-dev for ClinePass (which publishes to the upstream catalog) and openai-models-list for Command Code (which does not, but exposes /models) is the right split — a single strategy would have forced one of them into a hand-maintained model list that goes stale silently.

Details I checked rather than assumed:

  • addApiCompatibleProvider({ preset: "cline-pass", models: ["custom"] }) rejects. A discovery-backed preset must not also accept a caller-supplied model list, or the two sources drift and the user cannot tell which won. Asserting the rejection, not just the happy path, is what makes that a contract instead of a convention.
  • models is asserted toBeUndefined() in the written config for the discovery preset — so nothing is materialized at setup time that would later shadow discovery.
  • Aliases are distinct and non-overlapping: clinepass/clinecline-pass, and commandcode/command-code/goatcommandcode-goat. No alias resolves into both, which is the failure that makes gjc setup <alias> nondeterministic.
  • Ranking is a 2-line addition and both provider-ranking.test.ts and provider-ranking.redteam.test.ts were updated. A new provider entering the ranking table without a red-team update is the usual way an autorouting tier quietly changes for unrelated models.
  • CHANGELOG is intact (312,528 bytes vs 312,259 on dev — grew by this PR's entry). Worth stating: twelve open PRs currently have a truncated or emptied changelog (#3942), and this is not one of them.
  • Merges cleanly into current dev. Also note this PR edits docs/models.md and docs/environment-variables.md but carries no docs-index.generated.ts change — confirmation that #3932's untracking is working as intended on a real docs-touching PR.

One thing to verify before merge, which I cannot check from here: both baseUrl values are third-party endpoints that will receive user API keys and prompt content. api.cline.bot/api/v1 and api.commandcode.ai/provider/v1 should each be confirmed against the vendor's published documentation — a typo'd or squatted host in a shipped preset is a credential-exfiltration path that no test will catch, because every test here asserts the constant matches itself. If the PR body cites the vendor docs URL for each, that closes it.

Related: CMD_API_KEY is a notably generic environment variable name for a shipped preset. It is plausible a user already has CMD_API_KEY set for something unrelated, which would silently authenticate against Command Code. COMMANDCODE_API_KEY would collide with nothing. If the vendor documents CMD_API_KEY then matching them is correct and this is just worth a note; if it is our choice, the specific name is safer.

gajae.pr-review-verdict.v1 merge-approved sha256:4149e2bc21580a2988cad7e6eba253e7a17cbd52 reviewer:architect evidence:read of provider-presets.json entries, provider-onboarding.test.ts:610-690, and provider-ranking diffs at this head; merge-tree vs origin/dev clean; CHANGELOG 312528 bytes intact

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: f93155c094

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


const discovered: Model<Api>[] = [];
for (const [catalogId, value] of Object.entries(catalogProvider.models)) {
if (!isRecord(value) || value.tool_call !== true || value.status === "deprecated") continue;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove models omitted by refreshed catalogs

When a previously discovered ClinePass model is later marked deprecated or removed, an online refresh filters it out here, but #refreshRuntimeDiscoveries merges only the returned rows into the existing this.#models array and never removes provider rows absent from the new result; its discovered.length === 0 path also returns without changing the catalog. Consequently, deprecated or withdrawn models remain selectable until the process restarts, despite a successful live refresh. Replace the provider's prior discovered slice when publishing an authoritative result.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d6fbc1cbb0

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

thinking: referenceModel?.thinking,
input: referenceModel?.input ?? ["text"],
output: referenceModel?.output,
cost: referenceModel?.cost ?? { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid inheriting upstream prices for proxy catalogs

When an OpenAI-compatible /models response contains an ID from the bundled catalog—such as Command Code's Claude models or a known model loaded through LM Studio—this copies the first-party model's per-token prices even though the discovered endpoint may be subscription-backed or local. calculateCost subsequently uses model.cost for these non-OpenAI providers, so session totals and exports report charges that were never incurred; keep discovery pricing at zero unless the endpoint or a provider-specific override supplies it.

Useful? React with 👍 / 👎.

@Yeachan-Heo
Yeachan-Heo merged commit d2646cb into dev Aug 6, 2026
34 checks passed
@Yeachan-Heo
Yeachan-Heo deleted the feat/commandcode-and-clinepass-provider branch August 6, 2026 13:34
Yeachan-Heo added a commit that referenced this pull request Aug 6, 2026
Red-team MERGE_READY at 460285d. Test-only contract correction for post-#3927 discovery limits (same-id YAML, modelOverrides, UNK fallbacks). No runtime change. Local public surfaces failed pre-checkout on GitHub Actions 5xx only.
Yeachan-Heo added a commit that referenced this pull request Aug 6, 2026
…ntract (#3966)

Red-team MERGE_READY. Test-only: assert post-#3927 public error 'At least one model id or model discovery is required'. Dev CI 31127515306 success. No runtime change.
Yeachan-Heo pushed a commit to probepark/gajae-code that referenced this pull request Aug 6, 2026
…ntract

Dev CI at 4f6e860 fails provider-onboarding-wizard-redteam on a stale
assertion: it expected "At least one model id is required" while
addApiCompatibleProvider throws the post-Yeachan-Heo#3927 public message
"At least one model id or model discovery is required."

Update the empty-models red-team expectation to the exact intended
substring of that contract. No runtime change.

Lore-id: 9c4e1a02
Confidence: high
Scope-risk: narrow
Reversibility: trivial
Tested: bun test packages/coding-agent/test/provider-onboarding-wizard-redteam.test.ts (7 pass / 0 fail)
Not-tested: full Dev CI shard matrix
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