omp packages

pi-claude-disguise0.1.0

Make pi's Claude requests look like Claude Code: trim the pi-specific memory block that relay-side content moderation rejects with a ToS refusal.

jiwangrealabc Published 3 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

pi-claude-disguise

Make pi's Claude requests look like Claude Code: trim the pi-specific ## Memory block from the system prompt so relays that content-moderate it stop answering with a ToS refusal.

Some Claude relays forward requests to an upstream that runs Anthropic's content classifier. When the system prompt carries a large memory snapshot (durable facts, decisions, daily logs), that classifier can answer stop_reason: "refusal" with category: "frontier_llm" and the message "this may violate Anthropic's Terms of Service restrictions on developing competing model products" — even for a plain hi.

The request shape is not the problem: the same body replayed with curl is refused too, adding Claude Code headers, metadata.user_id, and Claude Code tool names changes nothing, and removing only that one section makes the same request succeed. This package does exactly that, scoped to the providers you name.

Install

pi install npm:pi-claude-disguise

Or try it without touching settings:

pi -e npm:pi-claude-disguise

Requires pi ≥ 1.7.0 and Node ≥ 22.19.

Configure

Optional ~/.pi/agent/pi-claude-disguise.json:

{
  "enabled": true,
  "providerPrefixes": ["daptokens-claude"],
  "markers": ["## Memory"],
  "trim": true
}
Field Default Description
enabled true Master switch
providerPrefixes ["daptokens-claude"] ctx.model.provider is matched with startsWith, so one entry covers daptokens-claude-H, daptokens-claude-M, …
markers ["## Memory"] Line prefixes that start the section to cut. First match wins
trim true Set false to stop rewriting (equivalent to enabled: false)

Environment overrides: PI_CLAUDE_DISGUISE_PREFIXES (comma separated), PI_CLAUDE_DISGUISE_MARKERS, PI_CLAUDE_DISGUISE_DISABLE=1.

A missing or malformed config falls back to defaults and reports a warning; it never breaks a request.

How it works

pi-memory appends its snapshot to the tail of the main system text block, not as a separate block. The guard therefore cuts each text block at the first \n## Memory line and drops blocks that become empty. Nothing else in the payload is touched: messages, tools, metadata, betas, and the other system blocks stay byte-identical, so prompt caching and other extensions keep working.

The rewrite only runs when a provider matches, so memory stays fully injected for every other model.

Verify

# Before: refused even for a trivial prompt
pi --model <provider>/<claude-model> -p "hi"

# After installing and setting providerPrefixes
pi --model <provider>/<claude-model> -p "hi"

To inspect the outgoing payload, point the provider at a local HTTP sink for one run; the second system block should end at </cwd> with no ## Memory after it.

Caveats

  • This only removes the memory section. If a relay refuses for another reason (model not entitled, key exhausted, region block), this package will not help — read the relay's error first.
  • The relay's classifier is not something this package inspects; if it starts flagging other prompt sections, extend markers or open an issue with the section that triggers it.

License

MIT