@eissar/pi-openrouter-session

highly minimal extension to send pi agent session ID to OpenRouter

Packages

Package details

extension

Install @eissar/pi-openrouter-session from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:@eissar/pi-openrouter-session
Package
@eissar/pi-openrouter-session
Version
0.1.3
Published
May 14, 2026
Downloads
not available
Author
eissar
License
Unlicense
Types
extension
Size
2.6 KB
Dependencies
0 dependencies · 1 peer
Pi manifest JSON
{
  "extensions": [
    "./src/index.ts"
  ]
}

Security note

Pi packages can execute code and influence agent behavior. Review the source before installing third-party packages.

README

pi-openrouter-session

npm version License: Unlicense

Injects the current Pi session ID as session_id into every OpenRouter provider request.

OpenRouter can use this to correlate sessions across requests for analytics, debugging, or per-session rate limiting.

Install

pi install npm:@eissar/pi-openrouter-session

Then /reload in Pi (or restart).

How It Works

This Pi extension listens for the before_provider_request event and patches the outgoing request payload with the current Pi session ID (session_id). The session ID is obtained from ctx.sessionManager.getSessionId().

OpenRouter receives the session_id field and can use it to group related requests — useful for tracking conversation flows, debugging API usage, or applying per-session rate limits. you can read about how openrouter handles that here: https://openrouter.ai/docs/guides/features/broadcast/overview#optional-trace-data

Source

Install from GitHub directly:

pi install git:github.com/eissar/pi-openrouter-session

License

Unlicense — public domain.