Skip to content

API reference

PixelNexus has two programming interfaces: the HTTP API of the science engine, and the file formats of the studio.

Engine HTTP API

The engine serves its API under /api/v1 on http://127.0.0.1:8765 by default. The table is generated from the OpenAPI description FastAPI builds from the code. The running engine also shows it interactively at /api/v1/docs.

Method Path What it does
GET /api/v1/info Engine version, dependency versions, devices and limits.
GET /api/v1/filters The catalog entries that run in this engine, and whether this engine can run them.
GET /api/v1/filters/{filter_id} One catalog entry, and whether this engine can run it.
POST /api/v1/filters/{filter_id}/representation The operator for the Inspector, built by the same code that runs the filter.
GET /api/v1/models The optional models, with their license and whether they are downloaded.
GET /api/v1/models/{model_id} One model, with the progress of a download that runs.
DELETE /api/v1/models/{model_id} Remove a downloaded model and its files.
GET /api/v1/models/{model_id}/tensors The input and output tensors of a downloaded model, read from its ONNX files.
POST /api/v1/models/{model_id}/download Start downloading one model on the user's request. Every file is checked against its SHA-256. Ask GET /models/{id} for the progress.
POST /api/v1/images Upload raw RGBA bytes once. The content hash is the image id.
GET /api/v1/images/{image_id}/metadata The id, size and channel count of an uploaded image.
POST /api/v1/ai/{task_id} Run an AI task with an engine model, for the AI router's engine model provider. The result is a job: a mask as a gray image, or an image.
POST /api/v1/jobs Start a filter job on an uploaded image. Parameters are checked against the catalog.
GET /api/v1/jobs/{job_id} The state and progress of a job.
DELETE /api/v1/jobs/{job_id} Cancel a job and stop its process.
GET /api/v1/jobs/{job_id}/events Server-sent events with the job status, until the job ends.
GET /api/v1/jobs/{job_id}/result The result image as raw RGBA with X-Width and X-Height, or JSON for tables.

A filter job

  1. Upload the image once as raw RGBA with POST /api/v1/images?width=W&height=H. The answer holds its id, the content hash.
  2. Start the job with POST /api/v1/jobs, naming the filter, its parameters and the image id.
  3. Follow its progress with server-sent events at GET /api/v1/jobs/{id}/events, or ask GET /api/v1/jobs/{id}.
  4. Fetch the result with GET /api/v1/jobs/{id}/result, raw RGBA with X-Width and X-Height headers.
  5. DELETE /api/v1/jobs/{id} cancels it and stops its process.

The studio's client for this is web/src/engine-client/science.ts.

Studio file formats

File Format Page
Pipeline JSON, pixelnexus-pipeline version 1 Pipelines
Presets JSON, pixelnexus-presets version 1 Panels
Project ZIP with project.json, pixelnexus-project version 1 Projects

External AI services

The Generic HTTP contract for an AI service you build is on Connecting an external API.