Skip to main content

Python SDK for PixelAPI — AI image generation API

Project description

PixelAPI Python SDK

AI image generation at $0.01/image. SDXL and FLUX Schnell on bare-metal GPUs.

Install

pip install pixelapi

Quick Start

from pixelapi import PixelAPI

api = PixelAPI("your-api-key")

# Generate and wait for result
result = api.generate("a sunset over mountains, oil painting", model="sdxl", wait=True)
print(result.output_url)

# Or use FLUX for photorealism
result = api.generate("a coffee shop on a rainy day", model="flux-schnell", wait=True)
print(result.output_url)

Async / Non-blocking

# Submit without waiting
result = api.generate("a cyberpunk cityscape", model="sdxl")
print(result.generation_id)  # save this

# Check later
status = api.get_status(result.generation_id)
if status.completed:
    print(status.output_url)

Download Images

result = api.generate("a cute robot", model="sdxl", wait=True)
image_bytes = api.download(result.output_url)

with open("robot.png", "wb") as f:
    f.write(image_bytes)

Check Balance

balance = api.balance()
print(balance)

Models & Pricing

Model Credits Price
sdxl 1 $0.01
flux-schnell 3 $0.03

100 free credits on signup — no credit card required.

Error Handling

from pixelapi import PixelAPI, PixelAPIError

api = PixelAPI("your-api-key")

try:
    result = api.generate("hello world", model="sdxl", wait=True)
except PixelAPIError as e:
    print(f"Error: {e} (HTTP {e.status_code})")

Links

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

pixelapi-0.1.0.tar.gz (7.7 kB view details)

Uploaded Source

Built Distribution

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

pixelapi-0.1.0-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file pixelapi-0.1.0.tar.gz.

File metadata

  • Download URL: pixelapi-0.1.0.tar.gz
  • Upload date:
  • Size: 7.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pixelapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdd0747667f2a02a5c4ba6987d9e344e289160253162f421329b47ebcf23b1cd
MD5 0970fafce58cd0fc9099f75532b80f9e
BLAKE2b-256 ced41d12e36ae5f36a847d795cf8b1daf488aac0be0a4b8904b6a1b6c2a2739e

See more details on using hashes here.

File details

Details for the file pixelapi-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pixelapi-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 9.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for pixelapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 830f86817b72b3868fddb7d34f2abe40f689d585d8094ea206eea42a63f40bbb
MD5 041796ed55fa24f89063cb7271e8c0b0
BLAKE2b-256 bf48c33b196966fd24240cd4080a458a13afa0c6f69e591712ae47317403b3d8

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