Skip to main content

cygn

Official Python SDK for the Cygn Enterprise API — deepfake detection, C2PA content signing, sonic watermarking, and voice ID.

Zero dependencies. Python 3.9+.

Installation

pip install cygn

Quick Start

from cygn import CygnEnterprise
import base64

cygn = CygnEnterprise(license_key="cygn_ent_xxxx")

# Camera capture: sign a photo at the moment it's taken
with open("photo.jpg", "rb") as f:
    image_b64 = base64.b64encode(f.read()).decode()

result = cygn.sign_image(
    image=image_b64,
    provenance="captured",
    app_name="MyDeliveryApp Camera",
)

# result.signed_image is a base64-encoded C2PA-signed JPEG

Authentication

Two methods:

# License Key (simpler)
cygn = CygnEnterprise(license_key="cygn_ent_xxxx")

# Cygn-Token (Ed25519 cryptographic identity)
cygn = CygnEnterprise(cygn_token="eyJhbGci...")

API Methods

Deepfake Detection

result = cygn.detect_deepfake(content=image_b64, media_type="image")
# result.score, result.verdict, result.signals

See your enterprise dashboard for current pricing.

C2PA Content Signing

result = cygn.sign_image(
    image=image_b64,
    provenance="captured",      # "captured" or "cygned"
    app_name="Zomato Camera",   # your app branding
    did="did:key:z6Mkv...",     # optional signer DID
)
# result.signed_image (base64), result.signed_at

See your enterprise dashboard for current pricing.

Provenance Bundle (Deepfake Detection + Signing)

result = cygn.provenance_bundle(
    image=image_b64,
    provenance="captured",
    app_name="Zomato Rider",
    did="did:key:z6Mkv...",
    display_name="Rider #4521",
)
# result.signed_image, result.deepfake.verdict, result.deepfake.score

See your enterprise dashboard for current pricing.

Sonic Watermarking

See your enterprise dashboard for current pricing.

Voice ID

See your enterprise dashboard for current pricing.

Usage & Balance

usage = cygn.get_usage()
# usage.balance (paise), usage.total_spent, usage.current_month

balance = cygn.get_balance()  # returns balance in paise

Error Handling

from cygn import CygnEnterprise, CygnAPIError

try:
    result = cygn.sign_image(image=image_b64)
except CygnAPIError as e:
    print(e.status)    # HTTP status code (e.g. 402)
    print(e.code)      # VALIDATION_ERROR, UNAUTHORIZED, INSUFFICIENT_BALANCE, etc.
    print(e.balance)   # remaining balance (if available)
    print(e.cost)      # operation cost (if available)
Status Code Meaning
400 VALIDATION_ERROR Invalid request body
401 UNAUTHORIZED Missing or invalid auth
402 INSUFFICIENT_BALANCE Top up required
403 FORBIDDEN Revoked or invalid license
413 FILE_TOO_LARGE Payload exceeds limit
415 UNSUPPORTED_MEDIA_TYPE Unsupported file format
429 RATE_LIMITED Too many requests
503 SERVICE_UNAVAILABLE Temporary outage

Use Case: Food Delivery Camera App

# Rider captures photo of delivered food
result = cygn.provenance_bundle(
    image=camera_capture_b64,
    provenance="captured",
    app_name="Zomato Rider",
    did="did:key:z6Mkv...",
    display_name="Rider #4521",
)

if result.deepfake.verdict == "likely_authentic":
    save_signed_photo(result.signed_image)

License

Apache-2.0

Download files

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

Source Distribution

cygn-1.0.1.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

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

cygn-1.0.1-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file cygn-1.0.1.tar.gz.

File metadata

  • Download URL: cygn-1.0.1.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for cygn-1.0.1.tar.gz
Algorithm Hash digest
SHA256 359e8841164382613e608e46d8328979e7eba1cbf549369e67f6b03722c8602c
MD5 fbdfe8954fdabe737871c7904431bb84
BLAKE2b-256 2b3f118036025184c738f33ff4c365f6b349728f6a37e16a4fceb9b827765697

See more details on using hashes here.

File details

Details for the file cygn-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: cygn-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for cygn-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 3134240c43708c3b0e65103c95b358ed510dc87f4fd6799e0b77ebb31441494e
MD5 4687f43672059779700cb2321815e3cc
BLAKE2b-256 1e7e4a48de312a4ca647e77d3cb80757d1cc1daed7145d6402769c7caea7735f

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 files

Supported by

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