openclaw - 💡(How to fix) Fix OpenRouter calls stamped as "pi" instead of "OpenClaw" — pi-coding-agent SDK overrides attribution module [2 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#71875Fetched 2026-04-26 05:07:13
View on GitHub
Comments
2
Participants
2
Timeline
3
Reactions
0
Timeline (top)
commented ×2closed ×1

OpenClaw ships a provider-attribution module that explicitly stamps X-OpenRouter-Title: OpenClaw on outbound OpenRouter requests and even flags those headers as protected from caller override. But on the wire, every OpenRouter request from openclaw-gateway is stamped as pi because the bundled @mariozechner/pi-coding-agent SDK injects its own attribution headers downstream of the policy layer.

Net effect: OpenClaw deployments show up as Mario Zechner's pi project on the OpenRouter app dashboard, not as OpenClaw.

Root Cause

OpenClaw ships a provider-attribution module that explicitly stamps X-OpenRouter-Title: OpenClaw on outbound OpenRouter requests and even flags those headers as protected from caller override. But on the wire, every OpenRouter request from openclaw-gateway is stamped as pi because the bundled @mariozechner/pi-coding-agent SDK injects its own attribution headers downstream of the policy layer.

Code Example

const OPENCLAW_ATTRIBUTION_PRODUCT = "OpenClaw";
function buildOpenRouterAttributionPolicy(env = process.env) {
  // ...
  return {
    headers: {
      "HTTP-Referer": "https://openclaw.ai",
      "X-OpenRouter-Title": identity.product,   // → "OpenClaw"
      "X-OpenRouter-Categories": "cli-agent",
    },
  };
}

---

const protectedAttributionKeys = new Set(
  Object.keys(policy.attributionHeaders ?? {}).map(/* ... */)
);

---

function getOpenRouterAttributionHeaders(model, settingsManager) {
  if (!isInstallTelemetryEnabled(settingsManager)) return undefined;
  if (model.provider !== "openrouter" &&
      !model.baseUrl.includes("openrouter.ai")) return undefined;
  return {
    "HTTP-Referer": "https://pi.dev",
    "X-OpenRouter-Title": "pi",
    "X-OpenRouter-Categories": "cli-agent",
  };
}
RAW_BUFFERClick to expand / collapse

Summary

OpenClaw ships a provider-attribution module that explicitly stamps X-OpenRouter-Title: OpenClaw on outbound OpenRouter requests and even flags those headers as protected from caller override. But on the wire, every OpenRouter request from openclaw-gateway is stamped as pi because the bundled @mariozechner/pi-coding-agent SDK injects its own attribution headers downstream of the policy layer.

Net effect: OpenClaw deployments show up as Mario Zechner's pi project on the OpenRouter app dashboard, not as OpenClaw.

Versions

  • OpenClaw: 2026.4.23
  • @mariozechner/pi-coding-agent: 0.70.0

Evidence

/app/dist/provider-attribution-DL72eDFq.js (OpenClaw build):

const OPENCLAW_ATTRIBUTION_PRODUCT = "OpenClaw";
function buildOpenRouterAttributionPolicy(env = process.env) {
  // ...
  return {
    headers: {
      "HTTP-Referer": "https://openclaw.ai",
      "X-OpenRouter-Title": identity.product,   // → "OpenClaw"
      "X-OpenRouter-Categories": "cli-agent",
    },
  };
}

/app/dist/provider-request-config-DhoLmkrG.js even marks these as protected so caller headers can't override them:

const protectedAttributionKeys = new Set(
  Object.keys(policy.attributionHeaders ?? {}).map(/* ... */)
);

But /app/node_modules/@mariozechner/pi-coding-agent/dist/core/sdk.js does this:

function getOpenRouterAttributionHeaders(model, settingsManager) {
  if (!isInstallTelemetryEnabled(settingsManager)) return undefined;
  if (model.provider !== "openrouter" &&
      !model.baseUrl.includes("openrouter.ai")) return undefined;
  return {
    "HTTP-Referer": "https://pi.dev",
    "X-OpenRouter-Title": "pi",
    "X-OpenRouter-Categories": "cli-agent",
  };
}

The pi-coding-agent SDK applies these outside OpenClaw's attribution-policy plumbing, so they win on the wire.

Reproduction

  1. Configure openclaw.json with an openrouter provider + any model (e.g. openrouter/xiaomi/mimo-v2-flash).
  2. Run any agent task.
  3. Check the OpenRouter dashboard → Activity → App column. Result: pi, not OpenClaw.

Suggested fixes

  1. Disable pi-coding-agent's attribution headers when running inside OpenClaw — set PI_TELEMETRY=0 in the gateway's env (the SDK already reads this env var to gate getOpenRouterAttributionHeaders). That returns undefined and lets OpenClaw's own attribution-policy layer apply its X-OpenRouter-Title: OpenClaw headers.
  2. Or override getOpenRouterAttributionHeaders at the integration point so OpenClaw's policy headers take precedence on OpenRouter requests.

Option (1) is a one-line env change.

extent analysis

TL;DR

Set PI_TELEMETRY=0 in the openclaw-gateway environment to prevent the pi-coding-agent SDK from overriding OpenClaw's attribution headers.

Guidance

  • Verify that the pi-coding-agent SDK is indeed the cause of the issue by checking the OpenRouter dashboard and seeing if the X-OpenRouter-Title header is being set to pi.
  • To mitigate the issue, set PI_TELEMETRY=0 in the openclaw-gateway environment, which will prevent the pi-coding-agent SDK from injecting its own attribution headers.
  • Alternatively, consider overriding the getOpenRouterAttributionHeaders function at the integration point to ensure OpenClaw's policy headers take precedence on OpenRouter requests.
  • Check the OpenRouter dashboard again after applying the fix to verify that the X-OpenRouter-Title header is now being set to OpenClaw.

Notes

The provided fix assumes that the pi-coding-agent SDK is the only culprit behind the overridden attribution headers. If other factors are at play, additional debugging may be necessary.

Recommendation

Apply workaround by setting PI_TELEMETRY=0 in the openclaw-gateway environment, as it is a simple and non-invasive solution that allows OpenClaw's attribution policy to take effect.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - 💡(How to fix) Fix OpenRouter calls stamped as "pi" instead of "OpenClaw" — pi-coding-agent SDK overrides attribution module [2 comments, 2 participants]