Skip to main content

llm-comply

中文 | English

PyPI CI Python License

Multi-format LLM API compliance testing tool — validates endpoints against official specs for OpenAI Chat Completions, Open Responses, Anthropic Messages, Google GenAI generateContent, and Google GenAI Interactions.

Try it online →

Install

pip install llm-comply
# For colored terminal output:
pip install llm-comply[rich]

Quick Start

# Open Responses (default)
llm-comply -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini

# OpenAI Chat Completions
llm-comply --format openai-chat -u https://api.openai.com/v1 -k $OPENAI_API_KEY -m gpt-4o-mini

# Anthropic Messages
llm-comply --format anthropic -u https://api.anthropic.com/v1 -k $KEY -m claude-haiku-4-5 \
  --auth-header x-api-key --no-bearer -H anthropic-version:2023-06-01

# Google GenAI — generateContent
llm-comply --format google-genai -u https://generativelanguage.googleapis.com -k $KEY \
  -m gemini-2.5-flash --auth-header x-goog-api-key --no-bearer

# Google GenAI — Interactions
llm-comply --format google-interactions -u https://generativelanguage.googleapis.com -k $KEY \
  -m gemini-2.5-flash --auth-header x-goog-api-key --no-bearer

Options

-u, --base-url URL     API base URL (required)
-k, --api-key KEY      API key (or set OPENRESPONSES_API_KEY env)
-m, --model MODEL      Model name (default: gpt-4o-mini)
--format FORMAT        API format: open-responses, openai-chat, anthropic,
                       google-genai, google-interactions
-f, --filter IDS       Comma-separated test IDs to run
-i, --ignore PATTERNS  Ignore errors matching substrings (e.g. refusal,verbosity)
-H, --header K:V       Extra headers (e.g. anthropic-version:2023-06-01)
--auth-header NAME     Auth header name (default: Authorization)
--no-bearer            Don't prepend "Bearer " to API key
-v, --verbose          Show request/response on failure
--json                 JSON output for CI
--list                 List available test IDs

Docker

docker run -p 8090:8090 oaklight/llm-comply:latest

Reference compose.yaml for production deployment:

services:
  llm-comply:
    image: oaklight/llm-comply:latest
    container_name: llm-comply
    restart: unless-stopped
    ports:
      - 127.0.0.1:8090:8090
    read_only: true
    tmpfs:
      - /tmp:size=64m,exec
    security_opt:
      - no-new-privileges:true
    cap_drop:
      - ALL
    mem_limit: 256m
    cpus: 0.5

Note: The binary image uses Nuitka onefile format, which extracts to /tmp at startup. The tmpfs mount with exec is required when using read_only: true.

Test Coverage

Format Tests What's Validated
Open Responses 13 Schema + semantic (lifecycle, phases, compaction, thinking)
OpenAI Chat 8 Schema + semantic (choices, finish_reason, delta)
Anthropic Messages 9 Schema + semantic (content blocks, stop_reason, thinking)
Google GenAI generateContent 9 Semantic only (candidates, parts, finishReason, thinking)
Google GenAI Interactions 9 Semantic only (steps, model_output, thinking)

License

MIT

Metadata

Release files for llm-comply 0.5.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 llm-comply 0.5.0
File Size Uploaded
llm_comply-0.5.0.tar.gz 432.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for llm-comply 0.5.0
File Interpreter ABI Platform
llm_comply-0.5.0-py3-none-any.whl Python 3 none any Details

Total release size: 878.1 kB

Release files / llm_comply-0.5.0.tar.gz

Download URL llm_comply-0.5.0.tar.gz
Size 432.4 kB
Tags Source
SHA-256 checksum
How to use checksums
72813ab2d9b69e0197dbce7028c83bd8b7864d2da4ea07de5dfb68e8881bc029
BLAKE2b-256 checksum
How to use checksums
d50babcd83243da24699bda0f4125d30ddc110c5f6f274d0a219be1e39e53eaa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release files / llm_comply-0.5.0-py3-none-any.whl

Download URL llm_comply-0.5.0-py3-none-any.whl
Size 445.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a9e2442915d233087b30abcb38bd4333d5878ae0e7c80b0d93e8b9f006843e9b
BLAKE2b-256 checksum
How to use checksums
9881195f3fc977d02f627e012ea19d8f9efa86ea6aecbf3c3b307c0678d3f0a3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 12, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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