Metadata-Version: 2.4
Name: ddukddak
Version: 1.0.1
Summary: Python SDK for the Ddukddak image and video generation API
License-Expression: MIT
Project-URL: Homepage, https://ddukddak.studio
Project-URL: Documentation, https://ddukddak.studio/quick-start
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests>=2.20.0
Dynamic: license-file

# Ddukddak

Official Python SDK for the [Ddukddak](https://ddukddak.studio) image and video generation API.

## Installation

```bash
pip install ddukddak
```

## Quick Start

```python
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

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

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

### Authentication

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

### Account

```python
account = client.account.get()
```

### Templates

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

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

### Images

```python
# 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

```python
# 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

```python
# 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

```python
# 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

```python
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](LICENSE)
