Skip to main content

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.4.tar.gz (138.8 kB view details)

Uploaded Source

Built Distribution

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

zeroshot_sdk-0.0.4-py3-none-any.whl (37.5 kB view details)

Uploaded Python 3

File details

Details for the file zeroshot_sdk-0.0.4.tar.gz.

File metadata

  • Download URL: zeroshot_sdk-0.0.4.tar.gz
  • Upload date:
  • Size: 138.8 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

Hashes for zeroshot_sdk-0.0.4.tar.gz
Algorithm Hash digest
SHA256 739e01e6af849c291bafc6ba5f55806dc6a6cc1eb0e60b6fe0e0dbacf6ee6268
MD5 99ecb4ccd093db50d933783516a2c4b8
BLAKE2b-256 2b25f365752e5d93b67fce3cee21ee062fd9f6e62fd6b35d3ea82b69323a9cb8

See more details on using hashes here.

File details

Details for the file zeroshot_sdk-0.0.4-py3-none-any.whl.

File metadata

  • Download URL: zeroshot_sdk-0.0.4-py3-none-any.whl
  • Upload date:
  • Size: 37.5 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

Hashes for zeroshot_sdk-0.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 37ca07a21ecdbe8787b4ec32fbfb96d0965f9b23ca14d12ef3c8a3d577e2e64b
MD5 7aeca1dfef3b0baf4783e4f212942d9e
BLAKE2b-256 e4e9efebe2e17ce14125dcb84e9e6751c85fe8092b16646fc2d61ae6cf0c994f

See more details on using hashes here.

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