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), 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.2.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.2.0
File Size Uploaded Provenance
vallkey-0.2.0.tar.gz 8.5 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 16.9 kB

Release files / vallkey-0.2.0.tar.gz

Download URL vallkey-0.2.0.tar.gz
Size 8.5 kB
Tags Source
SHA-256 checksum
How to use checksums
aa90435708c995dac0d248ef332256381488cd46d86a085d97f57119cf87b236
BLAKE2b-256 checksum
How to use checksums
5d59b0b1d617f8f65e025075da2f442b751dc62c160da6fc98a76c470a396f27
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL vallkey-0.2.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
126181e3cc21e739cc37d7592ec3ae7f3a9ae6c309d81bc292d9cd80d4981cd8
BLAKE2b-256 checksum
How to use checksums
99be16d4f3aa2bca85994c61c4888136f8192bc4de28a4c4966079633186a8bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

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