{
 "openapi": "3.0.3",
 "info": {
  "title": "GPULab API",
  "version": "2026-11",
  "description": "GPULab is an OpenAI-compatible inference API on dedicated GPUs in Deasil Works' cluster, built and run on Deasil's Plexara. Work runs in two pools that grow with demand: the language pool (chat, vision, documents, embeddings) and the media pool (images, speech, transcription). Music renders on CPU.\n\n## Keys\n\nSend your key in every request as `Authorization: Bearer <key>`. Keys are issued by a person after a request at [gpulab.io/access](https://gpulab.io/access/). Bodies are JSON.\n\n## Answers in the request, and jobs\n\nChat, embeddings, models and usage answer in the request; a request may run 60 seconds. Documents, images, speech, transcription and music are jobs: the request waits up to 45 seconds for the job (change it with `wait`, 0 to 50) and answers `200` with the result, or `202` with the job, which you poll at `/jobs/{id}/result`. Results are kept 24 hours.\n\n## Receipts\n\nEvery answer that used a GPU carries a `receipt`: the pool, `gpu_seconds`, `watt_hours` from the GPU's own power readings, and the workload's units (tokens, pages, images, seconds of audio). GPU time and energy are also in the `X-GPULab-GPU-Seconds` and `X-GPULab-Watt-Hours` headers, and add up in `/usage`.\n\n## From your Plexara\n\nAdd GPULab to Plexara as an API connection: this document's URL as the spec (`https://gpulab.io/openapi.json`), your key as the bearer token. Agents and scripts then call it by operation id, such as `createChatCompletion` or `createTranscription`.\n\n## Limits\n\n60 requests a minute per key; request bodies up to 10,485,760 bytes; streaming is not offered (`stream: true` is refused). Daily quotas depend on your tier; see [the docs](https://gpulab.io/docs/#limits).",
  "termsOfService": "https://gpulab.io/terms/",
  "contact": {
   "name": "GPULab support",
   "email": "support@plexara.io",
   "url": "https://gpulab.io/docs/"
  },
  "x-logo": {
   "url": "https://gpulab.io/favicon.svg",
   "altText": "GPULab"
  }
 },
 "externalDocs": {
  "description": "Quickstart and guides",
  "url": "https://gpulab.io/docs/"
 },
 "servers": [
  {
   "url": "https://api.gpulab.io/v1",
   "description": "GPULab"
  }
 ],
 "security": [
  {
   "bearer": []
  }
 ],
 "tags": [
  {
   "name": "Chat",
   "description": "qwen3:8b and qwen3-vl:8b in the language pool. Answers in the request."
  },
  {
   "name": "Embeddings",
   "description": "qwen3-embedding:0.6b, 1,024 dimensions. Answers in the request."
  },
  {
   "name": "Documents",
   "description": "PDFs and scans read to Markdown or JSON by qwen3-vl:8b. A job."
  },
  {
   "name": "Images",
   "description": "z-image-turbo in the media pool. A job."
  },
  {
   "name": "Audio",
   "description": "Speech from text with chatterbox, and text from speech with whisper-large-v3-turbo, in the media pool. Jobs."
  },
  {
   "name": "Music",
   "description": "plexara-score renders a JSON score on CPU. A job."
  },
  {
   "name": "Jobs",
   "description": "Read, wait for and cancel jobs. Results are kept 24 hours."
  },
  {
   "name": "Models",
   "description": "What your key can call."
  },
  {
   "name": "Account",
   "description": "Today's use against your tier's quota."
  }
 ],
 "paths": {
  "/models": {
   "get": {
    "operationId": "listModels",
    "tags": [
     "Models"
    ],
    "summary": "Models your key can call",
    "responses": {
     "200": {
      "description": "Models",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ModelList"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     }
    }
   }
  },
  "/usage": {
   "get": {
    "operationId": "getUsage",
    "tags": [
     "Account"
    ],
    "summary": "Today's requests, GPU seconds and watt-hours against your tier's quota",
    "responses": {
     "200": {
      "description": "Usage",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Usage"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     }
    }
   }
  },
  "/chat/completions": {
   "post": {
    "operationId": "createChatCompletion",
    "tags": [
     "Chat"
    ],
    "summary": "Chat completion",
    "description": "The OpenAI chat completion request and answer, plus a receipt. qwen3-vl:8b also reads images in the messages.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ChatRequest"
       },
       "example": {
        "model": "qwen3:8b",
        "messages": [
         {
          "role": "user",
          "content": "In one sentence, what is an embedding?"
         }
        ],
        "max_tokens": 80
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Completion with a receipt",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ChatCompletion"
        },
        "example": {
         "id": "chatcmpl-6b28173e673e3813f6c984a8",
         "object": "chat.completion",
         "created": 1795673373,
         "model": "qwen3:8b",
         "choices": [
          {
           "index": 0,
           "finish_reason": "stop",
           "message": {
            "role": "assistant",
            "content": "An embedding is a numerical representation of data, such as words or images, in a continuous vector space that captures semantic or structural relationships."
           }
          }
         ],
         "usage": {
          "prompt_tokens": 25,
          "completion_tokens": 28,
          "total_tokens": 53
         },
         "receipt": {
          "pool": "language",
          "gpu_seconds": 0.87,
          "watt_hours": 0.0067,
          "input_tokens": 25,
          "output_tokens": 28
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     },
     "502": {
      "$ref": "#/components/responses/E502"
     },
     "504": {
      "$ref": "#/components/responses/E504"
     }
    }
   }
  },
  "/embeddings": {
   "post": {
    "operationId": "createEmbedding",
    "tags": [
     "Embeddings"
    ],
    "summary": "Embeddings",
    "description": "Vectors for search and matching, in the OpenAI shape, plus a receipt.",
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/EmbeddingRequest"
       },
       "example": {
        "model": "qwen3-embedding:0.6b",
        "input": [
         "invoice total due",
         "weather forecast for Glendale"
        ]
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Embeddings with a receipt",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/EmbeddingList"
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     },
     "502": {
      "$ref": "#/components/responses/E502"
     },
     "504": {
      "$ref": "#/components/responses/E504"
     }
    }
   }
  },
  "/documents": {
   "post": {
    "operationId": "readDocument",
    "tags": [
     "Documents"
    ],
    "summary": "Read a PDF or scan to Markdown or JSON",
    "description": "Reads a document with qwen3-vl:8b, page by page, as a job.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/DocumentRequest"
       },
       "example": {
        "document": "JVBERi0xLjcKJeLjz9MK...",
        "format": "json",
        "prompt": "Extract vendor, invoice_number, date, terms, line_items and total as JSON."
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/DocumentResult"
        },
        "example": {
         "model": "qwen3-vl:8b",
         "page_count": 1,
         "pages": [
          {
           "page": 1,
           "content": {
            "vendor": "ACME SUPPLY CO.",
            "invoice_number": "#10442",
            "date": "2026-11-20",
            "terms": "Net 30",
            "total": "$66.00"
           }
          }
         ],
         "receipt": {
          "pool": "language",
          "gpu_seconds": 33.92,
          "watt_hours": 0.2649,
          "pages": 1,
          "input_tokens": 1112,
          "output_tokens": 246
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/images/generations": {
   "post": {
    "operationId": "createImage",
    "tags": [
     "Images"
    ],
    "summary": "Generate images",
    "description": "Generates images with z-image-turbo as a job, in the OpenAI images shape (b64_json).",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/ImageRequest"
       },
       "example": {
        "prompt": "Wireframe planes in deep navy space",
        "size": "1024x1024"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/ImageResult"
        },
        "example": {
         "created": 1795669310,
         "model": "z-image-turbo",
         "data": [
          {
           "b64_json": "iVBORw0KGgo...",
           "seed": 11,
           "width": 1024,
           "height": 1024,
           "format": "png"
          }
         ],
         "receipt": {
          "pool": "media",
          "gpu_seconds": 64.7,
          "watt_hours": 0.9197,
          "images": 1,
          "megapixels": 1.05
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/audio/speech": {
   "post": {
    "operationId": "createSpeech",
    "tags": [
     "Audio"
    ],
    "summary": "Speech from text",
    "description": "Reads text aloud with chatterbox, in the built-in voice or one from a reference recording. The answer is JSON with the audio in base64, so read it as JSON rather than with an SDK's speech helper.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SpeechRequest"
       },
       "example": {
        "input": "Your order has shipped.",
        "seed": 3
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AudioResult"
        },
        "example": {
         "model": "chatterbox",
         "audio": {
          "b64": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYx...",
          "format": "mp3",
          "sample_rate": 24000,
          "seconds": 2.36
         },
         "receipt": {
          "pool": "media",
          "gpu_seconds": 5.63,
          "watt_hours": 0.0617,
          "audio_seconds": 2.36,
          "characters": 33
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/audio/text2speech": {
   "post": {
    "operationId": "textToSpeech",
    "tags": [
     "Audio"
    ],
    "summary": "Speech from text (second name)",
    "description": "The same as `/audio/speech`. Reads text aloud with chatterbox, in the built-in voice or one from a reference recording. The answer is JSON with the audio in base64, so read it as JSON rather than with an SDK's speech helper.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/SpeechRequest"
       },
       "example": {
        "input": "Your order has shipped.",
        "seed": 3
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/AudioResult"
        },
        "example": {
         "model": "chatterbox",
         "audio": {
          "b64": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYx...",
          "format": "mp3",
          "sample_rate": 24000,
          "seconds": 2.36
         },
         "receipt": {
          "pool": "media",
          "gpu_seconds": 5.63,
          "watt_hours": 0.0617,
          "audio_seconds": 2.36,
          "characters": 33
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/audio/transcriptions": {
   "post": {
    "operationId": "createTranscription",
    "tags": [
     "Audio"
    ],
    "summary": "Text from speech",
    "description": "Turns speech into text with whisper-large-v3-turbo: the text and detected language, and on request timed segments, word timings, or SRT or WebVTT subtitles. The request is JSON with the audio in base64, not a multipart upload, so send it as JSON rather than with an SDK's transcription helper. Name the people, products and companies the audio mentions in `prompt` to get their spelling right.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TranscriptionRequest"
       },
       "example": {
        "file": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYx...",
        "response_format": "srt",
        "prompt": "GPULab, Plexara, Deasil"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TranscriptionResult"
        },
        "example": {
         "model": "whisper-large-v3-turbo",
         "language": "en",
         "duration": 56.47,
         "text": "Chat, vision, document, embedding, image, speech, and music models run on dedicated GPUs in Deasil's cluster. ...",
         "subtitles_format": "srt",
         "subtitles": "1\n00:00:00,080 --> 00:00:05,660\nChat, vision, document, embedding, image, speech, and music models run on dedicated\n\n2\n00:00:05,660 --> 00:00:07,700\nGPUs in Deasil's cluster.\n",
         "receipt": {
          "pool": "media",
          "gpu_seconds": 1.89,
          "watt_hours": 0.0274,
          "audio_seconds": 56.47
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/audio/speech2text": {
   "post": {
    "operationId": "speechToText",
    "tags": [
     "Audio"
    ],
    "summary": "Text from speech (second name)",
    "description": "The same as `/audio/transcriptions`. Turns speech into text with whisper-large-v3-turbo: the text and detected language, and on request timed segments, word timings, or SRT or WebVTT subtitles. The request is JSON with the audio in base64, not a multipart upload, so send it as JSON rather than with an SDK's transcription helper. Name the people, products and companies the audio mentions in `prompt` to get their spelling right.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/TranscriptionRequest"
       },
       "example": {
        "file": "SUQzBAAAAAAAI1RTU0UAAAAPAAADTGF2ZjYx...",
        "response_format": "srt",
        "prompt": "GPULab, Plexara, Deasil"
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/TranscriptionResult"
        },
        "example": {
         "model": "whisper-large-v3-turbo",
         "language": "en",
         "duration": 56.47,
         "text": "Chat, vision, document, embedding, image, speech, and music models run on dedicated GPUs in Deasil's cluster. ...",
         "subtitles_format": "srt",
         "subtitles": "1\n00:00:00,080 --> 00:00:05,660\nChat, vision, document, embedding, image, speech, and music models run on dedicated\n\n2\n00:00:05,660 --> 00:00:07,700\nGPUs in Deasil's cluster.\n",
         "receipt": {
          "pool": "media",
          "gpu_seconds": 1.89,
          "watt_hours": 0.0274,
          "audio_seconds": 56.47
         }
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/music": {
   "post": {
    "operationId": "renderMusic",
    "tags": [
     "Music"
    ],
    "summary": "Render a score to audio",
    "description": "Renders a JSON score to audio with plexara-score on CPU: Surge XT synth patches and VSCO2 Community Edition samples, buses with a shared reverb, a master compressor and limiter.",
    "parameters": [
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "requestBody": {
     "required": true,
     "content": {
      "application/json": {
       "schema": {
        "$ref": "#/components/schemas/MusicRequest"
       },
       "example": {
        "format": "mp3",
        "score": {
         "seconds": 8,
         "fade_out": 1.5,
         "buses": [
          {
           "name": "music",
           "reverb": 0.2
          }
         ],
         "parts": [
          {
           "bus": "music",
           "instrument": {
            "synth": "Keys/EP 1"
           },
           "notes": [
            [
             0,
             "C4",
             70,
             4
            ],
            [
             0,
             "E4",
             70,
             4
            ],
            [
             4,
             "B3",
             70,
             4
            ],
            [
             4,
             "D4",
             70,
             4
            ]
           ]
          }
         ]
        }
       }
      }
     }
    },
    "responses": {
     "200": {
      "description": "Finished within the wait",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/MusicResult"
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "400": {
      "$ref": "#/components/responses/E400"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "413": {
      "$ref": "#/components/responses/E413"
     },
     "429": {
      "$ref": "#/components/responses/E429"
     }
    }
   }
  },
  "/jobs": {
   "get": {
    "operationId": "listJobs",
    "tags": [
     "Jobs"
    ],
    "summary": "Your 50 newest jobs",
    "responses": {
     "200": {
      "description": "Jobs",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "properties": {
          "object": {
           "type": "string",
           "enum": [
            "list"
           ]
          },
          "data": {
           "type": "array",
           "items": {
            "type": "object"
           }
          }
         }
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     }
    }
   }
  },
  "/jobs/{id}": {
   "get": {
    "operationId": "getJob",
    "tags": [
     "Jobs"
    ],
    "summary": "A job's status, place in the queue and, once it ends, its receipt",
    "parameters": [
     {
      "$ref": "#/components/parameters/JobId"
     },
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "responses": {
     "200": {
      "description": "The job",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Job"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "404": {
      "$ref": "#/components/responses/E404"
     }
    }
   },
   "delete": {
    "operationId": "cancelJob",
    "tags": [
     "Jobs"
    ],
    "summary": "Cancel a job that is still queued",
    "parameters": [
     {
      "$ref": "#/components/parameters/JobId"
     }
    ],
    "responses": {
     "200": {
      "description": "Canceled",
      "content": {
       "application/json": {
        "schema": {
         "$ref": "#/components/schemas/Job"
        }
       }
      }
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "404": {
      "$ref": "#/components/responses/E404"
     }
    }
   }
  },
  "/jobs/{id}/result": {
   "get": {
    "operationId": "getJobResult",
    "tags": [
     "Jobs"
    ],
    "summary": "A finished job's result, shaped as its route answers",
    "parameters": [
     {
      "$ref": "#/components/parameters/JobId"
     },
     {
      "$ref": "#/components/parameters/Wait"
     }
    ],
    "responses": {
     "200": {
      "description": "The result, in the shape of the route the job came from",
      "content": {
       "application/json": {
        "schema": {
         "type": "object",
         "additionalProperties": true
        }
       }
      },
      "headers": {
       "X-GPULab-GPU-Seconds": {
        "$ref": "#/components/headers/GpuSeconds"
       },
       "X-GPULab-Watt-Hours": {
        "$ref": "#/components/headers/WattHours"
       }
      }
     },
     "202": {
      "$ref": "#/components/responses/Queued"
     },
     "401": {
      "$ref": "#/components/responses/E401"
     },
     "403": {
      "$ref": "#/components/responses/E403"
     },
     "404": {
      "$ref": "#/components/responses/E404"
     },
     "422": {
      "$ref": "#/components/responses/E422"
     }
    }
   }
  }
 },
 "components": {
  "securitySchemes": {
   "bearer": {
    "type": "http",
    "scheme": "bearer",
    "description": "Your GPULab key"
   }
  },
  "schemas": {
   "Receipt": {
    "type": "object",
    "properties": {
     "pool": {
      "type": "string",
      "enum": [
       "language",
       "media"
      ],
      "nullable": true,
      "description": "The pool the work ran in; null for music, which renders on CPU"
     },
     "gpu_seconds": {
      "type": "number",
      "description": "Time the work held a GPU"
     },
     "watt_hours": {
      "type": "number",
      "description": "Energy from the GPU's power readings while the work ran"
     },
     "input_tokens": {
      "type": "integer"
     },
     "output_tokens": {
      "type": "integer"
     },
     "inputs": {
      "type": "integer",
      "description": "Embeddings: how many texts"
     },
     "pages": {
      "type": "integer",
      "description": "Documents: pages read"
     },
     "images": {
      "type": "integer"
     },
     "megapixels": {
      "type": "number"
     },
     "audio_seconds": {
      "type": "number",
      "description": "Speech and music: seconds produced; transcription: seconds read"
     },
     "characters": {
      "type": "integer",
      "description": "Speech: characters read aloud"
     },
     "cpu_seconds": {
      "type": "number",
      "description": "Music: CPU time"
     }
    },
    "description": "What a call used, measured",
    "additionalProperties": true,
    "example": {
     "pool": "language",
     "gpu_seconds": 0.87,
     "watt_hours": 0.0067,
     "input_tokens": 25,
     "output_tokens": 28
    }
   },
   "Error": {
    "type": "object",
    "properties": {
     "error": {
      "type": "object",
      "properties": {
       "message": {
        "type": "string"
       },
       "type": {
        "type": "string",
        "example": "invalid_request_error"
       },
       "code": {
        "type": "integer",
        "example": 400
       }
      },
      "required": [
       "message",
       "type",
       "code"
      ]
     }
    },
    "required": [
     "error"
    ],
    "example": {
     "error": {
      "message": "file is required: the audio as base64 in a JSON body",
      "type": "invalid_request_error",
      "code": 400
     }
    }
   },
   "Job": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string",
      "pattern": "^job_[0-9a-f]{32}$"
     },
     "object": {
      "type": "string",
      "enum": [
       "job"
      ]
     },
     "type": {
      "type": "string",
      "enum": [
       "image",
       "speech",
       "transcribe",
       "music",
       "ocr"
      ]
     },
     "model": {
      "type": "string"
     },
     "status": {
      "type": "string",
      "enum": [
       "queued",
       "running",
       "succeeded",
       "failed",
       "canceled"
      ]
     },
     "position": {
      "type": "integer",
      "description": "Place in the queue while queued"
     },
     "error": {
      "type": "string"
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     },
     "poll": {
      "type": "string",
      "description": "Where to read the job"
     }
    },
    "required": [
     "id",
     "object",
     "status"
    ],
    "example": {
     "id": "job_7cdc73377ae5454d8bb72d99fbf9243a",
     "object": "job",
     "type": "image",
     "model": "z-image-turbo",
     "status": "queued",
     "position": 1,
     "poll": "/v1/jobs/job_7cdc73377ae5454d8bb72d99fbf9243a"
    }
   },
   "Model": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "object": {
      "type": "string",
      "enum": [
       "model"
      ]
     },
     "owned_by": {
      "type": "string"
     },
     "gpulab": {
      "type": "object",
      "properties": {
       "kinds": {
        "type": "array",
        "items": {
         "type": "string"
        }
       },
       "pool": {
        "type": "string",
        "nullable": true
       },
       "route": {
        "type": "string"
       },
       "context": {
        "type": "integer"
       },
       "dimensions": {
        "type": "integer"
       }
      }
     }
    }
   },
   "ModelList": {
    "type": "object",
    "properties": {
     "object": {
      "type": "string",
      "enum": [
       "list"
      ]
     },
     "data": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/Model"
      }
     }
    }
   },
   "Usage": {
    "type": "object",
    "properties": {
     "customer": {
      "type": "string"
     },
     "key": {
      "type": "string"
     },
     "tier": {
      "type": "string",
      "enum": [
       "free",
       "customer",
       "internal"
      ]
     },
     "today": {
      "type": "object",
      "properties": {
       "requests": {
        "type": "integer"
       },
       "gpu_seconds": {
        "type": "number"
       },
       "watt_hours": {
        "type": "number"
       }
      }
     },
     "quota": {
      "type": "object",
      "properties": {
       "requests": {
        "type": "integer"
       },
       "gpu_seconds": {
        "type": "integer"
       },
       "max_output_tokens": {
        "type": "integer"
       }
      }
     }
    },
    "example": {
     "customer": "acme",
     "key": "gpulab-acme-1",
     "tier": "customer",
     "today": {
      "requests": 12,
      "gpu_seconds": 41.6,
      "watt_hours": 0.39
     },
     "quota": {
      "requests": 20000,
      "gpu_seconds": 36000,
      "max_output_tokens": 4096
     }
    }
   },
   "ChatMessage": {
    "type": "object",
    "properties": {
     "role": {
      "type": "string",
      "enum": [
       "system",
       "user",
       "assistant",
       "tool"
      ]
     },
     "content": {
      "description": "A string, or a list of `text` and `image_url` parts. Images go to qwen3-vl:8b as data: URLs with base64 content.",
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "object"
        }
       }
      ],
      "nullable": true
     },
     "tool_calls": {
      "type": "array",
      "items": {
       "type": "object"
      }
     },
     "tool_call_id": {
      "type": "string"
     }
    },
    "required": [
     "role"
    ]
   },
   "ChatRequest": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "qwen3:8b",
       "qwen3-vl:8b"
      ]
     },
     "messages": {
      "type": "array",
      "items": {
       "$ref": "#/components/schemas/ChatMessage"
      },
      "minItems": 1
     },
     "max_tokens": {
      "type": "integer",
      "description": "Capped at your tier's limit"
     },
     "max_completion_tokens": {
      "type": "integer"
     },
     "temperature": {
      "type": "number"
     },
     "top_p": {
      "type": "number"
     },
     "seed": {
      "type": "integer"
     },
     "stop": {
      "description": "A string or a list of strings",
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        }
       }
      ]
     },
     "response_format": {
      "type": "object",
      "description": "`{\"type\": \"json_object\"}`, or `json_schema` with a schema the answer must follow"
     },
     "tools": {
      "type": "array",
      "items": {
       "type": "object"
      },
      "description": "Function tools"
     },
     "reasoning_effort": {
      "type": "string",
      "enum": [
       "low",
       "medium",
       "high"
      ],
      "description": "Turns on the model's thinking, returned in message.reasoning_content"
     },
     "n": {
      "type": "integer",
      "enum": [
       1
      ]
     },
     "stream": {
      "type": "boolean",
      "enum": [
       false
      ]
     }
    },
    "required": [
     "model",
     "messages"
    ]
   },
   "ChatCompletion": {
    "type": "object",
    "properties": {
     "id": {
      "type": "string"
     },
     "object": {
      "type": "string",
      "enum": [
       "chat.completion"
      ]
     },
     "created": {
      "type": "integer"
     },
     "model": {
      "type": "string"
     },
     "choices": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "index": {
         "type": "integer"
        },
        "finish_reason": {
         "type": "string",
         "enum": [
          "stop",
          "length",
          "tool_calls"
         ]
        },
        "message": {
         "type": "object",
         "properties": {
          "role": {
           "type": "string"
          },
          "content": {
           "type": "string",
           "nullable": true
          },
          "reasoning_content": {
           "type": "string"
          },
          "tool_calls": {
           "type": "array",
           "items": {
            "type": "object"
           }
          }
         }
        }
       }
      }
     },
     "usage": {
      "type": "object",
      "properties": {
       "prompt_tokens": {
        "type": "integer"
       },
       "completion_tokens": {
        "type": "integer"
       },
       "total_tokens": {
        "type": "integer"
       }
      }
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "EmbeddingRequest": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string",
      "enum": [
       "qwen3-embedding:0.6b"
      ]
     },
     "input": {
      "description": "A string or a list of 1 to 256 strings",
      "oneOf": [
       {
        "type": "string"
       },
       {
        "type": "array",
        "items": {
         "type": "string"
        },
        "minItems": 1,
        "maxItems": 256
       }
      ]
     },
     "dimensions": {
      "type": "integer",
      "description": "1,024 by default"
     },
     "encoding_format": {
      "type": "string",
      "enum": [
       "float"
      ]
     }
    },
    "required": [
     "model",
     "input"
    ]
   },
   "EmbeddingList": {
    "type": "object",
    "properties": {
     "object": {
      "type": "string",
      "enum": [
       "list"
      ]
     },
     "model": {
      "type": "string"
     },
     "data": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "object": {
         "type": "string"
        },
        "index": {
         "type": "integer"
        },
        "embedding": {
         "type": "array",
         "items": {
          "type": "number"
         }
        }
       }
      }
     },
     "usage": {
      "type": "object",
      "properties": {
       "prompt_tokens": {
        "type": "integer"
       },
       "total_tokens": {
        "type": "integer"
       }
      }
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "DocumentRequest": {
    "type": "object",
    "properties": {
     "document": {
      "type": "string",
      "format": "byte",
      "description": "Base64 PDF, PNG, JPEG, WebP or TIFF; up to 40 pages a request"
     },
     "prompt": {
      "type": "string",
      "description": "What to read out. Left out, each page is transcribed as Markdown, tables included."
     },
     "format": {
      "type": "string",
      "enum": [
       "markdown",
       "json"
      ],
      "default": "markdown"
     },
     "schema": {
      "type": "object",
      "description": "With json: a JSON schema each page's answer follows"
     },
     "first_page": {
      "type": "integer",
      "minimum": 1
     },
     "last_page": {
      "type": "integer",
      "minimum": 1
     },
     "dpi": {
      "type": "integer",
      "default": 150
     },
     "max_tokens": {
      "type": "integer",
      "default": 4096,
      "description": "Output per page"
     },
     "wait": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
     }
    },
    "required": [
     "document"
    ]
   },
   "DocumentResult": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string"
     },
     "job": {
      "$ref": "#/components/schemas/Job"
     },
     "page_count": {
      "type": "integer"
     },
     "pages": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "page": {
         "type": "integer"
        },
        "content": {
         "description": "Markdown text, or the JSON the prompt asked for"
        }
       }
      }
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "ImageRequest": {
    "type": "object",
    "properties": {
     "prompt": {
      "type": "string"
     },
     "model": {
      "type": "string",
      "enum": [
       "z-image-turbo"
      ]
     },
     "size": {
      "type": "string",
      "default": "1024x1024",
      "description": "WIDTHxHEIGHT, each side 512 to 1536 in steps of 64, at most 1536x1024 pixels"
     },
     "n": {
      "type": "integer",
      "minimum": 1,
      "maximum": 4,
      "default": 1
     },
     "steps": {
      "type": "integer",
      "minimum": 4,
      "maximum": 16,
      "default": 9
     },
     "seed": {
      "type": "integer",
      "description": "Repeat a seed and prompt to get the same image"
     },
     "output_format": {
      "type": "string",
      "enum": [
       "png",
       "jpeg",
       "webp"
      ],
      "default": "png"
     },
     "response_format": {
      "type": "string",
      "enum": [
       "b64_json"
      ]
     },
     "wait": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
     }
    },
    "required": [
     "prompt"
    ]
   },
   "ImageResult": {
    "type": "object",
    "properties": {
     "created": {
      "type": "integer"
     },
     "model": {
      "type": "string"
     },
     "job": {
      "$ref": "#/components/schemas/Job"
     },
     "data": {
      "type": "array",
      "items": {
       "type": "object",
       "properties": {
        "b64_json": {
         "type": "string",
         "format": "byte"
        },
        "seed": {
         "type": "integer"
        },
        "width": {
         "type": "integer"
        },
        "height": {
         "type": "integer"
        },
        "format": {
         "type": "string"
        }
       }
      }
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "SpeechRequest": {
    "type": "object",
    "properties": {
     "input": {
      "type": "string",
      "maxLength": 5000,
      "description": "The text to read aloud"
     },
     "model": {
      "type": "string",
      "enum": [
       "chatterbox"
      ]
     },
     "voice": {
      "type": "string",
      "format": "byte",
      "description": "A base64 WAV or MP3 of about 10 seconds of clean speech, to speak in that voice. Left out, or a short name, uses the built-in voice. Use your own voice, or one whose speaker agreed."
     },
     "response_format": {
      "type": "string",
      "enum": [
       "mp3",
       "wav"
      ],
      "default": "mp3"
     },
     "exaggeration": {
      "type": "number",
      "default": 0.5
     },
     "cfg_weight": {
      "type": "number",
      "default": 0.5
     },
     "temperature": {
      "type": "number",
      "default": 0.8
     },
     "seed": {
      "type": "integer",
      "description": "Repeat a seed to repeat a reading"
     },
     "wait": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
     }
    },
    "required": [
     "input"
    ]
   },
   "AudioResult": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string"
     },
     "job": {
      "$ref": "#/components/schemas/Job"
     },
     "audio": {
      "type": "object",
      "properties": {
       "b64": {
        "type": "string",
        "format": "byte"
       },
       "format": {
        "type": "string",
        "enum": [
         "mp3",
         "wav"
        ]
       },
       "sample_rate": {
        "type": "integer"
       },
       "seconds": {
        "type": "number"
       }
      }
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "TranscriptionRequest": {
    "type": "object",
    "properties": {
     "file": {
      "type": "string",
      "format": "byte",
      "description": "The audio as base64: WAV, MP3, M4A, OGG, FLAC, WebM or MP4, up to 60 minutes within the 10,485,760-byte request body (about 7.5 MB of audio). A JSON body, not a multipart upload."
     },
     "model": {
      "type": "string",
      "enum": [
       "whisper-large-v3-turbo",
       "whisper-1"
      ],
      "description": "whisper-1 is accepted as the same model"
     },
     "language": {
      "type": "string",
      "pattern": "^[a-z]{2,3}$",
      "description": "An ISO 639-1 code such as en. Left out, the language is detected and returned."
     },
     "prompt": {
      "type": "string",
      "description": "Names and spellings to expect, such as product and company names"
     },
     "response_format": {
      "type": "string",
      "enum": [
       "json",
       "verbose_json",
       "text",
       "srt",
       "vtt"
      ],
      "default": "json",
      "description": "json and text answer the text; verbose_json adds timed segments; srt and vtt add subtitles in that format"
     },
     "timestamp_granularities": {
      "type": "array",
      "items": {
       "type": "string",
       "enum": [
        "word",
        "segment"
       ]
      },
      "description": "Include word to add word timings to each segment"
     },
     "words": {
      "type": "boolean",
      "description": "The same as timestamp_granularities [\"word\"]"
     },
     "wait": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
     }
    },
    "required": [
     "file"
    ]
   },
   "TranscriptionResult": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string"
     },
     "job": {
      "$ref": "#/components/schemas/Job"
     },
     "text": {
      "type": "string"
     },
     "language": {
      "type": "string"
     },
     "duration": {
      "type": "number",
      "description": "Seconds of audio"
     },
     "segments": {
      "type": "array",
      "description": "verbose_json, srt, vtt or word timings: subtitle-sized cues",
      "items": {
       "type": "object",
       "properties": {
        "start": {
         "type": "number"
        },
        "end": {
         "type": "number"
        },
        "text": {
         "type": "string"
        },
        "words": {
         "type": "array",
         "items": {
          "type": "object",
          "properties": {
           "start": {
            "type": "number"
           },
           "end": {
            "type": "number"
           },
           "word": {
            "type": "string"
           }
          }
         }
        }
       }
      }
     },
     "subtitles": {
      "type": "string",
      "description": "srt or vtt: the subtitles file's text"
     },
     "subtitles_format": {
      "type": "string",
      "enum": [
       "srt",
       "vtt"
      ]
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   },
   "MusicRequest": {
    "type": "object",
    "properties": {
     "score": {
      "type": "object",
      "description": "A JSON score: seconds (up to 600), loop, seed, buses, parts (each a Surge XT synth patch such as Keys/EP 1, a VSCO2 sampler such as Strings/Solo Contrabass/Pizz/*.wav, or one-shot hits, with notes as [time, note, velocity, duration]), faders, ducks, fade_in, fade_out. At most 20,000 notes and hits."
     },
     "format": {
      "type": "string",
      "enum": [
       "mp3",
       "wav"
      ],
      "default": "mp3"
     },
     "wait": {
      "type": "integer",
      "minimum": 0,
      "maximum": 50
     }
    },
    "required": [
     "score"
    ]
   },
   "MusicResult": {
    "type": "object",
    "properties": {
     "model": {
      "type": "string"
     },
     "job": {
      "$ref": "#/components/schemas/Job"
     },
     "audio": {
      "type": "object",
      "properties": {
       "b64": {
        "type": "string",
        "format": "byte"
       },
       "format": {
        "type": "string"
       },
       "sample_rate": {
        "type": "integer"
       },
       "seconds": {
        "type": "number"
       }
      }
     },
     "lowered": {
      "type": "array",
      "items": {
       "type": "object"
      },
      "description": "Parts lowered by octaves to sit under their ceiling"
     },
     "receipt": {
      "$ref": "#/components/schemas/Receipt"
     }
    }
   }
  },
  "parameters": {
   "Wait": {
    "name": "wait",
    "in": "query",
    "description": "Seconds to hold the request for the job before answering 202",
    "schema": {
     "type": "integer",
     "minimum": 0,
     "maximum": 50,
     "default": 45
    }
   },
   "JobId": {
    "name": "id",
    "in": "path",
    "required": true,
    "schema": {
     "type": "string",
     "pattern": "^job_[0-9a-f]{32}$"
    }
   }
  },
  "headers": {
   "GpuSeconds": {
    "description": "GPU time the call used",
    "schema": {
     "type": "number"
    }
   },
   "WattHours": {
    "description": "Energy the call used, from GPU power readings",
    "schema": {
     "type": "number"
    }
   }
  },
  "responses": {
   "E400": {
    "description": "The request is not valid; the message says why",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E401": {
    "description": "No key, or a key the platform does not recognize",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E403": {
    "description": "The key is not a GPULab key, or its account is not approved",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E404": {
    "description": "No such route or job, or a result past its 24 hours",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E413": {
    "description": "Body over 10,485,760 bytes",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E422": {
    "description": "The job failed; the message says why",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E429": {
    "description": "Over a limit, or the queue is busy and the key is free tier; retry after Retry-After seconds",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E502": {
    "description": "A model server did not answer",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "E504": {
    "description": "The request ran past 60 seconds",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Error"
      }
     }
    }
   },
   "Queued": {
    "description": "Queued or running: poll /jobs/{id}/result",
    "content": {
     "application/json": {
      "schema": {
       "$ref": "#/components/schemas/Job"
      }
     }
    },
    "headers": {
     "Location": {
      "description": "Where to read the job",
      "schema": {
       "type": "string"
      }
     }
    }
   }
  }
 }
}
