c4c1d4daa4
Sniffs a real Claude Code request on startup to capture exact HTTP headers, then replays them for all proxied requests. Injects the billing header with per-request SHA256 fingerprint into the system prompt. Uses utls with Chrome TLS fingerprint to pass Cloudflare's bot detection on api.anthropic.com. Supports both streaming (SSE) and non-streaming modes, round-robin credential selection with automatic failover, and loading OAuth tokens from both cli-proxy-api auth files and native ~/.claude/.credentials.json.
48 lines
956 B
Nix
48 lines
956 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
|
|
];
|
|
|
|
shellHook = ''
|
|
export GOPATH="$PWD/.go"
|
|
export PATH="$GOPATH/bin:$PATH"
|
|
'';
|
|
};
|
|
}
|
|
);
|
|
}
|