Skip to main content

OpenPixels Python SDK

A Python SDK for accessing the OpenPixels API.

Installation

pip install openpixels
# or with uv
uv pip install openpixels

Usage

from openpixels import OpenPixels

client = OpenPixels(
    api_key="sk-op-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)

# Generate an image
def generate_image():
    result = client.run(
        model="flux-dev",
        prompt="a cat"
    )
    
    print(result)

generate_image()

The SDK provides both synchronous and asynchronous clients. The asynchronous client is preferable for most applications, especially those handling multiple requests or running in async environments like FastAPI.

Async Client Usage

from openpixels import AsyncOpenPixels
import asyncio

client = AsyncOpenPixels(
	api_key="sk-op-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
)

async def generate_image_async():
    result = await client.run(
        model="flux-dev",
        prompt="a cat"
    )
    
    print(result)

# Run the async function
asyncio.run(generate_image_async())

API Reference

OpenPixels

The synchronous client for making calls to the OpenPixels API.

client = OpenPixels(
    api_key="YOUR_API_KEY",
    base_url="https://worker.openpixels.ai"  # Optional, defaults to production API
)

AsyncOpenPixels

The asynchronous client for making calls to the OpenPixels API. This is generally preferred for better performance and responsiveness.

client = AsyncOpenPixels(
    api_key="YOUR_API_KEY",
    base_url="https://worker.openpixels.ai"  # Optional, defaults to production API
)

Methods

Both clients provide the following methods:

  • run(payload): Submits a job and waits for the result.

Development

Building the Package

This project uses uv for package management and building:

# Install development dependencies
uv pip install -e ".[dev]"

# Run tests
pytest

# Build the package
uv build

Deploying a New Version

  1. Update the version in pyproject.toml
  2. Remove the dists folder: rm -rf dist
  3. Build the distribution packages:
    uv build
    
  4. Upload to PyPI using twine:
    python3 -m twine upload dist/*
    
  5. git tag vX.Y.Z
  6. git push origin vX.Y.Z

License

MIT

Metadata

Release files for openpixels 0.3.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openpixels 0.3.1
File Size Uploaded
openpixels-0.3.1.tar.gz 5.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openpixels 0.3.1
File Interpreter ABI Platform
openpixels-0.3.1-py3-none-any.whl Python 3 none any Details

Total release size: 10.7 kB

Release files / openpixels-0.3.1.tar.gz

Download URL openpixels-0.3.1.tar.gz
Size 5.4 kB
Tags Source
SHA-256 checksum
How to use checksums
e12f6bfa15b6757105c68ddd8ddfe78338699b2d5b5fd8fc9588266b47c3210e
BLAKE2b-256 checksum
How to use checksums
8d1efa5715a8dc9eb7bb7561bc1952ea53807c152a6a8f8a1bd6bf32fbcdb610
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / openpixels-0.3.1-py3-none-any.whl

Download URL openpixels-0.3.1-py3-none-any.whl
Size 5.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9fa9d93a9690fabb7e4fe68673867c7cb85a39891c78b8cf0da7ecbab78f4fcd
BLAKE2b-256 checksum
How to use checksums
1224151b5bc287e3ba777f1d0969a3f476c228b6b2462e3ff73c71bb1bde59c6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.3.1 This release

2 release files

0.3.0

2 release files

0.2.5

2 release files

0.2.4

2 release files

0.2.3

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.0

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

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