909c8b1894
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.
50 lines
999 B
Nix
50 lines
999 B
Nix
{
|
|
description = "Anthropic API proxy with OAuth key rotation";
|
|
|
|
inputs = {
|
|
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
|
|
flake-utils.url = "github:numtide/flake-utils";
|
|
};
|
|
|
|
outputs =
|
|
{
|
|
self,
|
|
nixpkgs,
|
|
flake-utils,
|
|
}:
|
|
flake-utils.lib.eachDefaultSystem (
|
|
system:
|
|
let
|
|
pkgs = import nixpkgs {
|
|
inherit system;
|
|
config.allowUnfreePredicate =
|
|
pkg:
|
|
builtins.elem (pkgs.lib.getName pkg) [
|
|
"claude-code"
|
|
];
|
|
};
|
|
in
|
|
{
|
|
devShells.default = pkgs.mkShell {
|
|
buildInputs = with pkgs; [
|
|
go
|
|
gopls
|
|
gotools
|
|
go-tools
|
|
delve
|
|
curl
|
|
jq
|
|
claude-code
|
|
opencode
|
|
mitmproxy
|
|
];
|
|
|
|
shellHook = ''
|
|
export GOPATH="$PWD/.go"
|
|
export PATH="$GOPATH/bin:$PATH"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|