Skip to main content

vallkey

Send any Python SDK through Vallkey with no code changes.

Vallkey gives you ghost keys: stand-in API keys that only work within your rules, and that you can kill in one click. This package sends every request that carries a ghost key to Vallkey instead of the provider, with the same path, so you do not need to set a base URL in any SDK. Requests without a ghost key are not touched.

pip install vallkey

Then either set an environment variable, with no change to your code:

VALLKEY_AUTO=1 python app.py

or import it once, anywhere in your code:

import vallkey.auto

Put your ghost key where the real key was (for example OPENAI_API_KEY=gk_openai_...) and use the SDK as usual:

from openai import OpenAI

client = OpenAI()  # no base_url needed

It covers httpx and httpx2 (OpenAI, Anthropic and most new SDKs), requests (Stripe, Twilio and most others), urllib3 on its own (SDKs generated by OpenAPI Generator), botocore (boto3, including S3 buckets named in the address), aiohttp and urllib. Libraries imported later are covered too, so the order of imports does not matter.

Variable
VALLKEY_AUTO=1 Turns it on when Python starts, without an import
VALLKEY_API The Vallkey server, if not https://api.vallkey.com
VALLKEY_DEBUG=1 Logs each request sent to Vallkey (never the key)

To set up ghost keys from your .env files, use the command line tool: npx vallkey init.

Docs: https://vallkey.com/docs/python/

Web pages and mobile apps (short-lived keys)

Keep the ghost key on your server, and give each signed-in user a short-lived key instead. It expires in minutes and can only do what the ghost key allows.

from vallkey.session import create_session_key  # reads VALLKEY_GHOST_KEY

key = create_session_key(user=user.id, ttl_seconds=900)["session_key"]
# send key to the page or app

See https://vallkey.com/docs/browsers/.

Metadata

Release files for vallkey 0.3.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for vallkey 0.3.0
File Size Uploaded Provenance Actions
vallkey-0.3.0.tar.gz 10.5 kB Without provenance Details for vallkey-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for vallkey 0.3.0
File Interpreter ABI Platform Actions
vallkey-0.3.0-py3-none-any.whl Python 3 none any Details for vallkey-0.3.0-py3-none-any.whl

Total release size: 20.3 kB

Release files / vallkey-0.3.0.tar.gz

Download URL vallkey-0.3.0.tar.gz
Size 10.5 kB
Tags Source
SHA-256 checksum
How to use checksums
16e21d21a85ae94d79d6ca4e45769b13c90d34c8f4b67ff029de9646193913ee
BLAKE2b-256 checksum
How to use checksums
ae1085b2e5cf4036567978393872a2d5b6005441c18623d6cedd2ed4992a07ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / vallkey-0.3.0-py3-none-any.whl

Download URL vallkey-0.3.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
00a89136d7229791e6b652dc57f0ed575d96baec4a4f895bd0dad8d1c5a51ba6
BLAKE2b-256 checksum
How to use checksums
47680f9f1c7b5a937da357a7ceebe1006104f96283d16a3eb89e7a53d5695a26
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Security for vallkey 0.3.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page