Skip to main content

Official Python SDK for LuxurAI — AI image generation

Project description

LuxurAI Python SDK

Official Python client for LuxurAI — AI image generation.

Install

pip install luxur-ai

Quick Start

from luxurai import LuxurAI

client = LuxurAI(api_key="lxr_v1_xxxx")

# Generate an image
image = client.generate("a red dragon flying over mountains")
image.save("dragon.png")

Get your API key at luxurai.in → Dashboard → API Keys.


Usage

Generate image

# Auto model + auto resolution (recommended)
image = client.generate("a sunset over the ocean")
image.save("sunset.png")

# Pick resolution
image = client.generate(
    "divine krishna playing flute",
    resolution = "1152x1152",   # brainAI native — best quality
)

# Non-blocking
job = client.generate("anime girl with blue hair", wait=False)
print(f"Queue: #{job.queue_position}  ETA: ~{job.eta_seconds}s")
image = job.wait()
image.save("output.png")

Models & Resolutions (auto-discovery)

info = client.models()
print(info["models"])             # ['brainai-v1']
print(info["default"])            # 'brainai-v1'
print(info["resolutions"])        # ['512x512', '1024x1024', '1152x1152', ...]
print(info["default_resolution"]) # '1024x1024'

model="auto" always uses the latest model from the backend — no SDK update needed when new models launch.

Resolutions

from luxurai import Resolution

client.generate("a mountain", resolution=Resolution.HD)      # 1024x1024
client.generate("a mountain", resolution=Resolution.NATIVE)  # 1152x1152 — brainAI native
client.generate("a mountain", resolution="1920x1080")        # any WxH works

GeneratedImage

image = client.generate("a cat")

image.save("cat.png")       # save to file
image.save("cat.jpg")       # format from extension
raw  = image.bytes()        # raw bytes
pil  = image.to_pil()       # PIL.Image (needs: pip install Pillow)
image.show()                # display in Jupyter / IPython
print(image.url)            # permanent S3 URL

Wallet

balance = client.wallet.balance()
print(f"{balance.lc} LC  =  Rs.{balance.inr:.2f}")

Job history

jobs = client.jobs.list(limit=10)
for job in jobs:
    print(job.id, job.status, job.cost_lc, "LC")

API key management

new_key = client.keys.create(label="my-app")
print(new_key)   # lxr_v1_xxxx — save this!

keys = client.keys.list()

client.keys.revoke(key_id="key_id_here")
client.keys.rotate(key_id="key_id_here")

Check model status

status = client.status()
print(status["available"])    # True/False
print(status["message"])      # "Generation is live!" or "Coming soon..."

Error handling

from luxurai import (
    LuxurAI,
    AuthenticationError,
    InsufficientBalanceError,
    ModelTrainingError,
    JobFailedError,
    JobTimeoutError,
)

try:
    image = client.generate("a dragon")
except AuthenticationError:
    print("Invalid API key")
except InsufficientBalanceError:
    print("Not enough LC — top up at luxurai.in")
except ModelTrainingError:
    print("Model still training — coming soon!")
except JobFailedError:
    print("Generation failed — try again")
except JobTimeoutError:
    print("Timed out — try again")

Requirements

  • Python 3.8+
  • No required dependencies — pure stdlib
  • Optional: pip install Pillow for .to_pil() and .show()

License

MIT © LuxurAI

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

luxur_ai-0.1.1.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

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

luxur_ai-0.1.1-py3-none-any.whl (11.0 kB view details)

Uploaded Python 3

File details

Details for the file luxur_ai-0.1.1.tar.gz.

File metadata

  • Download URL: luxur_ai-0.1.1.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for luxur_ai-0.1.1.tar.gz
Algorithm Hash digest
SHA256 41b7ffc40eed1947999c5fbd3e752d79a89ba04548896fff07aaca7fa1d2ec4f
MD5 edb7ddd9c12a7a29d9b50d4677d253a7
BLAKE2b-256 62bda31b73eeed051539c0cb727995f4dbc241935a797c4e82982ee4c656ee67

See more details on using hashes here.

File details

Details for the file luxur_ai-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: luxur_ai-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 11.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for luxur_ai-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c1195b125c1158345e0f75d745cd6b022f7c83f0d34c0198a0ef4407445f3ae6
MD5 bdb6d30072ff22aef241cfd4fedf0386
BLAKE2b-256 e82a2fb6f7ea9efb798626a3c3537d232a202ab10ab6040218d7d49a253cff5a

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