pi-vibe-attribution

Attribute pi's Mistral requests to your Vibe plan, the way Vibe does

Packages

Package details

extension

Install pi-vibe-attribution from npm and Pi will load the resources declared by the package manifest.

$ pi install npm:pi-vibe-attribution
Package
pi-vibe-attribution
Version
0.1.1
Published
Dec 6, 2026
Downloads
not available
Author
randomblock1
License
MIT
Types
extension
Size
28.2 KB
Dependencies
0 dependencies · 2 peers
Pi manifest JSON
{
  "extensions": [
    "./extensions/vibe-attribution.ts"
  ]
}

Security note

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

README

pi-vibe-attribution

A pi package that makes pi's Mistral requests carry the same attribution as the Vibe CLI, so they draw from the Vibe/Monthly Plan allowance instead of the Included API one. It also tells Pi that it's using a subscription.

Mistral decides which allowance a chat completion draws from by the request body, not the header. Measured on a real Vibe subscription:

body metadata billed to
{"call_source": "vibe_code"} — any User-Agent Monthly Plan
{"call_type": "main_call"} — any User-Agent Monthly Plan
{"call_source": "api"} Included API
absent, or unknown keys Included API
any User-Agent alone, no metadata Included API

The metadata is what actually decides how the request is billed. This package uses Vibe's own field set, and leaves everything else to the provider pi already has configured — no second login, no separate provider, no duplicated model catalog.

Install

pi install npm:pi-vibe-attribution
pi install git:github.com/Randomblock1/pi-vibe-attribution
pi -e npm:pi-vibe-attribution     # try it without changing settings

Mistral models keep working as they are: the extension decorates the mistral provider in place, whatever you authenticate it with.

What a request carries

User-Agent                  mistral-client-python/Mistral-Vibe/3.2.0
x-affinity                  the session id (Vibe routes prompt-cache affinity on it)
metadata.os                 darwin | windows | linux      arch: os.arch()
metadata.os_version         product version (macOS SystemVersion plist)
metadata.version            Vibe version, same as agent_version and client_version
metadata.session_id         Vibe's uuid-shaped id, derived from pi's session id
metadata.message_id         one per user run: rs-<epoch nanos in hex> for the TUI,
                            user-turn-<turn hex>-<n> for the programmatic entrypoint
metadata.call_type          main_call for a run's first request, secondary_call after
metadata.call_source        vibe_code                     host_kind: local
metadata.agent_entrypoint &
metadata.client_name        follow pi's mode:
                                tui   -> cli        / vibe_rs
                                print -> programmatic / vibe_programmatic
                                json  -> programmatic / vibe_programmatic
                                rpc   -> acp        / vibe_acp
metadata.terminal_emulator  port of Vibe's cli-rust terminal detection
temperature                 always sent (Vibe's model default, 1.0)
max_tokens                  when different from the default
parallel_tool_calls         true when tools are sent

Commands

/vibe-ua            show state and the generated headers
/vibe-ua off        stop rewriting until re-enabled or the process exits
/vibe-ua on         resume

Environment variables

variable purpose
PI_VIBE_VERSION Vibe version stamped into the UA and metadata (default 3.2.0)
PI_VIBE_DEBUG append one JSON line per attributed request (path, or any value for ~/.pi/agent/vibe-attribution.log)

What is not mirrored

  • user_plan: Vibe fills it from the account panel, asynchronously and often absent. Guessing it would be worse than omitting it.
  • GrowthBook experiments / experiment_attributes: carried by telemetry events, never by a completion's metadata.
  • Transport and content shape: pi's fetch adds accept-language and sec-fetch-mode, and pi encodes content blocks, tool calls, and images its own way. Matching those means owning the HTTP client and every message encoder; this package deliberately does not.