feat: derive hermes provider from model slug prefix (both paths) - #9
Merged
Merged
Conversation
When HERMES_INFERENCE_PROVIDER isn't set, hermes-agent's "auto" detection is unreliable — particularly for MiniMax Token Plan + most non-OpenRouter direct-SDK providers. Without the right provider, hermes gateway rejects chats with "No LLM provider configured" or routes to the wrong backend. This is the last piece of the MVP pipeline that makes "customer creates workspace with model = minimax/MiniMax-M2.7-highspeed + key = sk-cp-..., just works" a one-click flow. Changes: - scripts/derive-provider.sh (NEW): sourced sub-script that reads HERMES_DEFAULT_MODEL and sets $PROVIDER to the right value for every provider hermes-agent supports. Explicit HERMES_INFERENCE_PROVIDER in the env wins; otherwise the case statement handles: minimax/*, minimax-cn/*, anthropic/*, gemini/*, deepseek/*, zai/*, kimi-coding/* (+ cn variant), alibaba/ dashscope/ qwen/*, xiaomi/ mimo/*, arcee/*, nvidia/ nim/*, ollama-cloud/*, huggingface/ hf/*, ai-gateway/*, kilocode/*, opencode-zen/*, opencode-go/*, openai/* (routes through openrouter — hermes has no direct openai provider), nousresearch/* (nous if HERMES_API_KEY or NOUS_API_KEY is set, else openrouter), openrouter/*, custom/*. Unknown prefix → "auto". - install.sh (bare-host path) + start.sh (Docker path): both now source scripts/derive-provider.sh to populate $PROVIDER before writing ~/.hermes/config.yaml. - Dockerfile: COPY scripts/ /app/scripts/ so start.sh can find the sub-script at the same path it lives on EC2 (/opt/adapter/scripts/ via git clone). This is the cross-path pattern the workspace-backends design doc calls for: each template's backend-specific entrypoints share common sub-recipes, so evolving the logic lives in one place. Tested locally: minimax/MiniMax-M2.7-highspeed → minimax anthropic/claude-sonnet-4-5 → anthropic openai/gpt-5-mini → openrouter nousresearch/hermes-4-70b (w/ key) → nous nousresearch/hermes-4-70b (no key) → openrouter zai/glm-4.6 → zai gemini/gemini-2.5-pro → gemini bogus/model-v1 → auto HERMES_INFERENCE_PROVIDER=custom (+anything) → custom Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2 tasks
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.
Closes the last gap in the 'customer creates workspace with MiniMax Token Plan, just works' MVP flow. Shared sub-script so install.sh (SaaS bare-host) + start.sh (Docker) stay consistent. Pairs with molecule-core PR for tenant env propagation.