ZeroShot SDK - AI System Testing CLI and Client Library
Project description
ZeroShot SDK
Official SDK for ZeroShot — AI Security Testing Platform.
Installation
pip install zeroshot-sdk
Quick Start
Benchmark (local, no API key needed)
Run a security benchmark against any AI target entirely on your machine:
# Against a local endpoint
zeroshot benchmark --target http://localhost:8000/chat
# Against OpenAI
zeroshot benchmark --target openai --model gpt-4o --api-key sk-...
# Against Ollama
zeroshot benchmark --target ollama --model llama3
# Against LM Studio
zeroshot benchmark --target lmstudio --model qwen2.5:7b
# Against Anthropic
zeroshot benchmark --target anthropic --api-key sk-ant-...
# Filter categories, limit attacks
zeroshot benchmark --target http://localhost:8000/chat --categories jailbreak,prompt_injection --max-attacks 20
# HTML report
zeroshot benchmark --target ollama --model llama3 --format md,json,html
# List available corpora
zeroshot benchmark-list
Cloud Scans (requires API key)
# Login (stores API key locally)
zeroshot auth login
# Run a scan via the ZeroShot backend
zeroshot scan --target http://localhost:8000/chat
# View results
zeroshot scans list
Python Usage
Benchmark
import asyncio
from zeroshot_sdk import BenchmarkRunner, BenchmarkReport
async def main():
runner = BenchmarkRunner(
"http://localhost:8000/chat",
api_format="openai",
concurrency=5,
)
result = await runner.run("v1")
print(f"Security Score: {result.security_score}%")
print(f"Risk Score: {result.risk_score}/100")
print(f"Attacks Refused: {result.attacks_refused}/{result.total_attacks}")
# Generate reports
report = BenchmarkReport(result)
report.save("./reports", formats=["md", "json", "html"])
asyncio.run(main())
Cloud Client
from zeroshot_sdk import ZeroShotClient
client = ZeroShotClient(api_key="zsk_...")
result = client.scan(
target="http://localhost:8000/chat",
categories=["jailbreak", "prompt_injection"],
)
print(f"Found {result['vulnerabilities_found']} vulnerabilities")
CLI Commands
| Command | Description |
|---|---|
zeroshot benchmark |
Run a local security benchmark |
zeroshot benchmark-list |
List available corpus versions |
zeroshot scan |
Run a cloud scan (requires API key) |
zeroshot scans list |
List recent cloud scans |
zeroshot scans show <id> |
Show scan details |
zeroshot report <id> |
Generate report for a scan |
zeroshot mutate |
Apply prompt mutations |
zeroshot check-refusal |
Classify refusal responses |
zeroshot pii scan |
Scan text for PII |
zeroshot auth login |
Store API key |
zeroshot account |
Show account info |
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
zeroshot_sdk-0.0.3.tar.gz
(139.3 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zeroshot_sdk-0.0.3.tar.gz.
File metadata
- Download URL: zeroshot_sdk-0.0.3.tar.gz
- Upload date:
- Size: 139.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
afddaf5e9293028515b92f9d578443574463d59b8dcaa1cf67e29d0f4e4862cd
|
|
| MD5 |
0fe704e16292563e7e550f02f5aa8215
|
|
| BLAKE2b-256 |
cd0944f6a0e13ebda986288e7413f0d773ce2cc3d81aefb230acad32c5b8f81b
|
File details
Details for the file zeroshot_sdk-0.0.3-py3-none-any.whl.
File metadata
- Download URL: zeroshot_sdk-0.0.3-py3-none-any.whl
- Upload date:
- Size: 38.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.8 {"installer":{"name":"uv","version":"0.10.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c612418bd3390470554246ce81a0fff2c9e012be47826f93601f22a5a6a74dd1
|
|
| MD5 |
2c2dace8dd5aeb6a417e86712dfc5f85
|
|
| BLAKE2b-256 |
d44b439687f12cc13ba49db2b8a606f07a9ff5a56190588d94526ba149893b66
|