Skip to main content

Python SDK for the Ddukddak image and video generation API

Project description

Ddukddak

Official Python SDK for the Ddukddak image and video generation API.

Installation

pip install ddukddak

Quick Start

from ddukddak import Ddukddak

client = Ddukddak("your-api-key")

# Generate an image from a template
image = client.images.create(
    template="template-uid",
    properties={"title": "Hello World"},
)

print(image)

Usage

Initialize

client = Ddukddak("your-api-key")

# With custom options
client = Ddukddak(
    "your-api-key",
    base_url="https://api.ddukddak.studio/v1",
    timeout=30,
)

Authentication

# Verify your API key
result = client.auth.test()

Account

account = client.account.get()

Templates

# List templates
templates = client.templates.list(page=1, limit=25)

# Get a specific template
template = client.templates.get("template-uid")

Images

# Create an image
image = client.images.create(
    template="template-uid",
    properties={"title": "Sale Banner", "price": "$9.99"},
    transparent=False,
)

# Create and wait for completion
image = client.images.create_and_wait(
    template="template-uid",
    properties={"title": "Sale Banner"},
)

# List images
images = client.images.list(page=1, limit=25)

# Get a specific image
image = client.images.get("image-uid")

Videos

# Create a video
video = client.videos.create(
    template="template-uid",
    input_media_url="https://example.com/video.mp4",
    properties={"subtitle": "Hello"},
)

# Create and wait for completion
video = client.videos.create_and_wait(
    template="template-uid",
    input_media_url="https://example.com/video.mp4",
)

# List videos
videos = client.videos.list()

# Get a specific video
video = client.videos.get("video-uid")

AI Images

# Generate an AI image
image = client.ai_images.create(
    prompt="A sunset over the ocean",
    model="gemini",
    aspect_ratio="16:9",
)

# Generate and wait for completion
image = client.ai_images.create_and_wait(
    prompt="A sunset over the ocean",
)

AI Videos

# Generate an AI video
video = client.ai_videos.create(
    prompt="A cat walking on the beach",
    model="minimax",
    aspect_ratio="16:9",
    duration=5,
)

# Generate and wait for completion
video = client.ai_videos.create_and_wait(
    prompt="A cat walking on the beach",
)

Error Handling

from ddukddak import (
    Ddukddak,
    AuthenticationError,
    ValidationError,
    RateLimitError,
)

try:
    image = client.images.create(template="uid")
except AuthenticationError:
    # Invalid API key (401)
    pass
except ValidationError:
    # Bad request (400)
    pass
except RateLimitError:
    # Too many requests (429)
    pass

All exception classes:

Class Status Code Description
AuthenticationError 401 Invalid or missing API key
ValidationError 400 Invalid request parameters
QuotaExceededError 402 Usage quota exceeded
PlanRestrictedError 403 Feature not available on current plan
NotFoundError 404 Resource not found
RateLimitError 429 Rate limit exceeded
DdukddakError * Base exception class

Requirements

  • Python >= 3.8

License

MIT

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

ddukddak-1.0.1.tar.gz (4.9 kB view details)

Uploaded Source

Built Distribution

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

ddukddak-1.0.1-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for ddukddak-1.0.1.tar.gz
Algorithm Hash digest
SHA256 fe2298270d787915a8dc0a77362d879251f4b20dad113c027b6b988f9dc9f035
MD5 84336bc2f8c3d0b33b69d88e14dd5847
BLAKE2b-256 13939fe16a05973c6305857dd3a27796315cd1b480d2a121ffc5114196baa5c9

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for ddukddak-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 205a638d258afdef45504327ea90cd9131618b32966e9133a5000b4c0a0ae963
MD5 d7913515bbcc7029c91e40afa22e1d2f
BLAKE2b-256 2eb15b7be1e8771d53538a0276def860bba97e7e46e37cc5f903229ad39301b8

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