hermes-agent/plugins/model-providers/fireworks/__init__.py
Alex Jestin Taylor c97d9a4c07 feat(providers): add Fireworks AI as preferred provider
Bundle Fireworks AI as a first-class BYOK provider across the CLI, web/TUI,
and desktop onboarding.

- New model-provider plugin with attribution headers (HTTP-Referer / X-Title)
  so Fireworks can attribute Hermes traffic; PAYG-safe default aux + fallback
  models (accounts/fireworks/models/...), IDs tracking fw-ai/fireconnect.
- Registered in CANONICAL_PROVIDERS so it appears in the CLI/web/TUI pickers.
- Alias wiring (fireworks-ai, fw) into both CLI resolvers.
- First-class wiring: OPTIONAL_ENV_VARS, HERMES_OVERLAYS (FIREWORKS_BASE_URL
  override), doctor env hints. Live catalog + model_metadata are auto-derived.
- doctor: treat Fireworks' native slash-form IDs (accounts/fireworks/...) as
  valid, not aggregator vendor prefixes, so it no longer tells Fireworks users
  to switch to openrouter or drop the prefix.
- picker: plugin providers with no static curated list now lead with their
  profile fallback_models, so the default is an agentic chat model instead of
  whatever the live catalog returns first (Fireworks listed an image model,
  flux-*, ahead of its chat models).
- Desktop onboarding: Fireworks as a RECOMMENDED hero card with the official
  Fireworks logomark and a brand-purple badge, routing to the BYOK key form;
  i18n in en/ja/zh/zh-hant.
- Tests: profile contract, first-class wiring (both resolvers, overlay, config,
  doctor incl. the slash-form regression, aux headers, credentials), discovery
  spot-check, and a live smoke test driven through the Hermes runtime.

Fire Pass (fpk_) support is coming soon; the future wiring is kept as a
commented-out scaffold in the plugin.
2026-07-11 05:43:35 -07:00

68 lines
2.9 KiB
Python

"""Fireworks AI provider profile.
Fireworks AI serves fast, production-grade inference for open and proprietary
models through an OpenAI-compatible chat-completions endpoint. It is a bundled,
preferred BYOK provider — users paste a Fireworks API key and go.
Address models directly by their catalog ID, e.g.
``accounts/fireworks/models/kimi-k2p6`` or ``accounts/fireworks/models/glm-5p2``.
Model IDs here track the canonical Fireworks catalog (fw-ai/fireconnect
``setup-cli``).
"""
from providers import register_provider
from providers.base import ProviderProfile
fireworks = ProviderProfile(
name="fireworks",
aliases=("fireworks-ai", "fw"),
display_name="Fireworks AI",
description="Fireworks AI — fastest inference for production AI, 300+ models, one API key",
signup_url="https://app.fireworks.ai/settings/users/api-keys",
env_vars=("FIREWORKS_API_KEY", "FIREWORKS_BASE_URL"),
base_url="https://api.fireworks.ai/inference/v1",
auth_type="api_key",
# Attribution: lets Fireworks identify traffic originating from Hermes Agent
# (partner/revenue attribution). Matches the canonical Hermes attribution
# values in agent/auxiliary_client.py. Applied at client construction via the
# generic profile.default_headers path in run_agent.py.
default_headers={
"HTTP-Referer": "https://hermes-agent.nousresearch.com",
"X-Title": "Hermes Agent",
},
# 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",
# Curated safety net shown in the picker when the live catalog fetch fails.
fallback_models=(
"accounts/fireworks/models/kimi-k2p6",
"accounts/fireworks/models/glm-5p2",
"accounts/fireworks/models/kimi-k2p7-code",
),
)
register_provider(fireworks)
# ---------------------------------------------------------------------------
# Future work (intentionally disabled for now — do not ship as customer-facing).
#
# A second Fireworks key tier authenticates against the same endpoint but can
# only address managed router IDs (accounts/fireworks/routers/...), not raw
# /models/ IDs, and cannot list the account catalog. Enabling it means detecting
# the key prefix and swapping the picker catalog + aux model to routers. Kept
# here (commented out) so the wiring is ready when we turn it on. Router IDs and
# behavior track fw-ai/fireconnect setup-cli.
#
# _MANAGED_KEY_PREFIX = "fpk_"
# _MANAGED_ROUTERS = (
# "accounts/fireworks/routers/glm-latest", # default
# "accounts/fireworks/routers/glm-fast-latest",
# "accounts/fireworks/routers/kimi-latest",
# "accounts/fireworks/routers/kimi-k2p6-turbo", # turbo tier — not a default
# )
#
# def _is_managed_key(api_key: str) -> bool:
# return bool(api_key) and api_key.startswith(_MANAGED_KEY_PREFIX)
# ---------------------------------------------------------------------------