PixelAPI Python SDK
Official Python client for PixelAPI — the cheapest AI image generation, background removal, upscaling, and audio API.
10 AI models, one API key, from $0.002/image.
Installation
pip install pixelapi
Quick Start
from pixelapi import PixelAPI
api = PixelAPI("your_api_key")
# Generate an image ($0.003)
result = api.image.generate("a cat astronaut, digital art", model="flux-schnell")
print(result.url)
Image Generation
# FLUX Schnell — fast, photorealistic (~3s, 3 credits)
result = api.image.generate("product on marble table", model="flux-schnell")
# SDXL — versatile, great for illustrations (~13s, 3 credits)
result = api.image.generate("watercolor mountains", model="sdxl")
print(result.url)
Background Removal — $0.002/image
result = api.image.remove_background("https://example.com/product.jpg")
print(result.url) # Transparent PNG
Background Replacement — $0.005/image
result = api.image.replace_background(
"https://example.com/product.jpg",
prompt="product on marble countertop, soft studio lighting"
)
4x Upscaling — $0.02/image
result = api.image.upscale("https://example.com/low-res.jpg")
print(result.url)
Face Restoration — $0.003/image
result = api.image.restore_face("https://example.com/blurry-portrait.jpg")
Object Removal — $0.005/image
result = api.image.remove_object(
"https://example.com/photo.jpg",
mask_url="https://example.com/mask.png"
)
🎵 AI Music Generation — $0.005/track (NEW in v0.2.0)
result = api.audio.generate("upbeat electronic music for a product video", duration=15)
print(result.url) # Audio URL
Non-blocking Usage
# Don't wait for completion
result = api.image.generate("hello world", wait=False)
print(result.id, result.status) # generation_id, "pending"
# Check later
status = api.image.get(result.id)
if status.status == "completed":
print(status.url)
Error Handling
from pixelapi import PixelAPI, AuthError, InsufficientCredits, RateLimitError
api = PixelAPI("your_api_key")
try:
result = api.image.generate("hello world")
except AuthError:
print("Invalid API key")
except RateLimitError:
print("Too many requests — slow down")
except InsufficientCredits:
print("Top up at pixelapi.dev/app")
API Reference
| Method | Endpoint | Credits |
|---|---|---|
api.image.generate() |
POST /v1/image/generate | 3 |
api.image.remove_background() |
POST /v1/image/remove-background | 2 |
api.image.upscale() |
POST /v1/image/upscale | 20 |
api.image.restore_face() |
POST /v1/image/restore-face | 3 |
api.image.remove_object() |
POST /v1/image/remove-object | 5 |
api.image.replace_background() |
POST /v1/image/replace-background | 5 |
api.audio.generate() |
POST /v1/audio/generate | 5 |
api.image.get() |
GET /v1/image/{id} | 0 |
api.account.balance() |
GET /v1/account/balance | 0 |
api.models.list() |
GET /v1/models | 0 |
What's New in v0.2.0
- 🎵 Audio generation via
api.audio.generate() - ✂️ Background removal via
api.image.remove_background() - 🎨 Background replacement via
api.image.replace_background() - 👤 Face restoration via
api.image.restore_face() - 🧹 Object removal via
api.image.remove_object() - Resource-based API (
api.image.*,api.audio.*,api.account.*) - Full backward compatibility with v0.1.0 flat API
Links
- Docs: pixelapi.dev/docs
- Dashboard: pixelapi.dev/app
- Swagger: api.pixelapi.dev/docs
- Support: support@pixelapi.dev
License
MIT
Metadata
Release files for pixelapi 0.2.0
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 |
|---|---|---|---|---|
| pixelapi-0.2.0.tar.gz | 10.7 kB | Without provenance | Details for pixelapi-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pixelapi-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pixelapi-0.2.0-py3-none-any.whl |
Total release size: 22.7 kB
Release files / pixelapi-0.2.0.tar.gz
| Download URL | pixelapi-0.2.0.tar.gz |
|---|---|
| Size | 10.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d332bdd5cfbcb91a3fe15314ff08b962b04b6abac3fe1b17a54500cb3534f56d
|
|
BLAKE2b-256 checksum How to use checksums |
ee6886caea30f0715e50254bfb2a9d7e16ad465bd601f02b84f7d86a730872d5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Release files / pixelapi-0.2.0-py3-none-any.whl
| Download URL | pixelapi-0.2.0-py3-none-any.whl |
|---|---|
| Size | 12.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f3c6efae323585e6ea28b506791c06bdeb78dd84e61f3cec3868fbf474430f78
|
|
BLAKE2b-256 checksum How to use checksums |
10c2f8199e58c01e06dd80b603d5b105f5b93484eb9fa5a0eda4d2795950ec0e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.13.7
|
Security for pixelapi 0.2.0
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.