Fireworks user agent (#80422)

This commit is contained in:
rob-maron 2026-08-06 19:49:57 -06:00 committed by GitHub
parent f88f6f8e67
commit 226b095a59
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 16 additions and 0 deletions

View File

@ -9,6 +9,7 @@ Model IDs here track the canonical Fireworks catalog (fw-ai/fireconnect
``setup-cli``).
"""
from hermes_cli import __version__ as _HERMES_VERSION
from providers import register_provider
from providers.base import ProviderProfile
@ -22,6 +23,9 @@ fireworks = ProviderProfile(
env_vars=("FIREWORKS_API_KEY",),
base_url="https://api.fireworks.ai/inference/v1",
auth_type="api_key",
# Identifies the client, replacing the OpenAI SDK's own User-Agent. This is
# not partner attribution — HTTP-Referer/X-Title stay off (#61182).
default_headers={"User-Agent": f"HermesAgent/{_HERMES_VERSION}"},
# Auxiliary model for cheap tasks (compaction, title generation, vision).
# A standard pay-as-you-go catalog ``/models/`` ID.
default_aux_model="accounts/fireworks/models/glm-5p2",

View File

@ -164,6 +164,14 @@ class TestFireworksAuxiliary:
assert "X-Title" not in headers
assert kwargs["base_url"] == "https://api.fireworks.ai/inference/v1"
def test_client_sends_hermes_user_agent(self, monkeypatch):
"""The profile's User-Agent survives the generic default_headers
fallback and reaches OpenAI client construction."""
monkeypatch.setenv("FIREWORKS_API_KEY", "fw_test_key")
_client, _model, kwargs = self._resolve("fireworks")
headers = kwargs.get("default_headers", {})
assert headers["User-Agent"].startswith("HermesAgent/")
class TestFireworksModelMetadata:
def test_url_infers_fireworks(self):

View File

@ -44,6 +44,10 @@ class TestFireworksHeaders:
assert "HTTP-Referer" not in fireworks_profile.default_headers
assert "X-Title" not in fireworks_profile.default_headers
def test_user_agent_identifies_hermes(self, fireworks_profile):
# Prefix, not the full string — the version moves every release.
assert fireworks_profile.default_headers["User-Agent"].startswith("HermesAgent/")
class TestFireworksAliases:
@pytest.mark.parametrize("alias", ["fireworks-ai", "fw"])