UplinkSwitch runtime hooks
Route existing OpenAI and Anthropic SDK calls through UplinkSwitch without editing application code. The hooks intercept api.openai.com and api.anthropic.com, preserve methods, bodies and other headers, and replace the authentication headers with your destination key. Both packages have no runtime dependencies.
Node.js 18+
npm i -D @uplinkswitch/hook
export UPLINKSWITCH_API_KEY="your-key"
export NODE_OPTIONS="-r @uplinkswitch/hook/register"
node app.js
The hook must be installed in the runtime environment, including when production installs omit development dependencies. It covers global fetch and Node's http/https request/get APIs. Independently imported HTTP implementations are outside its scope.
Python 3.9+
pip install uplinkswitch-hook
export UPLINKSWITCH_API_KEY="your-key"
python app.py
The installed wheel includes a startup .pth file. Normal interpreter startup activates routing for httpx, httpx2 and requests, including the standard OpenAI and Anthropic clients. Install the wheel in the same environment that runs your application. Python's -S option disables site initialization and automatic activation. Existing httpx clients created before manual install() are not changed.
Configuration
| Variable | Meaning |
|---|---|
UPLINKSWITCH_API_KEY |
Required destination key. Unset means no interception. |
UPLINKSWITCH_BASE_URL |
Destination base URL; defaults to https://api.uplinkswitch.com/v1. Trailing slashes are removed. |
UPLINKSWITCH_INTERCEPT_HOSTS |
Comma-separated additional hostnames to intercept. |
If the destination base path ends in /v1, the original leading /v1 is removed before joining paths. Existing authorization and x-api-key headers are replaced; when neither exists, both are added. Unrelated requests continue unchanged. Set environment variables before startup; installation is idempotent. Each active process prints one destination-host activation line to stderr. Node also prints one line when its key is unset.
Docker
ENV NODE_OPTIONS="-r @uplinkswitch/hook/register" UPLINKSWITCH_API_KEY=""
# Supply UPLINKSWITCH_API_KEY at runtime using your secret manager.
CMD ["node", "app.js"]
Sister brands
Use the chosen brand's API key and either base URL:
export UPLINKSWITCH_BASE_URL="https://api.pentestllm.ai/v1"
export UPLINKSWITCH_API_KEY="your-pentestllm-key"
# Or:
export UPLINKSWITCH_BASE_URL="https://api.uncensoredllm.ai/v1"
export UPLINKSWITCH_API_KEY="your-uncensoredllm-key"
The hooks collect no telemetry: no request content or keys are logged, and intercepted requests are sent only to the configured base URL. The single activation line contains the destination host. Unrelated traffic retains its original destination; HTTP clients retain their normal redirect behavior.
Development
Run npm ci && node --test in packages/node-hook. In packages/python-hook, create a venv with python3 -m venv .venv, install .[test], build, and twine, build with python -m build, install the resulting wheel, and run python -I -m pytest. Tests use only a local HTTP server and fake keys.
MIT — Uplink Switch LLC.
Metadata
Release files for uplinkswitch-hook 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| uplinkswitch_hook-0.1.0.tar.gz | 5.2 kB | Without provenance | Details for uplinkswitch_hook-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| uplinkswitch_hook-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for uplinkswitch_hook-0.1.0-py3-none-any.whl |
Total release size: 10.0 kB
Release files / uplinkswitch_hook-0.1.0.tar.gz
| Download URL | uplinkswitch_hook-0.1.0.tar.gz |
|---|---|
| Size | 5.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1136b394d611f2c87648eac3426d80d6bd5ebf3deb0e75a45dd3318fbc3a1e57
|
|
BLAKE2b-256 checksum How to use checksums |
65d7e05c63dec9dd6d59295edf44824d6922b7cfed29582e387cc7a8948f100d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Release files / uplinkswitch_hook-0.1.0-py3-none-any.whl
| Download URL | uplinkswitch_hook-0.1.0-py3-none-any.whl |
|---|---|
| Size | 4.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
e071c1fa10f642142751dc28a84a090e888f0a519bf192dde2db775b8e75f945
|
|
BLAKE2b-256 checksum How to use checksums |
3f17785a34b9673f284e68a73d8fd415b4e55fca6d7f3bf42bb744a91d204165
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.6
|
Security for uplinkswitch-hook 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.