Metadata-Version: 2.1
Name: diffus
Version: 0.0.2
Summary: Diffus AI Image/Video generator python SDK
Author-email: Diffus <sdk@diffus.me>
Project-URL: homepage, https://www.diffus.me
Project-URL: repository, https://github.com/diffus-me/diffus-python-sdk
Keywords: diffus,ai,image,video,generation
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Multimedia :: Graphics
Classifier: Typing :: Typed
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: fal-client ==1.0.0

# Diffus Python SDK

`diffus` is a lightweight wrapper around the
[`fal-client`](https://pypi.org/project/fal-client/) Python SDK. It routes the
fal SDK interfaces to the [diffus.me](https://www.diffus.me) platform for AI
image and video generation.

## Installation

```bash
pip install diffus
```

## Authentication

Set your Diffus API key before the first API request. It can be set before or
after importing `diffus`.

```bash
export DIFFUS_KEY="YOUR_API_KEY"
```

You can also set it in Python before making a request:

```python
import os

os.environ["DIFFUS_KEY"] = "YOUR_API_KEY"
```

## Synchronous Usage

### Subscribe

Use `subscribe` to submit a generation request and wait for the final result.

```python
from diffus import fal_client


result = fal_client.subscribe(
    "diffus-ai/dreamshaper-8",
    arguments={
        "prompt": "A cinematic portrait of a dancing girl",
        "width": 768,
        "height": 512,
        "batch_size": 2,
    },
)

print(result)
```

### Upload

Use `upload_file` to upload a local file to Diffus Image Gallery.
It returns a URL that can be used as model input.

```python
from diffus import fal_client


image_url = fal_client.upload_file("input.jpg")

print(image_url)
```

## Asynchronous Usage

### Subscribe

Use `subscribe_async` in async applications.

```python
import asyncio

from diffus import fal_client


async def main():
    result = await fal_client.subscribe_async(
        "diffus-ai/dreamshaper-8",
        arguments={
            "prompt": "A cinematic portrait of a dancing girl",
            "width": 768,
            "height": 512,
            "batch_size": 2,
        },
    )

    print(result)


asyncio.run(main())
```

### Upload

Use `upload_file_async` to upload a local file from async code.

```python
import asyncio

from diffus import fal_client


async def main():
    image_url = await fal_client.upload_file_async("input.jpg")

    print(image_url)


asyncio.run(main())
```
