Skip to main content

Module attribution

Module attribution 

Source
Expand description

Provider attribution headers.

Port of native Pi’s packages/coding-agent/src/core/provider-attribution.ts. Some providers want to know which app is calling them (for their own dashboards/quotas). Native pi attaches a small set of app-identifying headers for OpenRouter, NVIDIA NIM, and Cloudflare, plus a session header for opencode. This module reproduces that mapping.

Functions§

default_attribution_headers
The app-identifying headers for model (native getDefaultAttributionHeaders).
enabled
Attribution is enabled unless RPI_DISABLE_ATTRIBUTION=1 (native gates this on install telemetry).
merge_provider_attribution_headers
Merge session + attribution headers with caller-supplied sources (later wins), matching native mergeProviderAttributionHeaders.
session_headers
opencode session headers (native getSessionHeaders).