Metadata-Version: 2.4
Name: apikey-inspector
Version: 0.1.0.4
Summary: Identify and validate API keys for OpenAI, Anthropic, Gemini, and more with privacy-first masking.
Project-URL: Homepage, https://github.com/AliHaSSan-13/apikey-inspector
Project-URL: Repository, https://github.com/AliHaSSan-13/apikey-inspector
Project-URL: Issues, https://github.com/AliHaSSan-13/apikey-inspector/issues
Author-email: Ali Hassan <alihassan.shahzadmughal@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: anthropic,api-key,automation,devsecops,gemini,openai,secret-detection,security-scanner,validation
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.9
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.9.0
Provides-Extra: dev
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.21.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# 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](https://img.shields.io/pypi/v/apikey-inspector)](https://pypi.org/project/apikey-inspector/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/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

```bash
pip install apikey-inspector
```

### Usage

```bash
# 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

```bash
# 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](mailto:alihassan.shahzadmughal@gmail.com)

