Repository navigation
fix(provider): 注入网关模型列表到 Codex /model 并补全 metadata - #81
Merged
Merged
Conversation
Codex has no built-in metadata for slugs such as glm-5.3-flash, so a custom provider launch warned and fell back to a 272k window. Launch now writes a catalog next to provider.toml and passes model_catalog_json unless the provider already set one. Co-authored-by: lolitaupdate <[email protected]>
xjoker
marked this pull request as ready for review
August 27, 2026 03:56
Launch fills the generated catalog from GET {base_url}/models: small
lists replace the bundled picker wholesale, large catalogs stay limited
to --model/--models while still copying context windows and names.
Co-authored-by: lolitaupdate <[email protected]>
When the gateway /models call fails or omits a context window, fill display names and windows from the public OpenRouter catalog. Keep the provider slug, never forward the API key, and do not inject OpenRouter's full list into /model. Co-authored-by: lolitaupdate <[email protected]>
Per-provider --metadata-fallback (URL, local JSON, or none) wins over CODEX_SWITCH_METADATA_FALLBACK / CODEX_SWITCH_OPENROUTER_MODELS_URL, then the public OpenRouter list. Gateway /models stays first; fallback never decides which slugs appear in Codex /model. Co-authored-by: lolitaupdate <[email protected]>
Host equality skipped a same-IP mock (and would skip a same-host custom catalog). Compare the gateway /models URL to the fallback source instead. Co-authored-by: lolitaupdate <[email protected]>
--metadata-fallback added another String to the clap parse-once enum and tripped clippy::large_enum_variant. Co-authored-by: lolitaupdate <[email protected]>
Co-authored-by: lolitaupdate <[email protected]>
Custom-provider launch now sets the child's CODEX_HOME to providers/<alias>/codex-home. First launch may snapshot the user's config.toml (MCP servers); auth.json and other Codex files stay put. Co-authored-by: lolitaupdate <[email protected]>
The PATH probe used to execute `codex --version`, which writes helper binaries into the caller's CODEX_HOME. Look up the binary on PATH instead so a custom-provider launch does not touch the user's ~/.codex at all. Co-authored-by: lolitaupdate <[email protected]>
Custom-provider launch already points Codex at $CODEX_SWITCH_HOME/providers/<alias>/codex-home. Stop snapshotting the user's config.toml from $CODEX_HOME so MCP and other settings are not inherited from ~/.codex; Codex writes its own runtime files in our tree. Co-authored-by: lolitaupdate <[email protected]>
Keep custom-provider catalog injection and `$CODEX_SWITCH_HOME/providers/<alias>/codex-home` on top of the multi-model provider, TUI form, and launch passthrough already on `dev`. Do not copy or write the user's `~/.codex`. Co-authored-by: lolitaupdate <[email protected]>
Allocate today's second rolling-dev base so CI can inject 20260827.2.0-dev. Co-authored-by: lolitaupdate <[email protected]>
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.
Problem
Switching to a custom API provider with a slug Codex does not ship (for example
glm-5.3-flash) started Codex with a missing-metadata warning and a 272k fallback window. Custom-provider launch also must not read or write the user's~/.codex.This branch is rebased/merged onto current
dev(multi-model providers, TUI form, launch passthrough) and bumps the rolling-dev base to20260827.2.0.Change
$CODEX_SWITCH_HOME/providers/<alias>/models.jsonasmodel_catalog_json.{base_url}/models, then a configurable fallback (default public OpenRouter, no provider key).CODEX_HOMEis$CODEX_SWITCH_HOME/providers/<alias>/codex-home. Nothing is copied from the user's$CODEX_HOME.--metadata-fallback URL|PATH|noneonprovider add.Tests
cargo clippy --all-targets -- -D warningsandcargo test --allpassed locally after the merge.