Repository navigation
Description
Area
Catalog / models
What are you trying to accomplish?
Give every newly discovered model a predictable short alias automatically, following a per-provider template, so model names stay consistent across clients without manual ocx alias set calls each time a provider adds a model.
Example: provider alias CC, template {providerAlias}-{modelBasename} → command-code/reflection/beam:free becomes CC-beam-free.
What prevents this today?
ocx alias supports list, set, rm and defaults (built-in aliases). There is no way to say "alias every model of this provider with this pattern". Providers with live discovery (liveModels: true) add models at any time, and each new model appears without an alias until someone notices and runs ocx alias set.
What should OpenCodex do?
An opt-in, per-provider alias template applied to discovered models that do not already have an alias:
- explicit user aliases always win and are never overwritten;
- colliding or invalid generated names are skipped and reported, never silently renamed;
- generated aliases are marked with a distinct source (for example
source: "template"), so they can be listed, reviewed and removed separately from user aliases; - nothing changes for providers without a template.
Example usage or interface
ocx alias template set command-code "{providerAlias}-{modelBasename}"
ocx alias template show command-code
ocx alias list --json # generated rows carry "source": "template"
The exact placeholders and the behaviour for :free / / characters in model ids are open; today I normalize : to - and take the last path segment.
Alternatives or workarounds
An external job that polls /v1/models, finds rows without alias_of, and runs ocx alias set for each. On my host it applied new aliases 5 times in 7 days (340 runs). It works, but it is exactly the kind of logic that belongs next to alias resolution and collision checks inside OpenCodex.
Additional context
Related to #7703 on alias-aware client exports: together they would let a user standardize names once and have every client receive them. Feature proposal only; I would not start a PR without agreement on the interface.
Checks
- I searched existing issues and documentation.
- This request describes a concrete OpenCodex workflow rather than merely naming a desired technology.
- I removed secrets and personal data.
Activity
Ingwannu commentedon Oct 25, 2026
This is separate from #7703: generating aliases and choosing which identifier a client exports are two independent policies. Neither should silently change existing model IDs.
For an owner-reviewed proposal, keep generation opt-in and reuse the existing alias resolver/collision checks. Define a small literal placeholder grammar, explicit-user precedence, source tracking, collision behavior across providers/combos, and what happens when a model disappears or the template/provider alias changes. Two different full model IDs can share the same basename; skipping that collision must be deterministic and must not overwrite a manual alias. Catalog reads should not acquire an unexpected configuration-write side effect.
A short fixture table for names containing
/,:, spaces/selector characters and colliding basenames, plus preview/removal behavior, would settle the interface before implementation. The command names and automatic-refresh persistence policy remain a project-owner decision; this comment does not accept them as a new public API.rafaelmoreiraai commentedon Oct 25, 2026
Thanks, @Ingwannu, agreed that this is independent from #7703. Here is the fixture table, from synthetic ids run against
devat8ebe46b20through the realMODEL_ALIAS_PATTERN,sanitizeAliasesForLoad,effectiveModelAliasesandpreviewRouteModel. The expansion function lives in a test script only; nothing is implemented.Template under test:
{providerAlias}-{modelBasename}, provider aliasAC. Two variants:{modelBasename}= full model id (no normalization);{modelBasename}= last/segment, then:→-(an explicit, documented step, not implicit).vendor/model-aAC-vendor/model-aAC-model-a/fails the pattern; basename shared withother/model-aother/model-aAC-other/model-aAC-model-amodel-b:freeAC-model-b:freeAC-model-b-free:fails the pattern; after:→-it collides withmodel-b-freemodel-b-freeAC-model-b-freeAC-model-b-freehas space/model dAC-has space/model dAC-model dsel@ctor/model#eAC-sel@ctor/model#eAC-model#e#fails the patternmanual/keep(manual aliasAC-keep)other2/keepAC-other2/keepAC-keepdeep/nested/model-cAC-deep/nested/model-cAC-model-cAC-model-cx/raw-clashAC-x/raw-clashAC-raw-clashgrok-4-fast(has builtin aliasgrok)AC-grok-4-fastAC-grok-4-fastAll generated aliases passed
sanitizeAliasesForLoadand routed back to their own model withpreviewRouteModel(tested). Output was identical across three catalog orders (forward, reversed, rotated), for both variants (tested).Collision rule. Every template candidate that collides with another candidate, a manual alias, a combo alias, a builtin alias or a native id is skipped and reported, regardless of catalog order. One finding worth noting: the current loader keeps the first duplicate when two models in one provider share an alias (tested: insertion order decides which survives). A template should not reuse that first-wins behaviour, or a new model appearing earlier in a listing could steal an alias.
Proposed behaviour (owner decision, not an accepted API)
{providerAlias},{modelBasename}), no expressions; normalization only where documented.ocx alias list --json), with the exact field left to the owner.Command names, persistence and final precedence are for @lidge-jun to decide.
Ingwannu commentedon Oct 25, 2026
The fixture table now makes the normalization and collision policy reviewable. I have not independently executed the test script; the reported order-invariance and routing checks remain your evidence, while template expansion is explicitly unimplemented.
For an owner-approved implementation, reserve the complete candidate/occupied-name set before accepting any generated alias, so both sides of a normalization collision are skipped consistently. Do not reuse the loader's first-wins behavior as generation policy. Keep manual aliases authoritative, make removal/provider-alias changes visible in preview, and keep resolution-time catalog reads free of config writes. This remains independent of #7703: generating a usable alias does not itself migrate keys saved in an owned client connection.
The owner still needs to decide the public placeholder grammar, precedence and persistence/removal contract. This comment does not accept a new API or authorize a live client rewrite; the feature request remains open.
lidge-jun commentedon Oct 28, 2026
Design proposal from the maintainer triage lane. This is a proposal for owner review, not implementation approval. Baseline: fetched
origin/devatfdc6dd82d930295880dcf6d10bbb9f2c61994574.Current state. @rrmlima supplied the normalization/collision fixture table; @Ingwannu established the reservation and read-side safety requirements in the latest comment. Those are the starting contracts, not new work claimed here. The fixture script's reported results were not independently rerun. Today
src/cli/alias.ts:3exposes list/set/rm/defaults.src/providers/default-aliases.ts:62recognizes user/builtin provenance, and lines 73–99 derive effective aliases without template expansion.src/config/load-degrade.ts:1031keeps the first valid duplicate claim during loading; that is unsuitable as generation policy. The linked draft #7863 concerns exports; merged #7867 establishes the current export contract. This proposal leaves #7703's policy untouched.Options. Resolution-time derivation stores only the opt-in template and computes aliases from the current known roster; disappearance or template changes immediately remove obsolete derived aliases. Explicit materialization instead creates separately tracked generated records during an operator-approved operation, stabilizing names between operations but requiring reconciliation and removal rules. Automatic discovery-time persistence offers immediate coverage but introduces background writes and concurrent-edit handling.
Recommendation. Prefer resolution-time derivation, subject to owner acceptance of its selector-lifetime tradeoff. Use only literal
{providerAlias}and{modelBasename}placeholders; define basename as the final slash segment with colons replaced by hyphens, and reject other invalid output rather than inventing replacements. Skip expansion when the provider alias is unavailable. Preserve explicit aliases and existing builtin aliases; generate only for models without either. This deliberately differs from the contributor's proposed template-before-builtin precedence and needs an explicit owner choice. Reserve the complete candidate and occupied selector set before accepting anything, with deterministic rejection and reported reasons. Expose generated provenance and preview additions/removals without writing config.Risks and next slice. Discovery churn can invalidate saved selectors; normalization can collapse distinct IDs; stale snapshots can disagree with routing. Bound and redact diagnostics, evaluate no expressions, and preserve routing/account identity and existing native/combination reservations.
structure/runtime.md:21requires alias resolution before static-policy capture;structure/clients/export-model-names.md:22retains independent export identity proof. No implementation should start before @lidge-jun chooses grammar, builtin precedence, persistence/removal behavior, and the public authoring interface. After that decision, start with a pure expansion/preview evaluator and synthetic fixtures, with no routing activation or client writes. Cover roster-order invariance, cross-provider selector ambiguity, missing provider aliases, template changes, and removal. No implementation or runtime validation is claimed.rafaelmoreiraai commentedon Oct 29, 2026
Thanks for the design proposal. I support the conservative resolution-time option: explicit opt-in, manual and existing builtin aliases remain authoritative, generated aliases fill only the remaining models, and catalog reads do not write configuration. This revises my earlier template-before-builtin preference for the general upstream proposal.
One deployment caveat: preserving a builtin such as
grokinstead of generatingAC-grok-4-fastmeans this would not completely replace my local provider-prefixed naming policy. I will keep that local writer until a released native solution has been compared across all clients; I am not asking to silently override builtins.I exercised the proposed rules in an independent, local-only Python preview laboratory (no upstream source/runtime changes, config reads, routing activation or client writes): 18 tests passed, including all 24 permutations of a four-model collision fixture. Examples:
AC+vendor/model:freeAC-model-freegrokalready existsgrok, no generated replacementa/model+b/modelunderACAC-modelclaimsmodel:free+model-freeAn independent GPT 6.1 Sol review caught an empty-basename edge case and input-validation ordering; both were corrected and the second review found no blocker. These are local laboratory results, not a claim of upstream runtime validation or router/account-identity proof. No public CLI/API is introduced.
Could the owner explicitly settle the placeholder grammar, builtin precedence, selector lifetime/removal contract and authoring interface before runtime work begins? Once approved, the first upstream slice can stay a pure expansion/preview evaluator with synthetic fixtures, without activating routing or writing clients, as proposed above.
rafaelmoreiraai commentedon Nov 3, 2026
Thanks @lidge-jun and @Ingwannu. The design proposal from the triage lane aligns with the safety constraints we observed in our synthetic fixture runs.
Key agreements from our side:
config.jsonduring periodic background discovery and naturally handles removal/renaming when models or provider aliases change.We have a pure-evaluator preview test suite covering the 18 collision, normalization, and lifecycle cases ready to adapt into upstream PR contracts once you finalize the public interface and authoring flags.
github-actions commentedon Nov 3, 2026
Automated translation bookkeeping — detected language: English.
lidge-jun commentedon Nov 10, 2026
Owner decision needed: approve the posted design proposal (resolution-time derivation, Manual > Builtin > Template precedence, symmetric collision skip, no config writes from catalog reads), or defer it. The proposal comment above says it is "for owner review, not implementation approval", and nothing has approved it since. Once it is approved it can go to an implementation lane. Recommendation: approve as proposed. The reporter has endorsed the conservative variant.
lidge-jun commentedon Nov 10, 2026
Decision (coordinator, 11-11): the posted alias-template design is approved as proposed: opt-in, per provider, derived at resolution time, Manual > Builtin > Template precedence, and symmetric collision skips. Implementation follows in a PR for this issue.
feat(aliases): opt-in per-provider alias templates (lidge-jun#8512)