mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-04-25 00:51:20 +00:00
feat: add Nous Portal API key provider (#644)
Add support for using Nous Portal via a direct API key, mirroring how OpenRouter and other API-key providers work. This gives users a simpler alternative to the OAuth device-code flow when they already have a Nous API key. Changes: - Add 'nous-api' to PROVIDER_REGISTRY as an api_key provider pointing to https://inference-api.nousresearch.com/v1 - Add NOUS_API_KEY and NOUS_BASE_URL to OPTIONAL_ENV_VARS - Add NOUS_API_BASE_URL / NOUS_API_CHAT_URL to hermes_constants - Add 'Nous Portal API key' as first option in setup wizard - Add provider aliases (nous_api, nousapi, nous-portal-api) - Add test for nous-api runtime provider resolution Closes #644
This commit is contained in:
parent
928bb16da1
commit
de07aa7c40
6 changed files with 103 additions and 12 deletions
|
|
@ -158,6 +158,29 @@ def test_custom_endpoint_auto_provider_prefers_openai_key(monkeypatch):
|
|||
assert resolved["api_key"] == "sk-vllm-key"
|
||||
|
||||
|
||||
def test_resolve_runtime_provider_nous_api(monkeypatch):
|
||||
"""Nous Portal API key provider resolves via the api_key path."""
|
||||
monkeypatch.setattr(rp, "resolve_provider", lambda *a, **k: "nous-api")
|
||||
monkeypatch.setattr(
|
||||
rp,
|
||||
"resolve_api_key_provider_credentials",
|
||||
lambda pid: {
|
||||
"provider": "nous-api",
|
||||
"api_key": "nous-test-key",
|
||||
"base_url": "https://inference-api.nousresearch.com/v1",
|
||||
"source": "NOUS_API_KEY",
|
||||
},
|
||||
)
|
||||
|
||||
resolved = rp.resolve_runtime_provider(requested="nous-api")
|
||||
|
||||
assert resolved["provider"] == "nous-api"
|
||||
assert resolved["api_mode"] == "chat_completions"
|
||||
assert resolved["base_url"] == "https://inference-api.nousresearch.com/v1"
|
||||
assert resolved["api_key"] == "nous-test-key"
|
||||
assert resolved["requested_provider"] == "nous-api"
|
||||
|
||||
|
||||
def test_resolve_requested_provider_precedence(monkeypatch):
|
||||
monkeypatch.setenv("HERMES_INFERENCE_PROVIDER", "nous")
|
||||
monkeypatch.setattr(rp, "_get_model_config", lambda: {"provider": "openai-codex"})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue