Skip to main content

Identify and validate API keys for OpenAI, Anthropic, Gemini, and more with privacy-first masking.

Project description

apikey-inspector 🔍

One package, zero fluff, maximum insight.

apikey-inspector is a universal, privacy-first API key inspector. It allows you to identify, validate, and inspect API keys from major AI providers without risking leakage.

PyPI version License: MIT


✨ Features

  • 🔒 Privacy-First: Pure regex detection before any network calls.
  • 🎭 Auto-Masking: Sensitive keys are always masked in terminal output and redacted in JSON.
  • 🚀 Async-First: Batch inspect hundreds of keys concurrently with per-provider rate-limiting.
  • 📡 Deep Inspection: Fetches available models, usage, costs, and rate limits where available.
  • 🛠️ CI/CD Ready: Exit codes optimized for security pipelines (--scan flag).

📦 Supported Providers

Provider Key Detection Validation Usage/Costs Models List
OpenAI
Anthropic 🚧
Google Gemini 🚧
HuggingFace
Cohere 🚧

🚀 Quick Start

Installation

pip install apikey-inspector

Usage

# Basic inspection (masks key automatically)
apikey inspect sk-proj-1234...

# Offline mode (detection only, no network calls)
apikey inspect sk-proj-1234... --offline

# Batch inspection from a file or stdin
cat keys.txt | apikey inspect --json > results.json

# Security scanning mode (exit 1 if valid keys are found)
apikey inspect sk-proj-1234... --scan

🛠️ CLI Reference

Option Description
inspect [KEY] The main command to inspect a key.
--offline Skip network checks, only perform local regex detection.
--json Output raw JSON instead of the rich table.
--no-redact Disable automatic redaction of secrets in JSON output.
--from-env VAR Read the API key from an environment variable.
--scan Return exit code 1 if any valid keys are detected (for CI).
version Show the current version.

🧪 Development & Testing

# Clone the repo
git clone https://github.com/AliHaSSan-13/apikey-inspector.git
cd apikey-inspector

# Install in editable mode with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest tests/

📜 License

MIT © Ali Hassan

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

apikey_inspector-0.1.0.4.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

apikey_inspector-0.1.0.4-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file apikey_inspector-0.1.0.4.tar.gz.

File metadata

  • Download URL: apikey_inspector-0.1.0.4.tar.gz
  • Upload date:
  • Size: 10.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for apikey_inspector-0.1.0.4.tar.gz
Algorithm Hash digest
SHA256 9cdcc98d48eb555cbf29f26cb0215c73263c159222efff5750b31554c77e5bff
MD5 6eeb945fb06ae0c233cf057cdc780ab5
BLAKE2b-256 8198d268e6651f6a8fb610b9c9c02a5161e2f5cb8dcf67fe61b760de52976103

See more details on using hashes here.

Provenance

The following attestation bundles were made for apikey_inspector-0.1.0.4.tar.gz:

Publisher: pypi-publish.yml on AliHaSSan-13/apikey-inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file apikey_inspector-0.1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for apikey_inspector-0.1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 264722d560e50eb5a639765c17237085cb914ddc8614c6664b93043066da7b00
MD5 19e7c1db14d8ba1bb45b4d02d6df3e56
BLAKE2b-256 e2f19a67d944185831e24fbc3dd52df58fd0487a15e0bd30798c255244f4ca01

See more details on using hashes here.

Provenance

The following attestation bundles were made for apikey_inspector-0.1.0.4-py3-none-any.whl:

Publisher: pypi-publish.yml on AliHaSSan-13/apikey-inspector

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page