feat: protocol-aware model provider login#2933
Closed
bloodf wants to merge 2 commits intoultraworkers:mainfrom
Closed
feat: protocol-aware model provider login#2933bloodf wants to merge 2 commits intoultraworkers:mainfrom
bloodf wants to merge 2 commits intoultraworkers:mainfrom
Conversation
Claw could only target one generic OPENAI_BASE_URL at a time, which made Z.AI, MiniMax, Moonshot, and OpenAI switching depend on shell mutation. Add modelProviders config profiles, provider/model resolution for /model, and runtime construction from the selected profile while preserving existing built-in provider routing. Constraint: Keep existing env-based Anthropic, xAI, OpenAI, and DashScope routing intact. Rejected: Reuse aliases only | aliases cannot carry base URL or credential source to the runtime client. Confidence: medium Scope-risk: moderate Directive: Keep model provider credentials env-first; avoid requiring source-controlled apiKey values. Tested: cargo fmt; cargo test -p runtime parses_model_provider_profiles_from_settings -- --nocapture; cargo test -p rusty-claude-cli configured_model_provider -- --nocapture Not-tested: Live calls to every configured third-party provider.
The provider selector now supports both OpenAI-compatible and Anthropic-compatible configured providers, so OpenCode-style MiniMax and Kimi coding endpoints can be selected through /model without pretending they use OpenAI chat completions. The /login wizard writes provider profiles with protocol, base URL, env var, models, and default model, using current OpenCode provider ids and model lists. Constraint: OpenCode reports minimax-coding-plan and kimi-for-coding as Anthropic-compatible endpoints Rejected: Put MiniMax and Kimi coding models under openai-compatible profiles | the selector would resolve but runtime calls would use the wrong wire protocol Confidence: high Scope-risk: moderate Directive: Keep login presets aligned with provider protocol, not only model names Tested: cargo fmt --check Tested: cargo check -p runtime -p api -p commands -p tools -p rusty-claude-cli Tested: cargo test -p rusty-claude-cli configured_model_provider -- --nocapture Tested: cargo test -p rusty-claude-cli login_subcommand_parses_and_logout_errors_helpfully -- --nocapture Tested: cargo run -p rusty-claude-cli -- --model minimax-coding-plan status --output-format json Tested: cargo run -p rusty-claude-cli -- --model kimi-for-coding status --output-format json Not-tested: live API requests to each external provider model
Author
|
Superseded by #2977 which combines provider profiles, auth, and OAuth into a single PR. |
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.
Summary
Adds protocol-aware model provider profiles plus
claw login//loginfor writing provider profiles intosettings.json.The provider selector now supports both:
openai-compatibleproviders for OpenAI-style/v1/chat/completionsendpointsanthropic-compatibleproviders for Anthropic Messages-compatible endpointsThis makes OpenCode-style provider ids selectable through
/model, including:zai-coding-plan/glm-5.1minimax-coding-plan/MiniMax-M2.7-highspeedopenai/gpt-5.5kimi-for-coding/k2p6moonshot/kimi-k2.6Problem this solves
Users can define multiple providers today, but configured provider profiles were treated as OpenAI-compatible only. That makes MiniMax Coding Plan and Kimi For Coding look selectable while sending runtime requests through the wrong wire protocol.
The login flow also gives users a guided way to create these provider blocks without hand-editing JSON.
What changed
anthropic-compatible/anthropicas acceptedmodelProviders.*.typevalues.ProviderClientconstructor for configured profiles.claw loginand/loginto create/updatemodelProvidersentries./modelexamples.Test plan
cargo fmt --checkcargo check -p runtime -p api -p commands -p tools -p rusty-claude-clicargo test -p rusty-claude-cli configured_model_provider -- --nocapturecargo test -p rusty-claude-cli login_subcommand_parses_and_logout_errors_helpfully -- --nocapturecargo run -p rusty-claude-cli -- --model minimax-coding-plan status --output-format jsoncargo run -p rusty-claude-cli -- --model kimi-for-coding status --output-format json