OpenCode Plugin
nexus-attribution-headers
v1.0.0PublishedInjects x-nexus-session-id / x-nexus-primary-slot / x-nexus-actor-slug attribution headers on outgoing requests to the Nexus gateway provider.
Overview
The Nexus gateway records model_usage_events / route_decision_events for cost and routing analytics, but session and actor attribution were entirely missing (null on every gateway row) because nothing on the OpenCode side emitted the headers the gateway was built to read. This plugin closes that gap via the chat.headers hook, which fires immediately before a chat completion request is sent: it attaches x-nexus-session-id always, x-nexus-primary-slot for the nexus-plan/nexus-act/nexus-review primary agents, and x-nexus-actor-slug verbatim for every other agent (including OpenCode's own internal calls). Attribution-only; never used for routing or authentication on the gateway side. Scoped exclusively to requests where the provider id is nexus; every other provider is left untouched.
Registered Hooks
Events this plugin listens to in the OpenCode runtime.
chat.headersThe only hook this plugin implements: it fires immediately before an outgoing chat completion request and injects the attribution headers directly into it.