Skip to content

feat: add /provider command for runtime provider switching without restart #2140

@bug-ops

Description

@bug-ops

Summary

Currently there is no way to switch the active LLM provider at runtime via a chat command. The /model command allows switching models within the current provider, but changing the provider itself requires editing config.toml and restarting the agent.

Current Behavior

  • /model [id|refresh] — switches model within the current provider
  • /status — shows current provider and model
  • Provider selection is static: set via [llm] provider = "..." in TOML at startup

Desired Behavior

A new /provider slash command that allows switching the active provider at runtime:

/provider              — list available configured providers
/provider <name>       — switch to a named provider (must be configured in TOML)
/provider status       — show current provider with stats (same as /status provider section)

Implementation Notes

  • Add SlashCommand::Provider variant in crates/zeph-core/src/agent/slash_commands.rs (near /model at line 122)
  • Handle in crates/zeph-core/src/agent/mod.rs alongside handle_model_switch (~line 2406)
  • Only allow switching to providers that are already configured in the loaded config (no dynamic config mutation)
  • After switching, reset model to the provider's configured default or require explicit /model <id> call
  • Update /status output to reflect the new provider immediately
  • TUI: emit a system status indicator during the switch (spinner + "Switching provider…" message, per TUI Rules)

Acceptance Criteria

  • /provider lists configured providers with current one highlighted
  • /provider <name> switches active provider; subsequent LLM calls use the new provider
  • /provider <unknown> returns a clear error without crashing
  • /status reflects the new provider after switch
  • Works in CLI, TUI, and Telegram channels
  • TUI shows a spinner during the switch operation

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions