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
- Update the version in
pyproject.toml - Remove the dists folder:
rm -rf dist - Build the distribution packages:
uv build - Upload to PyPI using twine:
python3 -m twine upload dist/*
git tag vX.Y.Zgit 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)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| openpixels-0.3.1.tar.gz | 5.4 kB | Without provenance | Details for openpixels-0.3.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| openpixels-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for openpixels-0.3.1-py3-none-any.whl |
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
|
Security for openpixels 0.3.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.