FakeKey - API Key Proxy Agent
In the era of AI Agents like Openclaw, ClaudeCode, etc., we have to expose various service API Tokens directly in environment variables. Your api_key will be inserted into context and known by model service providers, known by the lobsters you trust, perhaps captured and read by some skill, and even more likely to be directly learned by strangers asking your lobster. There are too many leak cases, I cannot trust to bind my credit card-linked api_key directly exposed to any Agent and local environment variables, so FakeKey was created, the safest measure is to never expose the real api_key.
FakeKey is a high-performance API key proxy program developed in Rust. Through intelligent proxy technology, it can automatically replace fake keys with real keys in any network request without exposing real credentials, while maintaining complete HTTP API compatibility and performance.
How It Works
┌─────────────────┐ ┌──────────────────────────┐ ┌─────────────────┐
│ Client Agent │ HTTP/S │ FakeKey Proxy │ HTTP/S │ External API │
│ │────────▶│ 1. TLS Decryption │────────▶ │ │
│ Uses fake key │ │ 2. Identify & replace key │ │ Receives real key│
│ sk-xxx_fk │ │ 3. Forward request │ │ sk-xxx │
└─────────────────┘ └──────────────────────────┘ └─────────────────┘
Quick Start
Installation
Quick Install (macOS / Linux)
|
Homebrew (macOS / Linux)
Cargo (from crates.io)
Build from Source
# Binary at: target/release/fakekey
Download Pre-built Binary
Pre-built binaries for all platforms are available on the GitHub Releases page:
| Platform | File |
|---|---|
| macOS (Apple Silicon) | fakekey-macos-arm64.tar.gz |
| macOS (Intel) | fakekey-macos-amd64.tar.gz |
| Linux (x86_64) | fakekey-linux-amd64.tar.gz |
| Linux (ARM64) | fakekey-linux-arm64.tar.gz |
| Windows (x86_64) | fakekey-windows-amd64.zip |
One-Click Initialization
During the process, you'll be prompted to trust the CA certificate. For first-time use, you need to add the CA certificate to the system trust list:
# macOS
# Linux
Basic Commands
# Generate OpenAI type fake KEY
# Generate fake KEY with custom header
# View available templates
# List all configured keys
# View specific key configuration
# Delete key configuration
# View proxy status
# Run in foreground
# Run in background (daemon mode)
# Stop proxy
# View logs
One-Click Tool Launch (Recommended)
FakeKey provides a convenient way to launch CLI tools with automatic proxy protection:
# Launch Claude Code with automatic proxy protection
# Launch OpenClaw with automatic proxy protection
# Pass additional arguments to the tool
This command automatically completes the following operations:
- Check if the proxy is running, start it automatically if not
- Set all necessary environment variables (HTTP_PROXY, HTTPS_PROXY, NODE_EXTRA_CA_CERTS, etc.)
- Launch the tool with proxy protection enabled
- All your API keys will be automatically protected!
Manual Proxy Configuration
If you prefer manual configuration:
- Replace real API keys with generated fake keys in your Agent or application
- Set the network proxy to
http://127.0.0.1:1155in your Agent or application
For example, first set the network proxy:
Then launch your Agent such as claude, openclaw, pi
Security
- Key Protection - Real keys are stored locally only, configuration files are automatically encrypted with CA private key (JSON format)
- Certificate Security - Locally generated CA certificates, private key file permissions 0600, also used for configuration encryption
- Network Security - Only listens on local 127.0.0.1, supports host whitelist
- Log Desensitization - Automatically hides sensitive information
- Audit Trail - All key operations are logged to audit logs
License
Apache License 2.0
Contributing
Issues and Pull Requests are welcome!