Skip to main content

pixaipy

Unofficial, community-made client for the PixAI.art GraphQL/REST API. Not affiliated with or endorsed by PixAI.

Status

Verified working against the live API. The API itself is undocumented and can change at any time; when upstream rotates persisted-query hashes, requests automatically degrade to inline queries instead of hard-failing.

Features

  • Token-based auth — use your own browser session token
  • Optional login() — supply a reCAPTCHA token you obtain yourself
  • Quota / account summary
  • Generation tasks: submit / status / wait / cancel
  • Media download from finished tasks
  • Generic graphql() escape hatch for any documented operation
  • API reference in docs/API.md — every GraphQL operation parsed from the official web bundle, with variable types

Install

pip install -e .

Python 3.9+ / only dependency is requests.

Authentication

Recommended: grab your session token once from your browser.

  1. Open pixai.art, log in as usual.
  2. In devtools → Network tab, make any request, look at a response header named Token — copy its value.
  3. Use token:
pixai token set eyJhbGciOi...        # stored in ~/.pixaipy/token.json
# or set env var:
export PIXAI_TOKEN=eyJhbGciOi...

Treat the token like a password. It grants full control of your account.

Optional login() — the official login mutation is protected by reCAPTCHA. Supply a recaptcha_token produced by your own browser session (or by a service you control). The simpler path is token auth above.

from pixaipy import PixAI
client = PixAI()
client.login("me@example.com", "password", recaptcha_token="<your-token>")
client.save_token()

Quickstart (Python)

import logging, sys
logging.basicConfig(stream=sys.stdout, level=logging.INFO)

from pixaipy import PixAI

client = PixAI(token="YOUR_TOKEN")          # or PixAI.load_token based flow

print("credits:", client.quota())           # {"id":..., "quotaAmount": N}

task = client.create_generation_task(
    "portrait of an anime mech in sunset, best quality",
    model_id="2036163415011877234",         # pick an id from YOUR model list
    width=832, height=1216, steps=33,
)
final = client.wait_for_task(task["id"], timeout=600)
for url in PixAI.task_media_urls(final):
    print(url)
    client.download_file(url, "output")

CLI

pixai quota
pixai generate --prompt "..." --model MODEL_ID --width 832 --height 1216 --wait --out ./out
pixai task 123456789 --wait --out ./out
pixai cancel 123456789
pixai token set|show|clear

API surface

Method Description
PixAI(token=...) Create client
.login(email, pw, recaptcha_token) Login (needs a reCAPTCHA token you provide)
.quota() / .me() Credit balance / account summary
.create_generation_task(prompt, model_id=..., ...) Submit generation
.task(id) REST status of one task
.wait_for_task(id, timeout=...) Poll until done
.cancel_task(id) Best-effort cancel
.task_media_urls(task) URLs from a completed task
.download_file(url, dir) Save media locally
.graphql(query, variables, ...) Escape hatch to the full schema
.save_token()/.load_token() File helpers

Troubleshooting

  • unauthenticated: ... HTTP 401 — your token died (PixAI rotates tokens server-side; the client refreshes its token automatically from response headers — re-export a newer one from the browser if 401s persist).
  • Repeated HTTP 500 — PixAI blankets aggressive/blocked traffic in 500s. Slow down; the built-in backoff (1s→2s… capped 8s) exists for a reason. Sustained storms can result in a temporary block, hours even.
  • PERSISTED_QUERY_NOT_FOUND — hash drift upstream; the library already auto-falls-back to an inline query, so you should not normally see this.

Documentation

Heavy documentation lives in docs/API.md — the full (157-operation) GraphQL catalog parsed from the official web bundle, REST endpoint list, verified request recipes and the troubleshooting matrix.

Unofficial interoperability tooling. No warranty of availability; respect PixAI's Terms of Service and rate limits while using it.

License

MIT — see LICENSE.

Metadata

Release files for pixaipy 0.1.0

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

Source distribution (sdist)

Source distribution for pixaipy 0.1.0
File Size Uploaded Provenance
pixaipy-0.1.0.tar.gz 14.1 kB With provenance Details

Built distribution (wheel)

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

Total release size: 27.6 kB

Release files / pixaipy-0.1.0.tar.gz

Download URL pixaipy-0.1.0.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
06e2d11e00be35d68f23592c81d9842a37e9a2896d7895e82a48938e1e021216
BLAKE2b-256 checksum
How to use checksums
7ed9f077aa64e315208af7ae1e77971d94e88d24a7a2d423291e738bd4fc32da
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / pixaipy-0.1.0-py3-none-any.whl

Download URL pixaipy-0.1.0-py3-none-any.whl
Size 13.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6223c823770ffca62ee00a73edf4f2c732b513fded950da76168f9748947d03c
BLAKE2b-256 checksum
How to use checksums
4c92a6e9a671a057c0057b9244a13ee31171e87221fd1d73a9071ef94019b59b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for pixaipy 0.1.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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for pixaipy-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

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