1
0
Fork 0
onnx-web/docs/api.md

5.2 KiB

API

Contents

Endpoints

GUI bundle

GET /

Serve index.html.

GET /<path>

Serve requested bundle file.

Usually includes:

  • bundle/main.js
  • config.json
  • index.html

Jobs

POST /api/job

Create a new job that will run a chain pipeline provided in the POST body.

PUT /api/job/cancel

Cancel one or more jobs by name, provided in the jobs query parameter.

Request:

> curl http://localhost:5000/api/job/status?jobs=job-1,job-2,job-3,job-4

Response:

[
  {
    "name": "job-1",
    "status": "cancelled"
  },
  {
    "name": "job-2",
    "status": "pending"
  }
]

GET /api/job/status

Get the status of one or more jobs by name, provided in the jobs query parameter.

Request:

> curl http://localhost:5000/api/job/status?jobs=job-1,job-2,job-3,job-4

Response:

[
    {
        "metadata": [
            // metadata for each output
        ],
        "name": "job-1",
        "outputs": [
            "txt2img_job_1.png"
        ],
        "queue": {
            "current": 0,
            "total": 0
        },
        "stages": {
            "current": 4,
            "total": 6
        },
        "status": "running",
        "steps": {
            "current": 120,
            "total": 78
        },
        "tiles": {
            "current": 0,
            "total": 16
        }
    },
    {
        "name": "job-2",
        "queue": {
            "current": 2,
            "total": 3
        },
        "stages": {
            "current": 0,
            "total": 0
        },
        "status": "pending",
        "steps": {
            "current": 0,
            "total": 0
        },
        "tiles": {
            "current": 0,
            "total": 0
        }
    }
]

Settings and parameters

GET /api

API introspection endpoint.

Returns a JSON document with all of the available API endpoints and valid methods for them:

{
  "name": "onnx-web",
  "routes": [
    {
      "methods": [
        "HEAD",
        "GET",
        "OPTIONS"
      ],
      "path": "/static/:filename"
    },
    {
      "methods": [
        "HEAD",
        "GET",
        "OPTIONS"
      ],
      "path": "/"
    },
    ...
  ]
}

GET /api/settings/filters

List available mask and source filters.

GET /api/settings/masks

List available mask filters.

GET /api/settings/models

List available models, all types.

GET /api/settings/noises

List available noise sources.

GET /api/settings/params

Server parameters, slider min/max and version check.

GET /api/settings/pipelines

List available pipelines.

GET /api/settings/platforms

Available hardware acceleration platforms.

GET /api/settings/schedulers

Available pipeline schedulers.

GET /api/settings/strings

Server strings, from extras file and plugins.

GET /api/settings/wildcards

List available wildcard paths.

Pipelines

GET /api/ready

Check if a pipeline has completed.

POST /api/blend

Blend two images using a mask.

POST /api/chain

Run a custom chain pipeline.

POST /api/img2img

Run an img2img pipeline.

POST /api/inpaint

Run an inpainting pipeline.

POST /api/txt2img

Run a txt2img pipeline.

POST /api/txt2txt

Unstable.

Run a txt2txt pipeline.

POST /api/upscale

Run an upscale pipeline.

PUT /api/cancel

Cancel a pending or in-progress job.

Outputs

GET /output/<path>

Serve output images.

In debug mode, this will also include some intermediate images:

  • last-mask.png
  • last-noise.png
  • last-source.png
  • last-tile-N.png