Skip to content

feat(nvidia): add NIM billing origin header#25211

Closed
nv-kasikritc wants to merge 1 commit into
NousResearch:mainfrom
nv-kasikritc:nvidia-nim-origin-header
Closed

feat(nvidia): add NIM billing origin header#25211
nv-kasikritc wants to merge 1 commit into
NousResearch:mainfrom
nv-kasikritc:nvidia-nim-origin-header

Conversation

@nv-kasikritc

@nv-kasikritc nv-kasikritc commented May 13, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

Adds NVIDIA NIM cloud request attribution so NVIDIA can track which app requests originate from. Hermes now sends X-BILLING-INVOKE-ORIGIN: HermesAgent on requests to https://integrate.api.nvidia.com/v1.

The header is host-gated to NVIDIA's cloud endpoint rather than added to the provider profile globally, preserving backwards compatibility for local and on-prem NIM deployments configured through NVIDIA_BASE_URL.

Related Issue

N/A

Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 🔒 Security fix
  • 📝 Documentation update
  • ✅ Tests (adding or improving test coverage)
  • ♻️ Refactor (no behavior change)
  • 🎯 New skill (bundled or hub)

Changes Made

  • Added cloud-scoped NVIDIA NIM billing-origin header construction in agent/auxiliary_client.py.
  • Applied the header through main agent client setup, provider-router clients, auxiliary clients, async client conversion, and base URL header refresh paths.
  • Preserved OpenAI SDK _custom_headers during routed-client rebuilds so provider attribution headers are not dropped.
  • Added tests covering NVIDIA cloud attribution, local NIM compatibility, provider profile scope, and routed-client header preservation.

How to Test

  1. Run python3 -m py_compile agent/auxiliary_client.py run_agent.py tests/run_agent/test_provider_attribution_headers.py tests/agent/test_auxiliary_client.py tests/providers/test_provider_profiles.py.
  2. Run uv run --frozen --extra dev pytest tests/run_agent/test_provider_attribution_headers.py tests/providers/test_provider_profiles.py tests/providers/test_e2e_wiring.py tests/agent/test_auxiliary_client.py -q.
  3. Confirm NVIDIA cloud clients include X-BILLING-INVOKE-ORIGIN: HermesAgent and local NVIDIA_BASE_URL clients do not.

Checklist

Code

  • I've read the Contributing Guide
  • My commit messages follow Conventional Commits (fix(scope):, feat(scope):, etc.)
  • I searched for existing PRs to make sure this isn't a duplicate
  • My PR contains only changes related to this fix/feature (no unrelated commits)
  • I've run pytest tests/ -q and all tests pass
  • I've added tests for my changes (required for bug fixes, strongly encouraged for features)
  • I've tested on my platform: macOS

Documentation & Housekeeping

  • I've updated relevant documentation (README, docs/, docstrings) — or N/A
  • I've updated cli-config.yaml.example if I added/changed config keys — or N/A
  • I've updated CONTRIBUTING.md or AGENTS.md if I changed architecture or workflows — or N/A
  • I've considered cross-platform impact (Windows, macOS) per the compatibility guide — or N/A
  • I've updated tool descriptions/schemas if I changed tool behavior — or N/A

For New Skills

N/A

Screenshots / Logs

Targeted test run:

215 passed in 23.00s

@alt-glitch alt-glitch added type/feature New feature or request P3 Low — cosmetic, nice to have comp/agent Core agent loop, run_agent.py, prompt builder provider/nvidia NVIDIA NIM labels May 13, 2026
@teknium1

Copy link
Copy Markdown
Contributor

Merged via #26585 (#26585). Your commit was cherry-picked onto current main with authorship preserved (@nv-kasikritc on commit 619dbac). Thanks for the contribution — and for the bonus catch on the routed-client _default_headers vs _custom_headers bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent loop, run_agent.py, prompt builder P3 Low — cosmetic, nice to have provider/nvidia NVIDIA NIM type/feature New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants