docs(rust/README): document xAI and Kimi model aliases - #3268
nankingjing wants to merge 2 commits into
Conversation
|
Good catch — the model aliases table was indeed incomplete. Having the full alias set documented alongside the Provider and Auth env var columns makes it much more actionable for users. The case-insensitivity note is also a helpful detail. |
|
我已收到您的邮件~会尽快给您回复。祝您六时吉祥,阿弥陀佛。
|
|
Thanks for the quick review, @1716775457damn! Glad the Provider / Auth-env columns are useful. I noticed a couple of other small doc nits while in there (a broken link and an out-of-date crate count) and have a follow-up PR incoming, kept separate to keep this one focused. |
|
Sounds good, keeping the follow-up PR focused on those doc nits separately makes sense. Looking forward to reviewing it — especially the broken link fix. Thanks for the thorough docs work! |
|
Quick note: #3269 is just the crate-count fix; I haven't opened the broken-link follow-up yet — will get to that separately. Thanks for flagging it! |
|
Got it, thanks for the clarification. #3269 looks good for the crate count — will review that next. No rush on the broken link, just drop a mention when it's up. |
|
The alias table now covers all provider models consistently — having xAI and Kimi documented alongside Anthropic makes it much easier to discover available options. Thanks for filling this gap @nankingjing! |
|
Thanks for the update @nankingjing! The alias table looks complete now — covers xAI and Kimi models cleanly. Docs-only change, good to go. |
|
Thanks for the review feedback @1716775457damn! All 6 PRs are green on CI. If you have a moment, could you submit a formal PR review approval (Review changes → Approve) on each? That would let them merge cleanly. Much appreciated! |
|
Approved. Filling the gap where xAI and Kimi aliases were missing from the documented table while already supported in resolve_model_alias is the right fix. The additional Provider and Auth env var columns make each alias immediately actionable rather than requiring users to cross-reference config files. Good docs improvement. |
|
Useful addition. xAI and Kimi are increasingly popular, documenting their aliases helps users get started quickly. |
|
One follow-up worth considering: this drift happened because the alias table is maintained by hand while the real resolution lives in resolve_model_alias, so the same gap reopens the next time an alias is added. Generating the table from the resolver, or adding a small test asserting that every alias listed in the README actually resolves (and that every resolver alias is documented), would keep docs and behaviour from diverging. It would also help to state whether alias resolution happens before or after the provider-prefix stripping from #3232, since that ordering is what users will hit. |
|
Correction to my earlier note (the one asking for a formal approval). I wrote there that "All 6 PRs are green on CI". That was wrong, I had not verified it, and I retract it. The head commit ( The PR body is accurate on this point — it states plainly that a full The follow-up ask in that note was misdirected too: @1716775457damn shows What these PRs are actually waiting on is a maintainer: approving the queued workflow runs so Rust CI can execute, then reviewing and merging. The code changes are unchanged by this note — only my claim about their CI status was wrong. |
|
Answering the follow-up from @1716775457damn (2026-09-07) properly, rather than only the CI note above. The drift is real, and slightly wider than this diff implies. In On generating the table. I'd rather land a parity test than promise a generator, and it's worth being precise about why the generator is not trivial: the alias→canonical-id mapping is not in On the ordering question (alias resolution vs the provider-prefix stripping). I traced it: the two do not compete, and the order is alias-first, with prefix handling only ever seeing the already-resolved name.
Two consequences worth stating for users:
Tell me if you want the parity test in this PR or as a follow-up; either is fine by me. |
|
Parity test in this PR, please — it's cheap and it locks the exact property that drifted, so there's no reason to defer it. Agreed on keeping the registry refactor out: moving the canonical id onto the registry entry is a resolver change, and doing it as its own PR keeps this docs fix reviewable. Thanks for tracing the ordering — alias-first with prefix stripping only at request-build time is worth one line in the README so users don't have to guess whether "anthropic/opus" is a valid alias (it isn't). |
The `## Model Aliases` table and `MODEL_REGISTRY` had drifted: the table listed only the three Anthropic aliases while the resolver had grown the xAI and Kimi entries, so an alias could resolve without being documented. Assert the two agree in both directions — every registry alias appears in the table with the canonical id and auth env var it actually resolves to, and the table introduces no alias the resolver does not know. Each row is also checked case-insensitively, since the README claims `OPUS` behaves the same as `opus`. Also pin that a provider-prefixed form such as `anthropic/opus` is not an alias: it is passed through as-is rather than expanded. The README now says so, which is what made the distinction worth a test rather than a comment.
|
Done — the parity test is in ( What it locks, in both directions:
It parses the README rather than hardcoding expectations, so editing the table without the registry (or the reverse) fails with the offending row named in the assertion message. One deviation worth flagging, since it changes the wording you suggested. I wrote the README line as "a prefixed form such as
Worth knowing for this and the other PRs: the push created two workflow runs ( |
|
Parity test 的设计很到位:解析 README 而非硬编码期望,集合相等让 stale row 和缺失行同样失败,大写复查也覆盖了 README 的声明。文档化行为而不是机制的取舍我赞成——写成 prefix stripping 反而会承诺 strip_provider_prefix 这个死代码做不到的事,现在这句 user-visible 声明才是测试真正断言的属性。CI 等维护者批准 action_required 即可,本地 160 passed 已经有足够信心。 |
|
Parity test 已落进 PR(072594d),双向往返校验 + 大写复查把 docs 与 resolver 的漂移彻底钉死,这条文档修复可以合了。CI 等维护者批准 action_required 后确认全绿即可。后续若做 resolver 侧的 canonical id 重构,记得单独开 PR 并保持 README 声明同步。 |
What
The Model Aliases table in
rust/README.mdonly listed the three Anthropicaliases (
opus,sonnet,haiku), butresolve_model_aliasinrust/crates/api/src/providers/mod.rsalso resolves xAI and Kimi aliases. ThisPR documents the full alias set, adds a Provider and Auth env var column
so each alias is actionable, and notes that resolution is case-insensitive.
Newly documented aliases (verified against
MODEL_REGISTRY/resolve_model_alias):grok,grok-3grok-3XAI_API_KEYgrok-mini,grok-3-minigrok-3-miniXAI_API_KEYgrok-2grok-2XAI_API_KEYkimikimi-k2.5DASHSCOPE_API_KEYWhy it's correct
Everything added is verifiable in the source, not invented:
resolve_model_alias()mapsgrok/grok-3→grok-3,grok-mini/grok-3-mini→
grok-3-mini,grok-2→grok-2, andkimi→kimi-k2.5.MODEL_REGISTRYsets the auth/base-url env vars for each provider:xAI →
XAI_API_KEY/XAI_BASE_URL, Kimi →DASHSCOPE_API_KEY/DASHSCOPE_BASE_URL.resolve_model_aliaslowercases input before matching, andexisting tests assert this (
kimi_alias_resolves_to_kimi_k2_5checks"KIMI",resolves_grok_aliaseschecks the grok family)."use an xAI model alias such as
--model grok"), anddocs/MODEL_COMPATIBILITY.mddocuments the corresponding request handling — this PR just surfaces the aliases
where they are listed.
Scope
Docs-only change to
rust/README.md. No code or behavior changes. The existingopus/sonnet/haikurows are unchanged.