{
  "openapi": "3.0.3",
  "info": {
    "title": "each::labs Official API v1",
    "description": "Official each::labs API V1.\nThis API provides access to our comprehensive AI model catalog and other resources.\n\n## Public contract notes\n\n- Public API routes handled by request logging include `X-Request-Id` for\n  support and log correlation. Clients may send `X-Request-Id`; otherwise\n  api-service generates one. Root, health, and metrics endpoints are excluded.\n- REST error bodies keep the backward-compatible JSON shape used by existing\n  clients. Most errors include at least `error`; some shared error paths also\n  include `status` and `details`. Use the HTTP status code as the primary\n  programmatic signal unless an endpoint documents a richer envelope.\n- Rate-limit and retry headers are endpoint-dependent. If a response includes\n  `Retry-After`, honor it before retrying; otherwise use bounded exponential\n  backoff for retryable 429/5xx responses.\n",
    "version": "1.0.0",
    "contact": {
      "name": "API Support",
      "email": "support@eachlabs.ai"
    },
    "x-logo": {
      "url": "./logo-white.svg",
      "altText": "each::labs"
    }
  },
  "servers": [
    {
      "url": "https://api.eachlabs.ai",
      "description": "Production server"
    }
  ],
  "tags": [
    {
      "name": "AI Models",
      "description": "Endpoints for listing and retrieving AI models and other resources."
    },
    {
      "name": "AI Models Prediction",
      "description": "Endpoints for managing model predictions"
    },
    {
      "name": "Uploads",
      "description": "Endpoints for uploading files that can be used as model inputs."
    },
    {
      "name": "Executions",
      "description": "Endpoints for listing execution history."
    },
    {
      "name": "Workflows",
      "description": "Endpoints for creating workflows and triggering workflow executions through api-service."
    },
    {
      "name": "OpenAI Compatibility",
      "description": "OpenAI-compatible endpoints for LLM Router requests."
    },
    {
      "name": "Webhooks",
      "description": "Endpoints for retrieving webhook information and delivery history.\n\n**Note:** Currently, webhooks are only supported for Workflows V2. We are actively expanding webhook support to other services and will update this documentation as new integrations become available.\n"
    }
  ],
  "paths": {
    "/v1/models": {
      "get": {
        "tags": [
          "AI Models"
        ],
        "summary": "List AI models",
        "description": "Retrieve a paginated list of AI models with optional filters. Each model carries `cost`, the same price estimate `GET /v1/models/{slug}` returns.",
        "operationId": "listModels",
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by model name (case-insensitive search)",
            "example": "nano-banana-pro-edit"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 50,
              "minimum": 1,
              "maximum": 500
            },
            "description": "Maximum number of results to return",
            "example": 20
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "default": 0,
              "minimum": 0
            },
            "description": "Number of results to skip for pagination",
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/Model"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/models/{slug}": {
      "get": {
        "tags": [
          "AI Models"
        ],
        "summary": "Get model details",
        "description": "Returns a single model's detail payload, including the nullable compact `cost` estimate. Supersedes the removed `GET /v1/model?slug=` query route.\n",
        "operationId": "getModelBySlug",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Model slug identifier",
            "example": "nano-banana-pro-edit"
          }
        ],
        "responses": {
          "200": {
            "description": "Model details retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDetail"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/llm-router/model-catalog": {
      "get": {
        "tags": [
          "AI Models"
        ],
        "summary": "Get eachlabs-llm-router model catalog",
        "description": "Retrieve the featured LLM Router models and the generated model enum schema. The chat completions endpoint also accepts any other chat model ID published by OpenRouter.",
        "operationId": "getLLMRouterModelCatalog",
        "responses": {
          "200": {
            "description": "LLM router model catalog retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/LLMRouterModelCatalog"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/prediction": {
      "post": {
        "tags": [
          "AI Models Prediction"
        ],
        "summary": "Create Model Prediction",
        "description": "Create a new prediction for a specific model.\n\n## Using a configured model fallback\n\nSaving or enabling a model fallback does not automatically apply it to prediction requests. To opt a prediction into an enabled fallback configuration, include `fallback_selector` at the top level of the request body, alongside `model` and `input` (not inside `input`). Its value is the saved fallback configuration's slug, not the fallback model's slug or ID. The configuration must belong to the API key's organization and the requested primary model.\n\nFor example, if you have saved an enabled configuration with the slug `quality-recovery` for `flux-1-1-pro`, send:\n\n```json\n{\n  \"model\": \"flux-1-1-pro\",\n  \"fallback_selector\": \"quality-recovery\",\n  \"input\": {\n    \"prompt\": \"A beautiful sunset over the ocean\",\n    \"aspect_ratio\": \"16:9\"\n  },\n  \"safety_identifier\": \"4b1e7c2a9d0f53e8a6c17b94d2f0e835\"\n}\n```\n\nReplace `quality-recovery` with your saved configuration's slug, and keep `model` and `input` set for the primary model. The saved configuration supplies the fallback models and input mappings. Omit `fallback_selector` to run only the primary model, even when a fallback configuration exists.\n",
        "operationId": "createPrediction",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePredictionRequest"
              },
              "example": {
                "model": "flux-1-1-pro",
                "input": {
                  "prompt": "A beautiful sunset over the ocean with vibrant colors",
                  "aspect_ratio": "16:9"
                },
                "webhook_url": "https://your-app.com/webhook",
                "webhook_secret": "your-secret-key",
                "safety_identifier": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prediction created successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreatePredictionResponse"
                },
                "example": {
                  "status": "success",
                  "message": "Prediction created successfully",
                  "predictionID": "abc123-def456-ghi789"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/prediction/run": {
      "post": {
        "tags": [
          "AI Models Prediction"
        ],
        "summary": "Run Model Prediction Synchronously",
        "description": "Create a prediction and wait for the result. This compatibility endpoint is only supported\nfor models with synchronous execution enabled; unsupported models return a bad request error.\n",
        "operationId": "runPrediction",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreatePredictionRequest"
              },
              "example": {
                "model": "eachlabs-llm-router",
                "input": {
                  "model": "openai/gpt-4o-mini",
                  "messages": [
                    {
                      "role": "user",
                      "content": "Write a one sentence caption."
                    }
                  ]
                },
                "safety_identifier": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Prediction completed or failed synchronously",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RunPredictionResponse"
                },
                "example": {
                  "status": "success",
                  "message": "Prediction completed successfully",
                  "predictionID": "abc123-def456-ghi789",
                  "output": {
                    "text": "A cinematic sunset over the ocean."
                  },
                  "error": ""
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "422": {
            "$ref": "#/components/responses/UnprocessableEntity"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/prediction/{id}": {
      "get": {
        "tags": [
          "AI Models Prediction"
        ],
        "summary": "Get Model Prediction",
        "description": "Retrieve the status and results of a model prediction by its ID.\n\nPrediction statuses are `starting` or `processing` while work is in flight.\nTerminal statuses are `success`, `failed`, and `cancelled`.\n",
        "operationId": "getPrediction",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Prediction ID",
            "example": "abc123-def456-ghi789"
          }
        ],
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Prediction retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Prediction"
                },
                "example": {
                  "id": "abc123-def456-ghi789",
                  "input": {
                    "prompt": "A beautiful sunset over the ocean with vibrant colors",
                    "aspect_ratio": "16:9"
                  },
                  "status": "success",
                  "output": "https://storage.example.com/predictions/abc123/image.jpg",
                  "logs": null,
                  "metrics": {
                    "predict_time": 12.5,
                    "cost": 0.05
                  },
                  "urls": {
                    "cancel": "https://api.eachlabs.ai/v1/prediction/abc123-def456-ghi789/cancel",
                    "get": "https://api.eachlabs.ai/v1/prediction/abc123-def456-ghi789"
                  }
                }
              }
            }
          },
          "404": {
            "description": "Prediction not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                },
                "example": {
                  "error": "Prediction not found"
                }
              }
            }
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/prediction/{id}/cancel": {
      "post": {
        "tags": [
          "AI Models Prediction"
        ],
        "summary": "Cancel Model Prediction",
        "description": "Cancel a running prediction by ID. Cancellation is best-effort for upstream providers;\nnot every provider can interrupt work that is already running. When provider\ncancellation is supported and succeeds, the Eachlabs execution record is updated\nto `cancelled`; otherwise the original prediction may still complete or fail.\n",
        "operationId": "cancelPrediction",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Prediction ID",
            "example": "abc123-def456-ghi789"
          }
        ],
        "responses": {
          "200": {
            "description": "Prediction cancellation accepted",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CancelPredictionResponse"
                },
                "example": {
                  "status": "cancelled",
                  "message": "Prediction canceled successfully",
                  "predictionID": "abc123-def456-ghi789"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/upload/presign": {
      "post": {
        "tags": [
          "Uploads"
        ],
        "summary": "Create Presigned Upload URL",
        "description": "Create a short-lived presigned URL for uploading media files. Upload the raw file bytes\nto `presigned_url` using every header returned in `required_headers`, then pass\n`public_url` as a model input.\n",
        "operationId": "presignUpload",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PresignUploadRequest"
              },
              "example": {
                "content_type": "image/png",
                "file_type": "image"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Presigned upload URL created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PresignUploadResponse"
                },
                "example": {
                  "id": "0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0",
                  "presigned_url": "https://eachlabs-storage.s3.amazonaws.com/uploads/...?X-Amz-Signature=...",
                  "public_url": "https://cdn-us.eachlabs.ai/uploads/0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0.png",
                  "expires_at": "2026-12-08T18:15:00Z",
                  "required_headers": {
                    "x-amz-meta-file-id": "0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0"
                  }
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/files/{id}": {
      "delete": {
        "tags": [
          "Uploads"
        ],
        "summary": "Delete File",
        "description": "Permanently delete a file in your organization: one you uploaded with `POST /v1/upload/presign`\nor one a model generated. Pass the file's `id`. A successful delete removes the stored object, so the\nfile's `public_url` stops resolving. Deletes are idempotent — deleting a file that is already\ngone also returns `204`.\n",
        "operationId": "deleteFile",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "The file id: the `id` field of the presign response, or the File ID shown on the storage page.",
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "204": {
            "description": "File deleted, or already absent. Empty body.",
            "headers": {
              "X-Request-Id": {
                "$ref": "#/components/headers/RequestId"
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/executions": {
      "get": {
        "tags": [
          "Executions"
        ],
        "summary": "List executions (deprecated)",
        "deprecated": true,
        "description": "Deprecated: use `GET /v2/executions` for cursor-based traversal.\nV1 remains available for shallow compatibility.\n\nRetrieve execution history for the authenticated API key's organization\nwith optional filters.\nModel prediction terminal statuses include `success`, `error`, and `cancelled`;\nworkflow executions can surface `running`, `completed`, `failed`, or `cancelled`\ndepending on the originating backend. The `status` filter accepts the\nfour tokens listed on the parameter; unrecognized tokens return 400.\n\nResults cover every API key in the organization that owns the\nauthenticated key.\n\nPagination: `offset` is retained for shallow compatibility but is\ndeprecated for history traversal. Use `GET /v2/executions` and its\nopaque cursor to traverse matching history without an implicit total.\nComputing an exact total over a large execution history is expensive,\nso `total_count` can be capped and is then only a lower bound.\nWhen `from` is omitted, the window defaults to the 90 days ending at\n`to` (or now).\n",
        "operationId": "listExecutions",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Maximum number of executions to return",
            "example": 20
          },
          {
            "name": "offset",
            "in": "query",
            "deprecated": true,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Deprecated shallow-page offset; use GET /v2/executions for traversal. The maximum requested prefix is 1,000 rows, evaluated after limit normalization as offset <= 1000 - appliedLimit. Requests beyond that boundary return {\"error\":\"V1 execution pagination is limited to 1000 rows; use GET /v2/executions with cursor pagination\"}.",
            "example": 0
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter executions by model slug",
            "example": "flux-1-1-pro"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated status filter. Each token must be one of `created`,\n`starting`, `success`, or `error` (lowercase); any other token\nreturns 400 naming the allowed set. An empty or absent parameter\napplies no status filter.\n",
            "example": "success,error"
          },
          {
            "name": "workflow_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by workflow ID",
            "example": "wf_abc123"
          },
          {
            "name": "workflow_execution_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by workflow execution ID",
            "example": "wf_exec_abc123"
          },
          {
            "name": "error_classification",
            "in": "query",
            "schema": {
              "type": "string",
              "enum": [
                "content_moderation",
                "execution_timeout",
                "invalid_user_input",
                "invalid_model_config",
                "provider_auth",
                "provider_error",
                "provider_rate_limit",
                "provider_unavailable",
                "internal_error",
                "unknown"
              ]
            },
            "description": "Comma-separated canonical error classification filter. Restricts\nresults to terminal error executions whose classification is in the\nset; an unrecognized value returns 400. Each value must be one of\nthe listed enum members.\n",
            "example": "provider_rate_limit,provider_unavailable"
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Start of creation time window, as RFC 3339. When omitted, defaults to 90 days before `to` (or before now when `to` is also omitted).",
            "example": "2026-01-01T00:00:00Z"
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "End of creation time window, as RFC 3339",
            "example": "2026-01-31T23:59:59Z"
          }
        ],
        "responses": {
          "200": {
            "description": "List of executions",
            "headers": {
              "Deprecation": {
                "$ref": "#/components/headers/Deprecation"
              },
              "Link": {
                "$ref": "#/components/headers/DeprecationLink"
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListExecutionsResponse"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          }
        }
      }
    },
    "/v2/executions": {
      "get": {
        "tags": [
          "Executions"
        ],
        "summary": "List executions with cursor pagination",
        "description": "Returns a total-free execution page for the authenticated API key's\norganization, ordered by `created_at` descending. Continue with\n`next_cursor` while `has_more` is true. Cursors are opaque and bound to\nthe authenticated scope, normalized filters, order, and applied limit.\nChanging any of those inputs requires restarting without a cursor.\nWhen `from` is omitted, the window defaults to the 90 days ending at\n`to` (or now).\n",
        "operationId": "listExecutionsV2",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 20
            },
            "description": "Maximum number of executions to return"
          },
          {
            "name": "cursor",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Opaque cursor returned as `next_cursor` by the previous page"
          },
          {
            "name": "model",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter executions by public model slug"
          },
          {
            "name": "status",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Comma-separated status filter. Each token must be one of `created`,\n`starting`, `success`, or `error`; any other token returns 400.\n",
            "example": "success,error"
          },
          {
            "name": "workflow_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by workflow ID"
          },
          {
            "name": "workflow_execution_id",
            "in": "query",
            "schema": {
              "type": "string"
            },
            "description": "Filter by workflow execution ID"
          },
          {
            "name": "error_classification",
            "in": "query",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "content_moderation",
                  "execution_timeout",
                  "invalid_user_input",
                  "invalid_model_config",
                  "provider_auth",
                  "provider_error",
                  "provider_rate_limit",
                  "provider_unavailable",
                  "internal_error",
                  "unknown"
                ]
              }
            },
            "description": "Comma-separated canonical error classifications",
            "example": [
              "content_moderation",
              "provider_error"
            ]
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "Start of creation time window, as RFC 3339. When omitted, defaults to 90 days before `to` (or before now when `to` is also omitted)."
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "date-time"
            },
            "description": "End of creation time window, as RFC 3339"
          },
          {
            "name": "api_key_id",
            "in": "query",
            "style": "form",
            "explode": true,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "pattern": "^[0-9]+$"
              }
            },
            "description": "Only executions started with these API keys. Repeat the parameter for several keys (`api_key_id=84854&api_key_id=58135`). Use the `api_key_id` values that rows and `GET /v1/usage` return. A key id outside your organization returns no executions. A value that is not a positive whole number returns `400`. The filter holds across pages that follow `next_cursor`.",
            "example": [
              "84854"
            ]
          }
        ],
        "responses": {
          "200": {
            "description": "Total-free cursor page",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListExecutionsV2Response"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "503": {
            "$ref": "#/components/responses/ServiceUnavailable"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "tags": [
          "OpenAI Compatibility"
        ],
        "summary": "Create Chat Completion",
        "description": "OpenAI-compatible chat completions endpoint backed by Eachlabs LLM Router. Use\n`Authorization: Bearer <API_KEY>` and point an OpenAI-compatible client at\n`https://api.eachlabs.ai/v1`.\n\nThis endpoint uses the OpenAI-compatible error envelope rather than the REST\nerror body described in the global contract notes.\n",
        "operationId": "createChatCompletion",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "X-Eachlabs-Webhook-Url",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "Optional webhook URL for asynchronous result delivery.",
            "example": "https://your-app.com/webhook"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ChatCompletionRequest"
              },
              "example": {
                "model": "openai/gpt-4o-mini",
                "messages": [
                  {
                    "role": "user",
                    "content": "Write a one sentence caption."
                  }
                ],
                "safety_identifier": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI-compatible chat completion. Requests with `stream: true` return Server-Sent Events.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ChatCompletionResponse"
                }
              },
              "text/event-stream": {
                "schema": {
                  "type": "string",
                  "description": "Server-Sent Events stream for requests with `stream: true`.\nEvents use OpenAI-compatible `chat.completion.chunk` payloads\nand the stream terminates with `data: [DONE]`.\n"
                },
                "example": "data: {\"id\":\"chatcmpl-abc123\",\"object\":\"chat.completion.chunk\",\"choices\":[{\"index\":0,\"delta\":{\"content\":\"A cinematic\"},\"finish_reason\":null}]}\n\ndata: [DONE]\n"
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audio/transcriptions": {
      "post": {
        "tags": [
          "OpenAI Compatibility"
        ],
        "summary": "Transcribe an audio file",
        "description": "OpenAI-compatible bounded file transcription. Use `Authorization: Bearer\n<API_KEY>` and `multipart/form-data`. The initial profile supports files up\nto 25 MB and `json` or `verbose_json` responses. Unsupported OpenAI fields\nare rejected explicitly.\n\nThe accepted model set is a curated per-environment allowlist that a model\njoins only after passing contract qualification; `openai/whisper-large-v3`\nis the launch model. Requesting a model outside the allowlist returns a 400\nwithout dispatching audio.\n\nThis endpoint is independently feature-gated during preview rollout. A\ndisabled deployment returns an OpenAI-shaped 404 without dispatching audio.\nIt is synchronous and does not use prediction polling or streaming.\n",
        "operationId": "createAudioTranscription",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "multipart/form-data": {
              "schema": {
                "$ref": "#/components/schemas/AudioTranscriptionRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OpenAI-compatible JSON transcription response",
            "headers": {
              "X-Generation-Id": {
                "description": "Upstream generation identifier when available.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AudioTranscriptionResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid multipart input or unsupported field/model/format",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Capability disabled for this deployment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Audio file exceeds 25 MB",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Provider rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Authentication or transcription service temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Transcription request timed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/audio/speech": {
      "post": {
        "tags": [
          "OpenAI Compatibility"
        ],
        "summary": "Stream synthesized speech",
        "description": "OpenAI-compatible text-to-speech. Use `Authorization: Bearer <API_KEY>`\nand a JSON body. The response is a raw audio byte stream forwarded\nprogressively (no prediction polling); the negotiated content type is\nreturned verbatim (`audio/mpeg` for mp3, `audio/pcm;rate=…;channels=…`\nfor pcm). An omitted `response_format` defaults to `mp3`.\n\nThe accepted model/voice/format set is a curated per-environment\ncatalog that a model joins only after passing contract qualification;\n`deepgram/aura-2` is the launch model. An unsupported model, voice, or\nformat, or a `speed`/`instructions` value for a model that does not\nsupport it, returns a 400 without dispatching a synthesis.\n\nThis endpoint is independently feature-gated during preview rollout. A\ndisabled deployment returns an OpenAI-shaped 404 without dispatching.\n",
        "operationId": "createAudioSpeech",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AudioSpeechRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Raw audio byte stream. Bytes are forwarded progressively as the\nprovider synthesizes them; the content type is the negotiated\nformat (`audio/mpeg` or `audio/pcm;rate=…;channels=…`).\n",
            "headers": {
              "X-Generation-Id": {
                "description": "Upstream generation identifier for out-of-band billing reconciliation.",
                "schema": {
                  "type": "string"
                }
              },
              "X-Execution-ID": {
                "description": "Eachlabs execution identifier for the synthesis.",
                "schema": {
                  "type": "string"
                }
              }
            },
            "content": {
              "audio/mpeg": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              },
              "audio/pcm": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "400": {
            "description": "Unsupported model/voice/format/param or invalid input",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Authentication failed",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Insufficient balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Capability disabled for this deployment",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "413": {
            "description": "Request body exceeds the maximum size",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Provider rate limit reached",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Authentication or speech service temporarily unavailable",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          },
          "504": {
            "description": "Speech request timed out",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OpenAIErrorResponse"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workflows": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Create workflow",
        "description": "Create a new workflow together with its initial version. This route forwards to\nworkflows-engine, which generates the slug, persists the workflow + version, and\nprovisions the execution state machine.\n\nOnly `name` is required. `definition` is the workflow DSL as an arbitrary JSON\nobject (steps, input_schema, metadata). Categories, tags, and visibility are not\naccepted on this route — workflows-engine applies its defaults (categories\n`[\"general\"]`, visibility `private`).\n",
        "operationId": "createWorkflow",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowCreateRequest"
              },
              "example": {
                "name": "My Workflow",
                "definition": {
                  "version": "1.0",
                  "steps": []
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Workflow created",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowDetailResponse"
                },
                "example": {
                  "workflow_id": "wf_abc123",
                  "slug": "my-workflow",
                  "name": "My Workflow",
                  "categories": [
                    "general"
                  ],
                  "tags": [],
                  "status": "active",
                  "trigger_count": 0,
                  "clone_count": 0,
                  "is_public": false,
                  "production": false,
                  "created_at": "2026-01-01T00:00:00Z",
                  "updated_at": "2026-01-01T00:00:00Z",
                  "versions": [
                    {
                      "version_id": "v1",
                      "slug": "my-workflow",
                      "published": false,
                      "locked": false,
                      "production": false,
                      "allowed_to_share": false,
                      "trigger_count": 0,
                      "created_at": "2026-01-01T00:00:00Z",
                      "updated_at": "2026-01-01T00:00:00Z",
                      "definition": {
                        "version": "1.0",
                        "steps": []
                      },
                      "status": "active"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/workflows/trigger/{workflowID}/{versionID}": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Trigger workflow execution",
        "description": "Start an asynchronous workflow execution through api-service. This route forwards to\nworkflows-engine and requires callers to pin the workflow version in the path.\n\nThe immediate response only confirms the workflow was queued. Downstream workflow\nlifecycle statuses are `running`, `completed`, `failed`, and `cancelled`.\nTo queue several executions of the same version in one call, use the bulk trigger route.\n",
        "operationId": "triggerWorkflowExecution",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "workflowID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Workflow ID or slug to execute.",
            "example": "wf_abc123"
          },
          {
            "name": "versionID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Workflow version ID to execute.",
            "example": "v1"
          },
          {
            "name": "webhook_url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "Optional compatibility query parameter for execution completion webhooks. The request body field takes precedence when both are present.",
            "example": "https://your-app.com/webhook"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowTriggerRequest"
              },
              "example": {
                "inputs": {
                  "prompt": "A cinematic establishing shot of a mountain lake"
                },
                "webhook_url": "https://your-app.com/webhook",
                "webhook_secret": "your-secret-key",
                "safety_identifier": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Workflow execution queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowTriggerResponse"
                },
                "example": {
                  "execution_id": "exec_xyz789",
                  "status": "queued"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/workflows/bulk-trigger/{workflowID}/{versionID}": {
      "post": {
        "tags": [
          "Workflows"
        ],
        "summary": "Bulk trigger workflow executions",
        "description": "Queue several asynchronous executions of one workflow version in a single call\n(maximum 10 inputs per request). Each entry in `inputs` becomes its own execution;\nall executions share a single `bulk_id` for grouped tracking and consolidated\nwebhook delivery. This route forwards to workflows-engine and requires callers to\npin the workflow version in the path.\n\nThe immediate response only confirms the executions were queued. A per-input failure\nis reported inline on its `executions` entry (`status: failed` + `message`) — the\nbulk call still returns 202 so partial failures don't lose the queued executions.\n",
        "operationId": "bulkTriggerWorkflowExecutions",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "workflowID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Workflow ID or slug to execute.",
            "example": "wf_abc123"
          },
          {
            "name": "versionID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Workflow version ID to execute.",
            "example": "v1"
          },
          {
            "name": "webhook_url",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "description": "Optional compatibility query parameter for execution completion webhooks. The request body field takes precedence when both are present.",
            "example": "https://your-app.com/webhook"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WorkflowBulkTriggerRequest"
              },
              "example": {
                "inputs": [
                  {
                    "prompt": "A cinematic establishing shot of a mountain lake"
                  },
                  {
                    "prompt": "A close-up of dew on a spider web at sunrise"
                  }
                ],
                "webhook_url": "https://your-app.com/webhook",
                "webhook_secret": "your-secret-key",
                "safety_identifier": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Workflow executions queued",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowBulkTriggerResponse"
                },
                "example": {
                  "bulk_id": "bulk_abc123",
                  "executions": [
                    {
                      "execution_id": "exec_xyz789",
                      "status": "queued"
                    },
                    {
                      "status": "failed",
                      "message": "invalid input value"
                    }
                  ]
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "402": {
            "$ref": "#/components/responses/PaymentRequired"
          },
          "403": {
            "$ref": "#/components/responses/Forbidden"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "408": {
            "$ref": "#/components/responses/RequestTimeout"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "502": {
            "$ref": "#/components/responses/BadGateway"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/workflows/{workflowID}/executions": {
      "get": {
        "tags": [
          "Executions"
        ],
        "summary": "List workflow executions",
        "description": "Retrieve a paginated list of executions for a specific workflow.\n\nWhen a `bulk_id` query parameter is provided, only executions queued by that bulk\ntrigger operation are returned. Pagination applies with the same `limit` and\n`offset` parameters.\n",
        "operationId": "listWorkflowExecutions",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "workflowID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Workflow ID or slug.",
            "example": "wf_abc123"
          },
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of executions to return per page.",
            "example": 50
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of executions to skip for pagination.",
            "example": 0
          },
          {
            "name": "bulk_id",
            "in": "query",
            "schema": {
              "type": "string",
              "format": "uuid"
            },
            "description": "Optional filter: only return executions queued by this bulk trigger operation. The `bulk_id` is returned by the bulk trigger endpoint.",
            "example": "550e8400-e29b-41d4-a716-446655440000"
          }
        ],
        "responses": {
          "200": {
            "description": "List of workflow executions",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowExecutionsListResponse"
                },
                "example": {
                  "executions": [
                    {
                      "execution_id": "exec-1",
                      "flow_id": "wf-123",
                      "flow_name": "Text to Image Generator",
                      "version_id": "v1",
                      "status": "completed",
                      "started_at": "2026-01-01T10:00:00Z",
                      "ended_at": "2026-01-01T10:05:00Z",
                      "created_at": "2026-01-01T10:00:00Z",
                      "updated_at": "2026-01-01T10:05:00Z"
                    },
                    {
                      "execution_id": "exec-2",
                      "flow_id": "wf-123",
                      "flow_name": "Text to Image Generator",
                      "version_id": "v1",
                      "status": "running",
                      "started_at": "2026-01-01T10:10:00Z",
                      "created_at": "2026-01-01T10:10:00Z",
                      "updated_at": "2026-01-01T10:10:00Z"
                    }
                  ],
                  "limit": 50,
                  "total_count": 142
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/workflows/executions/{executionID}": {
      "get": {
        "tags": [
          "Executions"
        ],
        "summary": "Get workflow execution",
        "description": "Retrieve the detail of a single workflow execution: status, inputs,\nper-step outputs, final output, error, and `total_cost` (the summed\ncost of the run's model executions). Scoped to the authenticated\ncaller's organization; returns 404 when the execution is missing or\nowned by another organization.\n",
        "operationId": "getWorkflowExecution",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "executionID",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "The workflow execution id.",
            "example": "b3b1f1a0-0000-0000-0000-000000000000"
          }
        ],
        "responses": {
          "200": {
            "description": "Workflow execution detail",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "execution_id": {
                      "type": "string"
                    },
                    "workflow_id": {
                      "type": "string"
                    },
                    "version_id": {
                      "type": "string",
                      "description": "Workflow version the execution ran against."
                    },
                    "bulk_id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string",
                      "example": "completed"
                    },
                    "started_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "RFC3339 timestamp; omitted until the run starts."
                    },
                    "completed_at": {
                      "type": "string",
                      "format": "date-time",
                      "description": "RFC3339 timestamp; omitted until the run finishes."
                    },
                    "inputs": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "step_outputs": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "output": {
                      "description": "Free-form final output (object, array, or scalar)."
                    },
                    "workflow_output": {
                      "type": "object",
                      "additionalProperties": true
                    },
                    "error": {
                      "type": "string"
                    },
                    "error_cause": {
                      "type": "string"
                    },
                    "total_cost": {
                      "type": "number",
                      "format": "double",
                      "nullable": true,
                      "description": "Summed cost of the run's model executions. Present only once the execution is terminal (completed/failed/cancelled); omitted while running or if unavailable."
                    }
                  }
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/webhooks": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "List webhooks",
        "description": "Retrieve a paginated list of webhooks for the authenticated organization",
        "operationId": "listWebhooks",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 100,
              "default": 50
            },
            "description": "Maximum number of webhooks to return",
            "example": 50
          },
          {
            "name": "offset",
            "in": "query",
            "schema": {
              "type": "integer",
              "minimum": 0,
              "default": 0
            },
            "description": "Number of webhooks to skip for pagination",
            "example": 0
          }
        ],
        "responses": {
          "200": {
            "description": "List of webhooks",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListWebhooksResponse"
                }
              }
            }
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    },
    "/v1/webhooks/{execution_id}": {
      "get": {
        "tags": [
          "Webhooks"
        ],
        "summary": "Get webhook by execution ID",
        "description": "Retrieve details of a specific webhook including delivery attempts by execution ID",
        "operationId": "getWebhook",
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "parameters": [
          {
            "name": "execution_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Execution ID for tracking the webhook",
            "example": "abc123-def456-ghi789"
          }
        ],
        "responses": {
          "200": {
            "description": "Webhook details",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookWithAttempts"
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "500": {
            "$ref": "#/components/responses/InternalServerError"
          }
        }
      }
    }
  },
  "components": {
    "headers": {
      "RequestId": {
        "description": "Request correlation ID. Echoes the incoming `X-Request-Id` header or a generated ID.",
        "schema": {
          "type": "string"
        },
        "example": "123e4567-e89b-12d3-a456-426614174000"
      },
      "RetryAfter": {
        "description": "Optional retry delay returned by rate-limit or upstream retry responses when available.",
        "schema": {
          "oneOf": [
            {
              "type": "integer",
              "minimum": 0
            },
            {
              "type": "string"
            }
          ]
        },
        "example": 30
      },
      "Deprecation": {
        "description": "RFC 9745 date indicating that GET /v1/executions is deprecated.",
        "schema": {
          "type": "string"
        },
        "example": "@1788480000"
      },
      "DeprecationLink": {
        "description": "Link to execution-list migration guidance.",
        "schema": {
          "type": "string"
        },
        "example": "<https://docs.eachlabs.ai/changelog>; rel=\"deprecation\"; type=\"text/html\""
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "API key passed as `Authorization: Bearer <api_key>`"
      }
    },
    "schemas": {
      "Model": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "example": "Nano Banana Pro Edit"
          },
          "slug": {
            "type": "string",
            "example": "nano-banana-pro-edit"
          },
          "version": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated. Always returns \"0.0.1\". Will be removed in a future version.",
            "example": "0.0.1"
          },
          "output_type": {
            "type": "string",
            "example": "array"
          },
          "request_schema": {
            "type": "object",
            "description": "JSON Schema for API requests to this model.\nDefines the structure, types, and validation rules for making requests.\n",
            "example": {
              "type": "object",
              "required": [
                "prompt"
              ],
              "properties": {
                "prompt": {
                  "type": "string",
                  "minLength": 10,
                  "maxLength": 500
                },
                "num_images": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 4,
                  "default": 1
                }
              }
            }
          },
          "cost": {
            "$ref": "#/components/schemas/ModelCostEstimate"
          }
        }
      },
      "ModelDetail": {
        "type": "object",
        "required": [
          "cost"
        ],
        "properties": {
          "title": {
            "type": "string",
            "example": "Nano Banana Pro Edit"
          },
          "slug": {
            "type": "string",
            "example": "nano-banana-pro-edit"
          },
          "version": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated. Always returns \"0.0.1\". Will be removed in a future version.",
            "example": "0.0.1"
          },
          "output_type": {
            "type": "string",
            "example": "array"
          },
          "request_schema": {
            "type": "object",
            "description": "JSON Schema for API requests to this model.\nDefines the structure, types, and validation rules for making requests.\n",
            "example": {
              "type": "object",
              "required": [
                "prompt"
              ],
              "properties": {
                "prompt": {
                  "type": "string",
                  "minLength": 10,
                  "maxLength": 500
                }
              }
            }
          },
          "cost": {
            "$ref": "#/components/schemas/ModelCostEstimate"
          }
        }
      },
      "ModelCostEstimate": {
        "type": "object",
        "nullable": true,
        "required": [
          "currency",
          "type",
          "amount",
          "unit",
          "estimate",
          "description",
          "min",
          "max",
          "depends_on",
          "rows"
        ],
        "description": "Nullable pricing guidance for planning. Returns `null` only when the model has no pricing document. Estimates may change with provider rates, promotions, or model configuration; use `metrics.cost` after execution for the settled value.\n",
        "properties": {
          "currency": {
            "type": "string",
            "enum": [
              "USD"
            ],
            "example": "USD"
          },
          "type": {
            "type": "string",
            "enum": [
              "fixed",
              "usage_based"
            ],
            "description": "Whether the estimate is fixed per execution or usage-based.",
            "example": "fixed"
          },
          "amount": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Estimated USD amount for fixed pricing; otherwise `null`.",
            "example": 0.04
          },
          "unit": {
            "type": "string",
            "nullable": true,
            "enum": [
              "execution",
              "second",
              "processing_second",
              "minute",
              "hour",
              "image",
              "megapixel",
              "million_tokens",
              "character",
              "step",
              "generation"
            ],
            "description": "Billing unit for fixed and usage-based pricing; `null` when no public rate is listed.",
            "example": "execution"
          },
          "estimate": {
            "type": "string",
            "description": "Presentation-ready price guidance. Usage-based pricing may\ninclude a safely recognized unit rate, range, or billing\ndriver; otherwise it falls back to `Usage-based pricing`.\n",
            "example": "$0.068–$0.28 per second, depending on resolution"
          },
          "description": {
            "type": "string",
            "enum": [
              "Pricing is an estimate and may change as rates are updated."
            ],
            "example": "Pricing is an estimate and may change as rates are updated."
          },
          "min": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Minimum estimated USD amount per unit for usage-based pricing; otherwise `null`.",
            "example": 0.03
          },
          "max": {
            "type": "number",
            "format": "double",
            "nullable": true,
            "description": "Maximum estimated USD amount per unit for usage-based pricing; otherwise `null`.",
            "example": 0.12
          },
          "depends_on": {
            "type": "array",
            "description": "Inputs that change the price, such as resolution or duration, in the order row labels list them. May be empty.",
            "items": {
              "type": "string"
            },
            "example": [
              "resolution"
            ]
          },
          "rows": {
            "type": "array",
            "description": "Price per option combination in USD per unit. A base row's label lists the option values in depends_on order joined by \" · \"; a label starting with \"+ \" is an add-on added to the base row when the request turns it on; the label ending in \" (default)\" is the combination used when inputs are omitted. May be empty.",
            "items": {
              "type": "object",
              "required": [
                "label",
                "value"
              ],
              "properties": {
                "label": {
                  "type": "string",
                  "description": "Option values joined by \" · \", an add-on starting with \"+ \", or a combination ending in \" (default)\".",
                  "example": "720p · 5 s"
                },
                "value": {
                  "type": "number",
                  "format": "double",
                  "example": 0.03
                }
              }
            }
          }
        }
      },
      "LLMRouterModelCatalog": {
        "type": "object",
        "properties": {
          "slug": {
            "type": "string",
            "example": "eachlabs-llm-router"
          },
          "source": {
            "type": "string",
            "enum": [
              "catalog",
              "odoo_fallback"
            ]
          },
          "version": {
            "type": "integer",
            "example": 1
          },
          "updated_at": {
            "type": "string",
            "example": "2026-05-24"
          },
          "model_enum": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "openai/gpt-5.2",
              "anthropic/claude-sonnet-4-6"
            ]
          },
          "request_schema": {
            "type": "object",
            "description": "JSON Schema fragment containing the generated model enum."
          },
          "models": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LLMRouterCatalogModel"
            }
          }
        }
      },
      "LLMRouterCatalogModel": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "example": "openai/gpt-5.2"
          },
          "status": {
            "type": "string",
            "example": "visible"
          },
          "family": {
            "type": "string",
            "example": "openai"
          },
          "canonical_provider": {
            "type": "string",
            "example": "openrouter"
          },
          "canonical_target_model": {
            "type": "string",
            "example": "openai/gpt-5.2"
          },
          "routing_policy": {
            "type": "string",
            "example": "explicit_route"
          },
          "legacy_requesty": {
            "type": "boolean"
          },
          "title": {
            "type": "string",
            "example": "GPT-5.2"
          },
          "description": {
            "type": "string"
          },
          "faqs": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/LLMRouterCatalogFAQ"
            }
          },
          "readme_md": {
            "type": "string"
          }
        }
      },
      "LLMRouterCatalogFAQ": {
        "type": "object",
        "properties": {
          "question": {
            "type": "string"
          },
          "answer": {
            "type": "string"
          }
        }
      },
      "WorkflowTriggerRequest": {
        "type": "object",
        "properties": {
          "inputs": {
            "type": "object",
            "additionalProperties": true,
            "description": "Input values defined by the workflow version. May be omitted for workflows with no inputs.",
            "example": {
              "prompt": "A cinematic establishing shot of a mountain lake"
            }
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional webhook URL for workflow execution completion.",
            "example": "https://your-app.com/webhook"
          },
          "webhook_secret": {
            "type": "string",
            "description": "Optional secret used to sign workflow webhook requests.",
            "example": "your-secret-key"
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this request is for. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        },
        "required": [
          "safety_identifier"
        ]
      },
      "WorkflowTriggerResponse": {
        "type": "object",
        "properties": {
          "execution_id": {
            "type": "string",
            "description": "Queued workflow execution identifier.",
            "example": "exec_xyz789"
          },
          "status": {
            "type": "string",
            "enum": [
              "queued"
            ],
            "description": "Execution queue status returned immediately after triggering.",
            "example": "queued"
          }
        }
      },
      "WorkflowCreateRequest": {
        "type": "object",
        "required": [
          "name"
        ],
        "properties": {
          "name": {
            "type": "string",
            "description": "Human-readable workflow name. Required.",
            "example": "My Workflow"
          },
          "definition": {
            "type": "object",
            "additionalProperties": true,
            "description": "Workflow DSL (steps, input_schema, metadata) as a JSON object.",
            "example": {
              "version": "1.0",
              "steps": []
            }
          }
        }
      },
      "WorkflowDetailResponse": {
        "type": "object",
        "description": "The created workflow (summary fields + its versions).",
        "properties": {
          "workflow_id": {
            "type": "string",
            "example": "wf_abc123"
          },
          "slug": {
            "type": "string",
            "example": "my-workflow"
          },
          "name": {
            "type": "string",
            "example": "My Workflow"
          },
          "categories": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": [
              "general"
            ]
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "example": []
          },
          "status": {
            "type": "string",
            "example": "active"
          },
          "trigger_count": {
            "type": "integer",
            "example": 0
          },
          "clone_count": {
            "type": "integer",
            "example": 0
          },
          "is_public": {
            "type": "boolean",
            "example": false
          },
          "production": {
            "type": "boolean",
            "example": false
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "versions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/WorkflowVersionDetail"
            }
          }
        }
      },
      "WorkflowVersionDetail": {
        "type": "object",
        "properties": {
          "version_id": {
            "type": "string",
            "example": "v1"
          },
          "slug": {
            "type": "string",
            "example": "my-workflow"
          },
          "published": {
            "type": "boolean",
            "example": false
          },
          "locked": {
            "type": "boolean",
            "example": false
          },
          "production": {
            "type": "boolean",
            "example": false
          },
          "allowed_to_share": {
            "type": "boolean",
            "example": false
          },
          "trigger_count": {
            "type": "integer",
            "example": 0
          },
          "created_at": {
            "type": "string",
            "format": "date-time"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time"
          },
          "definition": {
            "type": "object",
            "additionalProperties": true,
            "description": "The version's workflow DSL."
          },
          "status": {
            "type": "string",
            "example": "active"
          }
        }
      },
      "WorkflowBulkTriggerRequest": {
        "type": "object",
        "required": [
          "inputs",
          "safety_identifier"
        ],
        "properties": {
          "inputs": {
            "type": "array",
            "minItems": 1,
            "maxItems": 10,
            "description": "One input object per execution (1–10), each validated against the workflow version's input schema. Every entry must be a JSON object; a non-object entry (array, string, number) rejects the whole request with 400 rather than failing only that item.",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "example": [
              {
                "prompt": "A cinematic establishing shot of a mountain lake"
              },
              {
                "prompt": "A close-up of dew on a spider web at sunrise"
              }
            ]
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional webhook URL applied to every execution in the batch.",
            "example": "https://your-app.com/webhook"
          },
          "webhook_secret": {
            "type": "string",
            "description": "Optional secret used to sign workflow webhook requests.",
            "example": "your-secret-key"
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this batch is for. It applies to every execution in the batch, so batch only the inputs of one person or one job together; if the inputs belong to different end users, send one trigger per end user. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        }
      },
      "WorkflowBulkTriggerResponse": {
        "type": "object",
        "properties": {
          "bulk_id": {
            "type": "string",
            "description": "Identifier grouping every execution queued by this request.",
            "example": "bulk_abc123"
          },
          "executions": {
            "type": "array",
            "description": "One acknowledgment per input, in request order.",
            "items": {
              "type": "object",
              "properties": {
                "execution_id": {
                  "type": "string",
                  "description": "Queued execution identifier. Absent on a per-input failure.",
                  "example": "exec_xyz789"
                },
                "status": {
                  "type": "string",
                  "description": "Per-execution queue status (`queued`) or `failed` for an input that could not be queued.",
                  "example": "queued"
                },
                "message": {
                  "type": "string",
                  "description": "Failure reason, present only when status is `failed`.",
                  "example": "invalid input value"
                }
              }
            }
          }
        }
      },
      "WorkflowExecutionSummary": {
        "type": "object",
        "description": "Summary of one workflow execution, as returned by the list endpoint.",
        "required": [
          "execution_id",
          "flow_id",
          "flow_name",
          "version_id",
          "status",
          "created_at"
        ],
        "properties": {
          "execution_id": {
            "type": "string",
            "description": "Unique execution identifier",
            "example": "exec-1"
          },
          "flow_id": {
            "type": "string",
            "description": "Workflow identifier (UUID)",
            "example": "wf-123"
          },
          "flow_name": {
            "type": "string",
            "description": "Human-readable workflow name",
            "example": "Text to Image Generator"
          },
          "version_id": {
            "type": "string",
            "description": "Version identifier for this execution",
            "example": "v1"
          },
          "api_key": {
            "type": "string",
            "description": "User/API key identifier that triggered this execution",
            "example": "user-456"
          },
          "status": {
            "type": "string",
            "enum": [
              "running",
              "completed",
              "failed",
              "cancelled"
            ],
            "description": "Current execution status",
            "example": "completed"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp when the execution started (omitted if not started yet)",
            "example": "2026-01-01T10:00:00Z"
          },
          "ended_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp when the execution completed (omitted for running executions)",
            "example": "2026-01-01T10:05:00Z"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp when the execution was created",
            "example": "2026-01-01T10:00:00Z"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp when the execution was last updated",
            "example": "2026-01-01T10:05:00Z"
          },
          "deleted_at": {
            "type": "string",
            "format": "date-time",
            "description": "RFC3339 timestamp when the execution was soft-deleted (if applicable)"
          },
          "inputs": {
            "type": "object",
            "additionalProperties": true,
            "description": "Input parameters provided when triggering the workflow",
            "example": {
              "prompt": "Generate an image of a sunset"
            }
          },
          "step_results": {
            "description": "Brief summary of step execution results. Structure varies — may be an object with step IDs as keys, or an array.",
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "array",
                "items": {}
              }
            ]
          },
          "output": {
            "type": "string",
            "description": "Simple string output from the workflow (if available). For complex outputs, use `output_json` instead.",
            "example": "https://storage.googleapis.com/uploads/image.png"
          },
          "output_json": {
            "type": "object",
            "additionalProperties": true,
            "description": "Structured JSON output from the workflow (if available). Contains the full workflow output when output mapping is configured.",
            "example": {
              "image_url": "https://storage.googleapis.com/uploads/image.png",
              "generation_time": 2.45
            }
          },
          "cost": {
            "description": "Cost information for this execution (if available). Structure varies by provider and workflow configuration.",
            "oneOf": [
              {
                "type": "object"
              },
              {
                "type": "number"
              }
            ]
          }
        }
      },
      "WorkflowExecutionsListResponse": {
        "type": "object",
        "description": "Paginated list of workflow executions",
        "required": [
          "executions",
          "limit",
          "total_count"
        ],
        "properties": {
          "executions": {
            "type": "array",
            "description": "Array of execution summaries",
            "items": {
              "$ref": "#/components/schemas/WorkflowExecutionSummary"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Applied page size",
            "example": 50
          },
          "total_count": {
            "type": "integer",
            "description": "Total number of executions matching the query",
            "example": 142
          }
        }
      },
      "Error": {
        "type": "object",
        "description": "Backward-compatible REST error body. Endpoint-specific handlers may return only\n`error`; shared error paths may also include `status` and `details`.\n",
        "properties": {
          "status": {
            "type": "integer",
            "description": "HTTP status code, when returned by the shared error handler.",
            "example": 400
          },
          "error": {
            "type": "string",
            "description": "Safe user-facing error message.",
            "example": "error message"
          },
          "details": {
            "nullable": true,
            "description": "Optional validation or request details for client errors."
          }
        },
        "required": [
          "error"
        ]
      },
      "CreatePredictionRequest": {
        "type": "object",
        "required": [
          "model",
          "input",
          "safety_identifier"
        ],
        "properties": {
          "model": {
            "type": "string",
            "description": "Model slug or identifier",
            "example": "flux-1-1-pro"
          },
          "fallback_selector": {
            "type": "string",
            "minLength": 1,
            "maxLength": 50,
            "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$",
            "description": "Optional opt-in to an enabled, saved fallback configuration for this organization and primary model. Use the configuration's slug, not a fallback model slug or ID. Set this at the top level of the request, not inside input. Saving a configuration alone does not enable fallback for a request: omitting this field runs only the primary model. Use 1-50 lowercase letters and digits separated by single hyphens.",
            "example": "quality-recovery"
          },
          "version": {
            "type": "string",
            "deprecated": true,
            "description": "Deprecated. This field is ignored. Kept for backwards compatibility.",
            "example": "0.0.1"
          },
          "input": {
            "type": "object",
            "description": "Input parameters for the prediction",
            "additionalProperties": true,
            "example": {
              "prompt": "A beautiful sunset over the ocean with vibrant colors",
              "aspect_ratio": "16:9"
            }
          },
          "webhook_url": {
            "type": "string",
            "format": "uri",
            "description": "Optional webhook URL to receive prediction result asynchronously",
            "example": "https://your-app.com/webhook"
          },
          "webhook_secret": {
            "type": "string",
            "description": "Optional secret used to sign webhook requests",
            "example": "your-secret-key"
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this request is for. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        }
      },
      "CreatePredictionResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Status of the prediction creation request",
            "example": "success"
          },
          "message": {
            "type": "string",
            "description": "Human-readable message about the prediction creation",
            "example": "Prediction created successfully"
          },
          "predictionID": {
            "type": "string",
            "description": "Unique prediction identifier",
            "example": "abc123-def456-ghi789"
          }
        }
      },
      "RunPredictionResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "success",
              "failed",
              "cancelled"
            ],
            "description": "Final terminal status of the synchronous prediction",
            "example": "success"
          },
          "message": {
            "type": "string",
            "description": "Human-readable message",
            "example": "Prediction completed successfully"
          },
          "predictionID": {
            "type": "string",
            "description": "Unique prediction identifier",
            "example": "abc123-def456-ghi789"
          },
          "output": {
            "description": "Prediction output, when available",
            "nullable": true,
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array"
              },
              {
                "type": "object"
              }
            ]
          },
          "error": {
            "type": "string",
            "description": "User-facing error message when the prediction failed",
            "example": ""
          }
        }
      },
      "CancelPredictionResponse": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "cancelled"
            ],
            "description": "Cancellation status returned when the cancellation request succeeds",
            "example": "cancelled"
          },
          "message": {
            "type": "string",
            "description": "Human-readable cancellation message",
            "example": "Prediction canceled successfully"
          },
          "predictionID": {
            "type": "string",
            "description": "Unique prediction identifier",
            "example": "abc123-def456-ghi789"
          }
        }
      },
      "Prediction": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Unique prediction identifier",
            "example": "abc123-def456-ghi789"
          },
          "input": {
            "type": "object",
            "description": "Input parameters used for the prediction",
            "additionalProperties": true,
            "example": {
              "prompt": "A beautiful sunset over the ocean with vibrant colors",
              "aspect_ratio": "16:9"
            }
          },
          "status": {
            "type": "string",
            "description": "Current status of the prediction. `starting` and `processing` are\nnon-terminal. `success`, `failed`, and `cancelled` are terminal.\n",
            "enum": [
              "starting",
              "processing",
              "success",
              "failed",
              "cancelled"
            ],
            "example": "success"
          },
          "output": {
            "description": "Prediction output (type varies based on model)",
            "oneOf": [
              {
                "type": "string"
              },
              {
                "type": "array"
              },
              {
                "type": "object"
              }
            ],
            "example": "https://storage.example.com/predictions/abc123/image.jpg"
          },
          "logs": {
            "type": "string",
            "nullable": true,
            "description": "Execution logs from the prediction",
            "example": null
          },
          "metrics": {
            "type": "object",
            "description": "Performance and cost metrics",
            "properties": {
              "predict_time": {
                "type": "number",
                "description": "Time taken for prediction in seconds",
                "example": 12.5
              },
              "cost": {
                "type": "number",
                "description": "Cost of the prediction in USD",
                "example": 0.05
              },
              "tier": {
                "type": "string",
                "description": "Compute tier the job was metered on. Present on metered video predictions; omitted for other models",
                "example": "cpu"
              },
              "billed_seconds": {
                "type": "integer",
                "description": "Execution seconds the engine metered and billed. Present on metered video predictions; omitted for other models",
                "example": 191
              },
              "output_gb": {
                "type": "number",
                "description": "Delivered output size in GB, the basis for the delivery charge. Present on metered video predictions; omitted for other models",
                "example": 0.0024
              }
            }
          },
          "urls": {
            "type": "object",
            "description": "Related API endpoints",
            "properties": {
              "cancel": {
                "type": "string",
                "format": "uri",
                "description": "URL to cancel the prediction",
                "example": "https://api.eachlabs.ai/v1/prediction/abc123-def456-ghi789/cancel"
              },
              "get": {
                "type": "string",
                "format": "uri",
                "description": "URL to get the prediction",
                "example": "https://api.eachlabs.ai/v1/prediction/abc123-def456-ghi789"
              }
            }
          }
        }
      },
      "PresignUploadRequest": {
        "type": "object",
        "required": [
          "content_type"
        ],
        "properties": {
          "content_type": {
            "type": "string",
            "description": "MIME type of the file to upload",
            "example": "image/png"
          },
          "file_type": {
            "type": "string",
            "description": "High-level file category",
            "enum": [
              "image",
              "video",
              "audio",
              "other"
            ],
            "example": "image"
          },
          "expires_in_seconds": {
            "type": "integer",
            "description": "How long the stored file is retained before automatic deletion, in seconds. Sets `expires_at` in the response. Defaults to 180 days when omitted; clamped to a minimum of 60 seconds and a maximum of 365 days (31536000). Does not affect the 15-minute upload-URL lifetime.",
            "minimum": 60,
            "maximum": 31536000,
            "example": 604800
          }
        }
      },
      "PresignUploadResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Upload identifier",
            "example": "0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0"
          },
          "presigned_url": {
            "type": "string",
            "format": "uri",
            "description": "Short-lived URL for uploading raw file bytes",
            "example": "https://eachlabs-storage.s3.amazonaws.com/uploads/...?X-Amz-Signature=..."
          },
          "public_url": {
            "type": "string",
            "format": "uri",
            "description": "Public URL to pass as a model input after upload succeeds",
            "example": "https://cdn-us.eachlabs.ai/uploads/0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0.png"
          },
          "expires_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the stored file is automatically deleted (its retention deadline). Defaults to 180 days out; controlled by `expires_in_seconds`. Not the upload-URL deadline — the presigned URL only accepts uploads for 15 minutes after issuance.",
            "example": "2026-12-08T18:15:00Z"
          },
          "required_headers": {
            "type": "object",
            "description": "Headers that must be sent verbatim with the upload PUT request",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "x-amz-meta-file-id": "0dce0f44-b8a5-4f30-91d4-5f6b0c221bf0"
            }
          }
        }
      },
      "ExecutionSummary": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Execution identifier",
            "example": "exec_abc123"
          },
          "model": {
            "type": "string",
            "description": "Model slug",
            "example": "flux-1-1-pro"
          },
          "requested_model": {
            "type": "string",
            "nullable": true,
            "description": "The field is always present in the JSON response. Its value is the original LLM model requested through `eachlabs-llm-router`, or null for other executions",
            "example": "openai/gpt-4.1-mini"
          },
          "status": {
            "type": "string",
            "description": "Execution status. Model prediction terminal statuses include `success`,\n`error`, and `cancelled`; workflow executions can surface `running`,\n`completed`, `failed`, or `cancelled` depending on the originating backend.\n",
            "example": "success"
          },
          "workflow_id": {
            "type": "string",
            "nullable": true,
            "description": "Workflow ID, when execution was triggered by a workflow",
            "example": "wf_abc123"
          },
          "workflow_execution_id": {
            "type": "string",
            "nullable": true,
            "description": "Workflow execution ID, when execution was triggered by a workflow",
            "example": "wf_exec_abc123"
          },
          "execution_cost": {
            "type": "number",
            "description": "Execution cost in USD",
            "example": 0.05
          },
          "run_time": {
            "type": "number",
            "description": "Runtime in seconds",
            "example": 12.5
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "Creation timestamp",
            "example": "2026-01-01T00:00:00Z"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Start timestamp",
            "example": "2026-01-01T00:00:02Z"
          },
          "completed_at": {
            "type": "string",
            "format": "date-time",
            "nullable": true,
            "description": "Completion timestamp",
            "example": "2026-01-01T00:00:15Z"
          },
          "output": {
            "type": "string",
            "nullable": true,
            "description": "Primary execution output, when available",
            "example": "https://storage.example.com/predictions/abc123/image.jpg"
          },
          "api_key_id": {
            "type": "string",
            "nullable": true,
            "description": "ID of the API key that started the execution, the same `api_key_id` that `GET /v1/usage` returns. `null` for an execution made without an API key.",
            "example": "84854"
          }
        }
      },
      "ListExecutionsResponse": {
        "type": "object",
        "properties": {
          "executions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionSummary"
            }
          },
          "total_count": {
            "type": "integer",
            "description": "Number of matching executions. When `total_capped` is `true` this is a lower bound, not the exact total. Use `GET /v2/executions` and its opaque cursor for history traversal rather than relying on this count as a pagination stop condition.",
            "example": 123
          },
          "total_capped": {
            "type": "boolean",
            "description": "`true` when the server did not compute the exact count (the count is capped, or its time budget elapsed) and `total_count` is a lower bound — more matching executions may exist beyond it.",
            "example": false
          },
          "offset": {
            "type": "integer",
            "description": "Applied offset",
            "example": 0
          },
          "limit": {
            "type": "integer",
            "description": "Applied limit",
            "example": 20
          }
        },
        "required": [
          "executions",
          "total_count",
          "total_capped",
          "offset",
          "limit"
        ]
      },
      "ListExecutionsV2Response": {
        "type": "object",
        "required": [
          "executions",
          "limit",
          "has_more",
          "next_cursor"
        ],
        "properties": {
          "executions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ExecutionSummary"
            }
          },
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 100,
            "description": "Applied page limit",
            "example": 20
          },
          "has_more": {
            "type": "boolean",
            "description": "Whether another page is available",
            "example": true
          },
          "next_cursor": {
            "type": "string",
            "nullable": true,
            "description": "Opaque cursor for the next page; null at exhaustion"
          }
        }
      },
      "ChatCompletionRequest": {
        "type": "object",
        "description": "OpenAI-compatible chat completions request body",
        "required": [
          "model",
          "messages",
          "safety_identifier"
        ],
        "additionalProperties": true,
        "properties": {
          "model": {
            "type": "string",
            "description": "Model ID. Any chat model ID from OpenRouter's model list works (for example `openai/gpt-5.6-sol`); see Available Models in the LLM Router docs.",
            "example": "openai/gpt-5.6-sol"
          },
          "messages": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            },
            "description": "OpenAI-compatible chat messages",
            "example": [
              {
                "role": "user",
                "content": "Write a one sentence caption."
              }
            ]
          },
          "stream": {
            "type": "boolean",
            "description": "Set to `true` to receive OpenAI-compatible SSE chunks (`text/event-stream`) instead of a buffered JSON response.",
            "example": false
          },
          "stream_options": {
            "type": "object",
            "nullable": true,
            "additionalProperties": true,
            "description": "Optional OpenAI-compatible streaming options. When `include_usage` is true, the stream may include a final usage chunk before `[DONE]`.",
            "properties": {
              "include_usage": {
                "type": "boolean",
                "description": "Include token usage in the streamed response when provider usage data is available.",
                "example": true
              }
            }
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this request is for. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        }
      },
      "ChatCompletionResponse": {
        "type": "object",
        "description": "OpenAI-compatible chat completions response",
        "properties": {
          "id": {
            "type": "string",
            "example": "chatcmpl-abc123"
          },
          "object": {
            "type": "string",
            "example": "chat.completion"
          },
          "created": {
            "type": "integer",
            "format": "int64",
            "example": 1773651600
          },
          "model": {
            "type": "string",
            "example": "eachlabs-llm-router"
          },
          "choices": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "index": {
                  "type": "integer",
                  "example": 0
                },
                "message": {
                  "type": "object",
                  "properties": {
                    "role": {
                      "type": "string",
                      "example": "assistant"
                    },
                    "content": {
                      "type": "string",
                      "example": "A cinematic sunset over the ocean."
                    }
                  }
                },
                "finish_reason": {
                  "type": "string",
                  "example": "stop"
                }
              }
            }
          },
          "usage": {
            "type": "object",
            "nullable": true,
            "properties": {
              "prompt_tokens": {
                "type": "integer",
                "example": 12
              },
              "completion_tokens": {
                "type": "integer",
                "example": 8
              },
              "total_tokens": {
                "type": "integer",
                "example": 20
              }
            }
          }
        }
      },
      "AudioTranscriptionRequest": {
        "type": "object",
        "required": [
          "file",
          "model",
          "safety_identifier"
        ],
        "properties": {
          "file": {
            "type": "string",
            "format": "binary",
            "description": "FLAC, MP3/MPEG/MPGA, MP4/M4A, OGG, WAV, or WebM audio up to 25 MB."
          },
          "model": {
            "type": "string",
            "example": "openai/whisper-large-v3",
            "description": "Must be in the environment's transcription allowlist. Requesting a model outside it returns 400 without dispatching audio."
          },
          "language": {
            "type": "string",
            "maxLength": 32,
            "description": "Optional ISO language code."
          },
          "response_format": {
            "type": "string",
            "default": "json",
            "enum": [
              "json",
              "verbose_json"
            ]
          },
          "temperature": {
            "type": "number",
            "minimum": 0,
            "maximum": 1
          },
          "timestamp_granularities[]": {
            "type": "array",
            "description": "Available only with `verbose_json`; repeat the multipart field for multiple values.",
            "items": {
              "type": "string",
              "enum": [
                "word",
                "segment"
              ]
            }
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this request is for. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        }
      },
      "AudioSpeechRequest": {
        "type": "object",
        "required": [
          "model",
          "input",
          "voice",
          "safety_identifier"
        ],
        "properties": {
          "model": {
            "type": "string",
            "example": "deepgram/aura-2",
            "description": "Must be in the environment's speech catalog. An unlisted model returns 400 without dispatching a synthesis."
          },
          "input": {
            "type": "string",
            "description": "Text to synthesize. Bounded by the model's per-character limit (counted in Unicode runes)."
          },
          "voice": {
            "type": "string",
            "example": "aura-2-thalia-en",
            "description": "Model-specific, namespaced voice id. Must be allowlisted for the model."
          },
          "response_format": {
            "type": "string",
            "default": "mp3",
            "description": "Audio format. Omitted defaults to `mp3`. Allowed values are per-model (e.g. `mp3`, `pcm`).",
            "example": "mp3"
          },
          "speed": {
            "type": "number",
            "minimum": 0.25,
            "maximum": 4.0,
            "description": "Playback speed. Accepted only for models that declare support; otherwise 400."
          },
          "instructions": {
            "type": "string",
            "description": "Steering instructions. Accepted only for models that declare support; otherwise 400."
          },
          "stream_format": {
            "type": "string",
            "enum": [
              "audio"
            ],
            "description": "Only raw audio streaming is supported. `sse` is rejected with 400."
          },
          "safety_identifier": {
            "type": "string",
            "minLength": 1,
            "maxLength": 256,
            "description": "Required. Stable, pseudonymous ID of the real person this request is for. A value that is not a string, is longer than 256 characters, or contains a control character is ignored, and the request is treated as missing. See https://docs.eachlabs.ai/safety-identifier",
            "example": "4b1e7c2a9d0f53e8a6c17b94d2f0e835"
          }
        }
      },
      "AudioTranscriptionResponse": {
        "type": "object",
        "required": [
          "text"
        ],
        "properties": {
          "text": {
            "type": "string"
          },
          "language": {
            "type": "string"
          },
          "duration": {
            "type": "number"
          },
          "segments": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "words": {
            "type": "array",
            "items": {
              "type": "object",
              "additionalProperties": true
            }
          },
          "usage": {
            "type": "object",
            "additionalProperties": true
          }
        }
      },
      "OpenAIErrorResponse": {
        "type": "object",
        "description": "OpenAI-compatible error envelope used by chat, audio, and realtime compatibility endpoints.",
        "properties": {
          "error": {
            "type": "object",
            "properties": {
              "message": {
                "type": "string",
                "example": "Invalid API key"
              },
              "type": {
                "type": "string",
                "example": "authentication_error"
              },
              "param": {
                "type": "string",
                "example": "model"
              },
              "code": {
                "type": "string",
                "example": "invalid_api_key"
              }
            }
          }
        }
      },
      "Webhook": {
        "type": "object",
        "description": "Webhook information without attempts",
        "properties": {
          "execution_id": {
            "type": "string",
            "nullable": true,
            "description": "Execution identifier for tracking",
            "example": "abc123-def456-ghi789"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "description": "Target URL for webhook delivery",
            "example": "https://api.example.com/webhook"
          },
          "request": {
            "type": "string",
            "description": "Original request payload",
            "example": "{\"event\":\"prediction.completed\"}"
          },
          "headers": {
            "type": "object",
            "description": "Headers included in the webhook request",
            "additionalProperties": {
              "type": "string"
            },
            "example": {
              "Content-Type": "application/json"
            }
          },
          "source": {
            "type": "string",
            "description": "Service that triggered the webhook",
            "example": "api-gateway"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the webhook was created",
            "example": "2025-12-14T10:30:00Z"
          }
        },
        "required": [
          "url",
          "request",
          "source",
          "created_at"
        ]
      },
      "WebhookWithAttempts": {
        "allOf": [
          {
            "$ref": "#/components/schemas/Webhook"
          },
          {
            "type": "object",
            "properties": {
              "attempts": {
                "type": "array",
                "description": "Delivery attempts for this webhook",
                "items": {
                  "$ref": "#/components/schemas/WebhookAttempt"
                }
              }
            }
          }
        ]
      },
      "WebhookAttempt": {
        "type": "object",
        "description": "Individual webhook delivery attempt",
        "properties": {
          "status": {
            "type": "string",
            "enum": [
              "PENDING",
              "SUCCESS",
              "FAILED"
            ],
            "description": "Status of the delivery attempt",
            "example": "SUCCESS"
          },
          "status_code": {
            "type": "integer",
            "nullable": true,
            "description": "HTTP status code from target URL",
            "example": 200
          },
          "response": {
            "type": "string",
            "nullable": true,
            "description": "Response body from target URL",
            "example": "{\"received\":true}"
          },
          "error_message": {
            "type": "string",
            "nullable": true,
            "description": "Error message if delivery failed",
            "example": "connection timeout"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "description": "When the attempt was made",
            "example": "2025-12-14T10:30:05Z"
          }
        },
        "required": [
          "status",
          "created_at"
        ]
      },
      "ListWebhooksResponse": {
        "type": "object",
        "properties": {
          "webhooks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Webhook"
            }
          },
          "limit": {
            "type": "integer",
            "description": "Applied limit",
            "example": 50
          },
          "offset": {
            "type": "integer",
            "description": "Applied offset",
            "example": 0
          },
          "total_count": {
            "type": "integer",
            "description": "Total number of matching webhooks",
            "example": 123
          }
        },
        "required": [
          "webhooks",
          "limit",
          "offset",
          "total_count"
        ]
      }
    },
    "responses": {
      "BadRequest": {
        "description": "Bad request",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "slug parameter is required"
            }
          }
        }
      },
      "NotFound": {
        "description": "Resource not found",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Failed to fetch model: model not found"
            }
          }
        }
      },
      "Unauthorized": {
        "description": "Authentication required or invalid credentials",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Invalid or missing API key"
            }
          }
        }
      },
      "PaymentRequired": {
        "description": "Insufficient balance",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "insufficient balance"
            }
          }
        }
      },
      "Forbidden": {
        "description": "Forbidden",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "forbidden"
            }
          }
        }
      },
      "Conflict": {
        "description": "Conflict with current resource state",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "conflict"
            }
          }
        }
      },
      "RequestTimeout": {
        "description": "Upstream request timed out",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Request timeout"
            }
          }
        }
      },
      "UnprocessableEntity": {
        "description": "Request body could not be processed",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "invalid request body"
            }
          }
        }
      },
      "BadGateway": {
        "description": "Upstream service unavailable",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "workflows-engine unavailable"
            }
          }
        }
      },
      "ServiceUnavailable": {
        "description": "Service temporarily unavailable",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "execution store unavailable"
            }
          }
        }
      },
      "InternalServerError": {
        "description": "Internal server error",
        "headers": {
          "X-Request-Id": {
            "$ref": "#/components/headers/RequestId"
          }
        },
        "content": {
          "application/json": {
            "schema": {
              "$ref": "#/components/schemas/Error"
            },
            "example": {
              "error": "Failed to fetch models: internal error"
            }
          }
        }
      }
    }
  }
}
