Add request sanitizer, background token refresh, and OpenCode support
Sanitizer renames tool names and replaces system prompt patterns that Anthropic fingerprints to detect non-Claude-Code clients. Lowercase tool names (bash, read, glob, etc.) combined together trigger rejection — renaming to PascalCase bypasses this. Configurable via YAML sanitize rules for tools, system, and body. Background OAuth token refresh every 30s with 5-minute pre-expiry lead. Uses Chrome TLS fingerprint for refresh endpoint too. Adds /messages route (without /v1 prefix) for OpenCode compat.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
port: 8082
|
||||
api_keys:
|
||||
- "your-proxy-api-key"
|
||||
auth_dir: ""
|
||||
claude_credentials: "~/.claude/.credentials.json"
|
||||
claude_binary: "claude"
|
||||
|
||||
sanitize:
|
||||
tools:
|
||||
- from: "bash"
|
||||
to: "Bash"
|
||||
- from: "read"
|
||||
to: "Read"
|
||||
- from: "glob"
|
||||
to: "Glob"
|
||||
- from: "grep"
|
||||
to: "Grep"
|
||||
- from: "edit"
|
||||
to: "Edit"
|
||||
- from: "write"
|
||||
to: "Write"
|
||||
- from: "webfetch"
|
||||
to: "WebFetch"
|
||||
- from: "skill"
|
||||
to: "Skill"
|
||||
- from: "todowrite"
|
||||
to: "TodoWrite"
|
||||
system:
|
||||
- match: "Workspace root folder"
|
||||
replace: "Working directory"
|
||||
- match: "anomalyco/opencode"
|
||||
replace: "anthropics/claude-code"
|
||||
Reference in New Issue
Block a user