The previous fix (#142) prefixed non-default provider models with 'provider/model' which then hit the cross-provider guard and routed to OpenRouter — worse than before for users without an OpenRouter key. New approach: non-default provider models use '@provider:model' format (e.g. @minimax:MiniMax-M2.7). resolve_model_provider() parses this hint and returns (bare_model, provider, None). streaming.py and routes.py then pass the resolved provider to resolve_runtime_provider(requested=provider) which gets the correct per-provider API key and base_url from hermes-agent. This uses the agent's own credential resolution instead of reinventing routing logic in the webui. Fixes #138 Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -143,11 +143,12 @@ def _run_agent_streaming(session_id, msg_text, model, workspace, stream_id, atta
|
||||
raise ImportError("AIAgent not available -- check that hermes-agent is on sys.path")
|
||||
resolved_model, resolved_provider, resolved_base_url = resolve_model_provider(model)
|
||||
|
||||
# Resolve API key via Hermes runtime provider (matches gateway behaviour)
|
||||
# Resolve API key via Hermes runtime provider (matches gateway behaviour).
|
||||
# Pass the resolved provider so non-default providers get their own credentials.
|
||||
resolved_api_key = None
|
||||
try:
|
||||
from hermes_cli.runtime_provider import resolve_runtime_provider
|
||||
_rt = resolve_runtime_provider()
|
||||
_rt = resolve_runtime_provider(requested=resolved_provider)
|
||||
resolved_api_key = _rt.get("api_key")
|
||||
if not resolved_provider:
|
||||
resolved_provider = _rt.get("provider")
|
||||
|
||||
Reference in New Issue
Block a user