Skip to content

feat: protocol-aware model provider login#2933

Closed
bloodf wants to merge 2 commits intoultraworkers:mainfrom
bloodf:heitor/provider-model-selector
Closed

feat: protocol-aware model provider login#2933
bloodf wants to merge 2 commits intoultraworkers:mainfrom
bloodf:heitor/provider-model-selector

Conversation

@bloodf
Copy link
Copy Markdown

@bloodf bloodf commented Apr 30, 2026

Summary

Adds protocol-aware model provider profiles plus claw login / /login for writing provider profiles into settings.json.

The provider selector now supports both:

  • openai-compatible providers for OpenAI-style /v1/chat/completions endpoints
  • anthropic-compatible providers for Anthropic Messages-compatible endpoints

This makes OpenCode-style provider ids selectable through /model, including:

  • zai-coding-plan/glm-5.1
  • minimax-coding-plan/MiniMax-M2.7-highspeed
  • openai/gpt-5.5
  • kimi-for-coding/k2p6
  • moonshot/kimi-k2.6

Problem 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

  • Added anthropic-compatible / anthropic as accepted modelProviders.*.type values.
  • Added an Anthropic-compatible ProviderClient constructor for configured profiles.
  • Dispatches configured profiles by their declared protocol at runtime.
  • Added claw login and /login to create/update modelProviders entries.
  • Added presets for Z.AI, Z.AI Coding Plan, MiniMax Coding Plan, OpenAI, Kimi For Coding, and Moonshot/Kimi.
  • Updated docs with the provider JSON shape and /model examples.

Test plan

  • cargo fmt --check
  • cargo check -p runtime -p api -p commands -p tools -p rusty-claude-cli
  • cargo test -p rusty-claude-cli configured_model_provider -- --nocapture
  • cargo test -p rusty-claude-cli login_subcommand_parses_and_logout_errors_helpfully -- --nocapture
  • cargo run -p rusty-claude-cli -- --model minimax-coding-plan status --output-format json
  • cargo run -p rusty-claude-cli -- --model kimi-for-coding status --output-format json
  • Live API call against every listed external model

bloodf added 2 commits April 30, 2026 02:12
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
@bloodf bloodf changed the title Enable protocol-aware model provider login feat: protocol-aware model provider login Apr 30, 2026
@bloodf
Copy link
Copy Markdown
Author

bloodf commented May 1, 2026

Superseded by #2977 which combines provider profiles, auth, and OAuth into a single PR.

@bloodf bloodf closed this May 1, 2026
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.

1 participant