{
  "openapi": "3.1.0",
  "info": {
    "title": "Runware API - Account Management",
    "version": "1.0.0",
    "description": "Account management operation."
  },
  "servers": [
    {
      "url": "https://api.runware.ai/v1",
      "description": "Runware REST API"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "Runware API Key (e.g., Bearer <your-key>)"
      }
    },
    "schemas": {
      "AuthenticationTask": {
        "title": "Authentication",
        "description": "Authenticates a connection using an API key. Can be sent as the first element of the request array as an alternative to using the Authorization header.",
        "type": "object",
        "x-response-schema": "https://schemas.runware.ai/responses/utilities/authentication.json",
        "properties": {
          "taskType": {
            "$id": "https://schemas.runware.ai/requests/parameters/api/task-type.json",
            "title": "Task Type",
            "description": "Identifier for the type of task being performed.",
            "type": "string",
            "const": "authentication"
          },
          "apiKey": {
            "$id": "https://schemas.runware.ai/requests/parameters/authentication/api-key.json",
            "title": "API Key",
            "description": "Your Runware API key.",
            "type": "string"
          },
          "connectionSessionUUID": {
            "$id": "https://schemas.runware.ai/requests/parameters/authentication/connection-session-uuid.json",
            "title": "Connection Session UUID",
            "description": "Optional session UUID to resume a previous connection and receive any buffered results.",
            "type": "string",
            "format": "uuid"
          }
        },
        "required": [
          "taskType",
          "apiKey"
        ],
        "additionalProperties": false
      },
      "RequestBody": {
        "type": "array",
        "items": {
          "title": "Account Management",
          "description": "Account management operation.",
          "type": "object",
          "properties": {
            "taskType": {
              "title": "Task Type",
              "description": "Identifier for the type of task being performed.",
              "type": "string",
              "const": "accountManagement"
            },
            "taskUUID": {
              "title": "Task UUID",
              "description": "UUID v4 identifier for tracking tasks and matching async responses. Must be unique per task.",
              "type": "string",
              "format": "uuid"
            },
            "operation": {
              "title": "Operation",
              "description": "The specific account management operation to perform.",
              "type": "string",
              "enum": [
                "getDetails",
                "getUsageActivity",
                "getUsagePerformance",
                "getUsageErrors"
              ]
            },
            "startDate": {
              "title": "Start Date",
              "description": "Start of the usage window (inclusive).",
              "type": "string",
              "format": "date"
            },
            "endDate": {
              "title": "End Date",
              "description": "End of the usage window (inclusive). Must be on or after startDate, and the span must not exceed 30 days.",
              "type": "string",
              "format": "date"
            },
            "models": {
              "title": "Models",
              "description": "Restrict usage to these model AIRs. Defaults to all models.",
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string"
              }
            },
            "apiKeys": {
              "title": "API Keys",
              "description": "Restrict usage to these API key UUIDs. Defaults to all keys.",
              "type": "array",
              "maxItems": 100,
              "items": {
                "type": "string",
                "format": "uuid"
              }
            },
            "groupBy": {
              "title": "Group By",
              "description": "Breakdowns to return.",
              "type": "array",
              "uniqueItems": true,
              "default": [
                "date",
                "model"
              ],
              "items": {
                "type": "string",
                "oneOf": [
                  {
                    "const": "date",
                    "description": "Per-day timeseries breakdown."
                  },
                  {
                    "const": "model",
                    "description": "Per-model breakdown."
                  },
                  {
                    "const": "apiKey",
                    "description": "Per-API-key breakdown."
                  }
                ]
              }
            },
            "timezone": {
              "title": "Timezone",
              "description": "IANA timezone name used for day-bucketing.",
              "type": "string",
              "default": "UTC"
            }
          },
          "required": [
            "taskType",
            "taskUUID",
            "operation"
          ],
          "allOf": [
            {
              "x-validation-pattern": "DEPENDENCY_INJECTION",
              "if": {
                "properties": {
                  "operation": {
                    "enum": [
                      "getUsageActivity",
                      "getUsagePerformance",
                      "getUsageErrors"
                    ]
                  }
                },
                "required": [
                  "operation"
                ]
              },
              "then": {
                "required": [
                  "startDate",
                  "endDate"
                ]
              }
            },
            {
              "x-validation-pattern": "CONDITIONAL_EXCLUSION",
              "if": {
                "properties": {
                  "operation": {
                    "const": "getDetails"
                  }
                },
                "required": [
                  "operation"
                ]
              },
              "then": {
                "not": {
                  "anyOf": [
                    {
                      "required": [
                        "startDate"
                      ]
                    },
                    {
                      "required": [
                        "endDate"
                      ]
                    },
                    {
                      "required": [
                        "models"
                      ]
                    },
                    {
                      "required": [
                        "apiKeys"
                      ]
                    },
                    {
                      "required": [
                        "groupBy"
                      ]
                    },
                    {
                      "required": [
                        "timezone"
                      ]
                    }
                  ]
                }
              }
            }
          ],
          "additionalProperties": false
        },
        "description": "You must always POST an array of task objects."
      },
      "ResponseBody": {
        "type": "object",
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "title": "Account Management Response",
              "type": "object",
              "definitions": {
                "usageRow": {
                  "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row.json",
                  "title": "Usage Row",
                  "description": "A single usage row. Which metric fields are present depends on the operation.",
                  "type": "object",
                  "properties": {
                    "date": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/date.json",
                      "title": "Date",
                      "description": "Day bucket.",
                      "type": "string",
                      "format": "date"
                    },
                    "model": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/model.json",
                      "title": "Model",
                      "description": "Model AIR.",
                      "type": "string"
                    },
                    "modelName": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/model-name.json",
                      "title": "Model Name",
                      "description": "Human-friendly model name. Falls back to the AIR when none exists.",
                      "type": "string"
                    },
                    "apiKey": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/api-key.json",
                      "title": "API Key",
                      "description": "API key UUID.",
                      "type": "string"
                    },
                    "count": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/count.json",
                      "title": "Count",
                      "description": "Number of requests in this bucket.",
                      "type": "integer"
                    },
                    "spend": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/spend.json",
                      "title": "Spend",
                      "description": "Amount spent in this bucket.",
                      "type": "number"
                    },
                    "clientErrors": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/client-errors.json",
                      "title": "Client Errors",
                      "description": "Number of 4xx (client) errors in this bucket.",
                      "type": "integer"
                    },
                    "serverErrors": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/server-errors.json",
                      "title": "Server Errors",
                      "description": "Number of 5xx (server) errors in this bucket.",
                      "type": "integer"
                    },
                    "avgInferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/avg-inference-time.json",
                      "title": "Average Inference Time",
                      "description": "Average inference time in seconds, or null when there were no inferences.",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "p90InferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/p90-inference-time.json",
                      "title": "P90 Inference Time",
                      "description": "90th-percentile inference time in seconds, or null when there were no inferences.",
                      "type": [
                        "number",
                        "null"
                      ]
                    },
                    "p99InferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/row/p99-inference-time.json",
                      "title": "P99 Inference Time",
                      "description": "99th-percentile inference time in seconds, or null when there were no inferences.",
                      "type": [
                        "number",
                        "null"
                      ]
                    }
                  },
                  "additionalProperties": false
                },
                "usageMeta": {
                  "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta.json",
                  "title": "Usage Meta",
                  "description": "Roll-up totals for a breakdown. Which fields are present depends on the operation.",
                  "type": "object",
                  "properties": {
                    "totalRequests": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/total-requests.json",
                      "title": "Total Requests",
                      "description": "Total requests across the window.",
                      "type": "integer"
                    },
                    "totalResults": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/total-results.json",
                      "title": "Total Results",
                      "description": "Total results produced across the window.",
                      "type": "integer"
                    },
                    "totalSpend": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/total-spend.json",
                      "title": "Total Spend",
                      "description": "Total spend across the window.",
                      "type": "number"
                    },
                    "avgDailySpend": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/avg-daily-spend.json",
                      "title": "Average Daily Spend",
                      "description": "Average spend per day. An estimate that drifts between calls.",
                      "type": "number"
                    },
                    "projectedSpend": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/projected-spend.json",
                      "title": "Projected Spend",
                      "description": "Projected 30-day spend extrapolated from the window. An estimate that drifts between calls.",
                      "type": "number"
                    },
                    "totalErrors": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/total-errors.json",
                      "title": "Total Errors",
                      "description": "Total errors across the window.",
                      "type": "integer"
                    },
                    "errorRate": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/error-rate.json",
                      "title": "Error Rate",
                      "description": "Error rate across the window, as a percentage.",
                      "type": "number"
                    },
                    "avgInferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/avg-inference-time.json",
                      "title": "Average Inference Time",
                      "description": "Average inference time in seconds.",
                      "type": "number"
                    },
                    "p50InferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/p50-inference-time.json",
                      "title": "P50 Inference Time",
                      "description": "Median inference time in seconds.",
                      "type": "number"
                    },
                    "p90InferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/p90-inference-time.json",
                      "title": "P90 Inference Time",
                      "description": "90th-percentile inference time in seconds.",
                      "type": "number"
                    },
                    "p99InferenceTime": {
                      "$id": "https://schemas.runware.ai/responses/parameters/account-management/usage/meta/p99-inference-time.json",
                      "title": "P99 Inference Time",
                      "description": "99th-percentile inference time in seconds.",
                      "type": "number"
                    }
                  },
                  "additionalProperties": false
                }
              },
              "properties": {
                "taskType": {
                  "title": "Task Type",
                  "description": "Identifier for the type of task this response belongs to.",
                  "type": "string",
                  "const": "accountManagement"
                },
                "taskUUID": {
                  "title": "Task UUID",
                  "description": "UUID v4 identifier echoed from the original request, used to match async responses to their tasks.",
                  "type": "string",
                  "format": "uuid"
                },
                "operation": {
                  "title": "Operation",
                  "description": "The account management operation that produced this response.",
                  "type": "string",
                  "enum": [
                    "getDetails",
                    "getUsageActivity",
                    "getUsagePerformance",
                    "getUsageErrors"
                  ]
                },
                "startDate": {
                  "title": "Start Date",
                  "description": "Start of the returned window (inclusive).",
                  "type": "string",
                  "format": "date"
                },
                "endDate": {
                  "title": "End Date",
                  "description": "End of the returned window (inclusive).",
                  "type": "string",
                  "format": "date"
                },
                "organizationName": {
                  "title": "Organization Name",
                  "description": "The name of the organization.",
                  "type": "string"
                },
                "organizationUUID": {
                  "title": "Organization UUID",
                  "description": "Unique identifier for the organization.",
                  "type": "string",
                  "format": "uuid"
                },
                "balance": {
                  "title": "Balance",
                  "description": "Current account balance and currency.",
                  "type": "object",
                  "properties": {
                    "amount": {
                      "title": "Amount",
                      "description": "Current balance amount.",
                      "type": "number"
                    },
                    "freeBalance": {
                      "title": "Free Balance",
                      "description": "Available free credit balance.",
                      "type": "number"
                    },
                    "currency": {
                      "title": "Currency",
                      "description": "Currency code.",
                      "type": "string"
                    }
                  },
                  "required": [
                    "amount",
                    "currency"
                  ],
                  "additionalProperties": false
                },
                "team": {
                  "title": "Team",
                  "description": "List of team members.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "name": {
                        "title": "Name",
                        "description": "Full name of the team member.",
                        "type": "string"
                      },
                      "email": {
                        "title": "Email",
                        "description": "Email address of the team member.",
                        "type": "string",
                        "format": "email"
                      },
                      "roles": {
                        "title": "Roles",
                        "description": "Each team member is assigned a role that determines their level of access within the organization.\n\n| Capability | Owner | Admin | Developer |\n| --- | --- | --- | --- |\n| API generation and Playground | ✓ | ✓ | ✓ |\n| Manage Playground workflows | ✓ | ✓ | ✓ |\n| Create and manage API keys | ✓ | ✓ |  |\n| View API logs and usage analytics | ✓ | ✓ |  |\n| Manage billing and payment methods | ✓ | ✓ |  |\n| Invite and remove team members | ✓ | ✓ |  |\n| Assign Admin and Developer roles | ✓ | ✓ |  |\n| Assign Owner role | ✓ |  |  |\n| Delete organization | ✓ |  |  |\n\n[Read full documentation](https://runware.ai/docs/models-api/utilities/account-management#roles)",
                        "type": "array",
                        "items": {
                          "type": "string",
                          "enum": [
                            "Owner",
                            "Admin",
                            "Developer"
                          ]
                        }
                      },
                      "joinedAt": {
                        "title": "Joined At",
                        "description": "Date and time when the member joined.",
                        "type": "string",
                        "format": "date-time"
                      }
                    },
                    "required": [
                      "name",
                      "email",
                      "roles"
                    ],
                    "additionalProperties": false
                  }
                },
                "apiKeys": {
                  "title": "API Keys",
                  "description": "List of API keys associated with the account.",
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "apiKey": {
                        "title": "API Key",
                        "description": "The API key string (partially masked).",
                        "type": "string"
                      },
                      "name": {
                        "title": "Name",
                        "description": "Name or label for the API key.",
                        "type": "string"
                      },
                      "description": {
                        "title": "Description",
                        "description": "Description of the API key.",
                        "type": "string"
                      },
                      "enabled": {
                        "title": "Enabled",
                        "description": "Whether the API key is active.",
                        "type": "boolean"
                      },
                      "createdAt": {
                        "title": "Created At",
                        "description": "Date and time when the key was created.",
                        "type": "string",
                        "format": "date-time"
                      },
                      "lastUsedAt": {
                        "title": "Last Used At",
                        "description": "Date and time when the key was last used.",
                        "type": "string",
                        "format": "date-time"
                      },
                      "requests": {
                        "title": "Requests",
                        "description": "Total number of requests made with this key.",
                        "type": "integer"
                      }
                    },
                    "required": [
                      "apiKey",
                      "name",
                      "enabled",
                      "createdAt"
                    ],
                    "additionalProperties": false
                  }
                },
                "usage": {
                  "title": "Usage",
                  "description": "Account usage statistics.",
                  "type": "object",
                  "properties": {
                    "today": {
                      "title": "Today",
                      "description": "Usage stats for today.",
                      "type": "object",
                      "properties": {
                        "credits": {
                          "title": "Credits",
                          "description": "Total credits consumed.",
                          "type": "number"
                        },
                        "requests": {
                          "title": "Requests",
                          "description": "Total API requests made.",
                          "type": "integer"
                        }
                      },
                      "required": [
                        "credits",
                        "requests"
                      ],
                      "additionalProperties": false
                    },
                    "last7Days": {
                      "title": "Last 7 Days",
                      "description": "Usage stats for the last 7 days.",
                      "type": "object",
                      "properties": {
                        "credits": {
                          "title": "Credits",
                          "description": "Total credits consumed.",
                          "type": "number"
                        },
                        "requests": {
                          "title": "Requests",
                          "description": "Total API requests made.",
                          "type": "integer"
                        }
                      },
                      "required": [
                        "credits",
                        "requests"
                      ],
                      "additionalProperties": false
                    },
                    "last30Days": {
                      "title": "Last 30 Days",
                      "description": "Usage stats for the last 30 days.",
                      "type": "object",
                      "properties": {
                        "credits": {
                          "title": "Credits",
                          "description": "Total credits consumed.",
                          "type": "number"
                        },
                        "requests": {
                          "title": "Requests",
                          "description": "Total API requests made.",
                          "type": "integer"
                        }
                      },
                      "required": [
                        "credits",
                        "requests"
                      ],
                      "additionalProperties": false
                    },
                    "total": {
                      "title": "Total",
                      "description": "Total lifetime usage stats.",
                      "type": "object",
                      "properties": {
                        "credits": {
                          "title": "Credits",
                          "description": "Total credits consumed.",
                          "type": "number"
                        },
                        "requests": {
                          "title": "Requests",
                          "description": "Total API requests made.",
                          "type": "integer"
                        }
                      },
                      "required": [
                        "credits",
                        "requests"
                      ],
                      "additionalProperties": false
                    },
                    "timeseries": {
                      "title": "Timeseries",
                      "description": "Per-day breakdown (from groupBy date).",
                      "type": "object",
                      "properties": {
                        "data": {
                          "title": "Data",
                          "description": "Rows for this breakdown.",
                          "type": "array",
                          "items": {
                            "title": "Usage Row",
                            "description": "A single usage row. Which metric fields are present depends on the operation.",
                            "type": "object",
                            "properties": {
                              "date": {
                                "title": "Date",
                                "description": "Day bucket.",
                                "type": "string",
                                "format": "date"
                              },
                              "model": {
                                "title": "Model",
                                "description": "Model AIR.",
                                "type": "string"
                              },
                              "modelName": {
                                "title": "Model Name",
                                "description": "Human-friendly model name. Falls back to the AIR when none exists.",
                                "type": "string"
                              },
                              "apiKey": {
                                "title": "API Key",
                                "description": "API key UUID.",
                                "type": "string"
                              },
                              "count": {
                                "title": "Count",
                                "description": "Number of requests in this bucket.",
                                "type": "integer"
                              },
                              "spend": {
                                "title": "Spend",
                                "description": "Amount spent in this bucket.",
                                "type": "number"
                              },
                              "clientErrors": {
                                "title": "Client Errors",
                                "description": "Number of 4xx (client) errors in this bucket.",
                                "type": "integer"
                              },
                              "serverErrors": {
                                "title": "Server Errors",
                                "description": "Number of 5xx (server) errors in this bucket.",
                                "type": "integer"
                              },
                              "avgInferenceTime": {
                                "title": "Average Inference Time",
                                "description": "Average inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p90InferenceTime": {
                                "title": "P90 Inference Time",
                                "description": "90th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p99InferenceTime": {
                                "title": "P99 Inference Time",
                                "description": "99th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "meta": {
                          "title": "Usage Meta",
                          "description": "Roll-up totals for a breakdown. Which fields are present depends on the operation.",
                          "type": "object",
                          "properties": {
                            "totalRequests": {
                              "title": "Total Requests",
                              "description": "Total requests across the window.",
                              "type": "integer"
                            },
                            "totalResults": {
                              "title": "Total Results",
                              "description": "Total results produced across the window.",
                              "type": "integer"
                            },
                            "totalSpend": {
                              "title": "Total Spend",
                              "description": "Total spend across the window.",
                              "type": "number"
                            },
                            "avgDailySpend": {
                              "title": "Average Daily Spend",
                              "description": "Average spend per day. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "projectedSpend": {
                              "title": "Projected Spend",
                              "description": "Projected 30-day spend extrapolated from the window. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "totalErrors": {
                              "title": "Total Errors",
                              "description": "Total errors across the window.",
                              "type": "integer"
                            },
                            "errorRate": {
                              "title": "Error Rate",
                              "description": "Error rate across the window, as a percentage.",
                              "type": "number"
                            },
                            "avgInferenceTime": {
                              "title": "Average Inference Time",
                              "description": "Average inference time in seconds.",
                              "type": "number"
                            },
                            "p50InferenceTime": {
                              "title": "P50 Inference Time",
                              "description": "Median inference time in seconds.",
                              "type": "number"
                            },
                            "p90InferenceTime": {
                              "title": "P90 Inference Time",
                              "description": "90th-percentile inference time in seconds.",
                              "type": "number"
                            },
                            "p99InferenceTime": {
                              "title": "P99 Inference Time",
                              "description": "99th-percentile inference time in seconds.",
                              "type": "number"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "meta"
                      ],
                      "additionalProperties": false
                    },
                    "model": {
                      "title": "Model Breakdown",
                      "description": "Per-model breakdown (from groupBy model).",
                      "type": "object",
                      "properties": {
                        "data": {
                          "title": "Data",
                          "description": "Rows for this breakdown.",
                          "type": "array",
                          "items": {
                            "title": "Usage Row",
                            "description": "A single usage row. Which metric fields are present depends on the operation.",
                            "type": "object",
                            "properties": {
                              "date": {
                                "title": "Date",
                                "description": "Day bucket.",
                                "type": "string",
                                "format": "date"
                              },
                              "model": {
                                "title": "Model",
                                "description": "Model AIR.",
                                "type": "string"
                              },
                              "modelName": {
                                "title": "Model Name",
                                "description": "Human-friendly model name. Falls back to the AIR when none exists.",
                                "type": "string"
                              },
                              "apiKey": {
                                "title": "API Key",
                                "description": "API key UUID.",
                                "type": "string"
                              },
                              "count": {
                                "title": "Count",
                                "description": "Number of requests in this bucket.",
                                "type": "integer"
                              },
                              "spend": {
                                "title": "Spend",
                                "description": "Amount spent in this bucket.",
                                "type": "number"
                              },
                              "clientErrors": {
                                "title": "Client Errors",
                                "description": "Number of 4xx (client) errors in this bucket.",
                                "type": "integer"
                              },
                              "serverErrors": {
                                "title": "Server Errors",
                                "description": "Number of 5xx (server) errors in this bucket.",
                                "type": "integer"
                              },
                              "avgInferenceTime": {
                                "title": "Average Inference Time",
                                "description": "Average inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p90InferenceTime": {
                                "title": "P90 Inference Time",
                                "description": "90th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p99InferenceTime": {
                                "title": "P99 Inference Time",
                                "description": "99th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "meta": {
                          "title": "Usage Meta",
                          "description": "Roll-up totals for a breakdown. Which fields are present depends on the operation.",
                          "type": "object",
                          "properties": {
                            "totalRequests": {
                              "title": "Total Requests",
                              "description": "Total requests across the window.",
                              "type": "integer"
                            },
                            "totalResults": {
                              "title": "Total Results",
                              "description": "Total results produced across the window.",
                              "type": "integer"
                            },
                            "totalSpend": {
                              "title": "Total Spend",
                              "description": "Total spend across the window.",
                              "type": "number"
                            },
                            "avgDailySpend": {
                              "title": "Average Daily Spend",
                              "description": "Average spend per day. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "projectedSpend": {
                              "title": "Projected Spend",
                              "description": "Projected 30-day spend extrapolated from the window. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "totalErrors": {
                              "title": "Total Errors",
                              "description": "Total errors across the window.",
                              "type": "integer"
                            },
                            "errorRate": {
                              "title": "Error Rate",
                              "description": "Error rate across the window, as a percentage.",
                              "type": "number"
                            },
                            "avgInferenceTime": {
                              "title": "Average Inference Time",
                              "description": "Average inference time in seconds.",
                              "type": "number"
                            },
                            "p50InferenceTime": {
                              "title": "P50 Inference Time",
                              "description": "Median inference time in seconds.",
                              "type": "number"
                            },
                            "p90InferenceTime": {
                              "title": "P90 Inference Time",
                              "description": "90th-percentile inference time in seconds.",
                              "type": "number"
                            },
                            "p99InferenceTime": {
                              "title": "P99 Inference Time",
                              "description": "99th-percentile inference time in seconds.",
                              "type": "number"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "meta"
                      ],
                      "additionalProperties": false
                    },
                    "apiKey": {
                      "title": "API Key Breakdown",
                      "description": "Per-key breakdown (from groupBy apiKey).",
                      "type": "object",
                      "properties": {
                        "data": {
                          "title": "Data",
                          "description": "Rows for this breakdown.",
                          "type": "array",
                          "items": {
                            "title": "Usage Row",
                            "description": "A single usage row. Which metric fields are present depends on the operation.",
                            "type": "object",
                            "properties": {
                              "date": {
                                "title": "Date",
                                "description": "Day bucket.",
                                "type": "string",
                                "format": "date"
                              },
                              "model": {
                                "title": "Model",
                                "description": "Model AIR.",
                                "type": "string"
                              },
                              "modelName": {
                                "title": "Model Name",
                                "description": "Human-friendly model name. Falls back to the AIR when none exists.",
                                "type": "string"
                              },
                              "apiKey": {
                                "title": "API Key",
                                "description": "API key UUID.",
                                "type": "string"
                              },
                              "count": {
                                "title": "Count",
                                "description": "Number of requests in this bucket.",
                                "type": "integer"
                              },
                              "spend": {
                                "title": "Spend",
                                "description": "Amount spent in this bucket.",
                                "type": "number"
                              },
                              "clientErrors": {
                                "title": "Client Errors",
                                "description": "Number of 4xx (client) errors in this bucket.",
                                "type": "integer"
                              },
                              "serverErrors": {
                                "title": "Server Errors",
                                "description": "Number of 5xx (server) errors in this bucket.",
                                "type": "integer"
                              },
                              "avgInferenceTime": {
                                "title": "Average Inference Time",
                                "description": "Average inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p90InferenceTime": {
                                "title": "P90 Inference Time",
                                "description": "90th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              },
                              "p99InferenceTime": {
                                "title": "P99 Inference Time",
                                "description": "99th-percentile inference time in seconds, or null when there were no inferences.",
                                "type": [
                                  "number",
                                  "null"
                                ]
                              }
                            },
                            "additionalProperties": false
                          }
                        },
                        "meta": {
                          "title": "Usage Meta",
                          "description": "Roll-up totals for a breakdown. Which fields are present depends on the operation.",
                          "type": "object",
                          "properties": {
                            "totalRequests": {
                              "title": "Total Requests",
                              "description": "Total requests across the window.",
                              "type": "integer"
                            },
                            "totalResults": {
                              "title": "Total Results",
                              "description": "Total results produced across the window.",
                              "type": "integer"
                            },
                            "totalSpend": {
                              "title": "Total Spend",
                              "description": "Total spend across the window.",
                              "type": "number"
                            },
                            "avgDailySpend": {
                              "title": "Average Daily Spend",
                              "description": "Average spend per day. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "projectedSpend": {
                              "title": "Projected Spend",
                              "description": "Projected 30-day spend extrapolated from the window. An estimate that drifts between calls.",
                              "type": "number"
                            },
                            "totalErrors": {
                              "title": "Total Errors",
                              "description": "Total errors across the window.",
                              "type": "integer"
                            },
                            "errorRate": {
                              "title": "Error Rate",
                              "description": "Error rate across the window, as a percentage.",
                              "type": "number"
                            },
                            "avgInferenceTime": {
                              "title": "Average Inference Time",
                              "description": "Average inference time in seconds.",
                              "type": "number"
                            },
                            "p50InferenceTime": {
                              "title": "P50 Inference Time",
                              "description": "Median inference time in seconds.",
                              "type": "number"
                            },
                            "p90InferenceTime": {
                              "title": "P90 Inference Time",
                              "description": "90th-percentile inference time in seconds.",
                              "type": "number"
                            },
                            "p99InferenceTime": {
                              "title": "P99 Inference Time",
                              "description": "99th-percentile inference time in seconds.",
                              "type": "number"
                            }
                          },
                          "additionalProperties": false
                        }
                      },
                      "required": [
                        "data",
                        "meta"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "additionalProperties": false
                }
              },
              "required": [
                "taskType",
                "taskUUID",
                "operation"
              ],
              "allOf": [
                {
                  "if": {
                    "properties": {
                      "operation": {
                        "const": "getDetails"
                      }
                    },
                    "required": [
                      "operation"
                    ]
                  },
                  "then": {
                    "required": [
                      "organizationName",
                      "organizationUUID",
                      "balance",
                      "team",
                      "apiKeys",
                      "usage"
                    ],
                    "properties": {
                      "startDate": false,
                      "endDate": false,
                      "usage": {
                        "required": [
                          "today",
                          "last7Days",
                          "last30Days",
                          "total"
                        ],
                        "properties": {
                          "timeseries": false,
                          "model": false,
                          "apiKey": false
                        }
                      }
                    }
                  }
                },
                {
                  "if": {
                    "properties": {
                      "operation": {
                        "const": "getUsageActivity"
                      }
                    },
                    "required": [
                      "operation"
                    ]
                  },
                  "then": {
                    "required": [
                      "startDate",
                      "endDate",
                      "usage"
                    ],
                    "properties": {
                      "organizationName": false,
                      "organizationUUID": false,
                      "balance": false,
                      "team": false,
                      "apiKeys": false,
                      "usage": {
                        "properties": {
                          "today": false,
                          "last7Days": false,
                          "last30Days": false,
                          "total": false,
                          "timeseries": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "date",
                                    "count",
                                    "spend"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "apiKey": false,
                                    "clientErrors": false,
                                    "serverErrors": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalRequests",
                                  "totalResults",
                                  "totalSpend",
                                  "avgDailySpend",
                                  "projectedSpend"
                                ]
                              }
                            }
                          },
                          "model": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "model",
                                    "modelName",
                                    "count",
                                    "spend"
                                  ],
                                  "properties": {
                                    "apiKey": false,
                                    "clientErrors": false,
                                    "serverErrors": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalRequests",
                                  "totalResults",
                                  "totalSpend",
                                  "avgDailySpend",
                                  "projectedSpend"
                                ]
                              }
                            }
                          },
                          "apiKey": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "apiKey",
                                    "count",
                                    "spend"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "clientErrors": false,
                                    "serverErrors": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalRequests",
                                  "totalResults",
                                  "totalSpend",
                                  "avgDailySpend",
                                  "projectedSpend"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                {
                  "if": {
                    "properties": {
                      "operation": {
                        "const": "getUsagePerformance"
                      }
                    },
                    "required": [
                      "operation"
                    ]
                  },
                  "then": {
                    "required": [
                      "startDate",
                      "endDate",
                      "usage"
                    ],
                    "properties": {
                      "organizationName": false,
                      "organizationUUID": false,
                      "balance": false,
                      "team": false,
                      "apiKeys": false,
                      "usage": {
                        "properties": {
                          "today": false,
                          "last7Days": false,
                          "last30Days": false,
                          "total": false,
                          "timeseries": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "date",
                                    "avgInferenceTime",
                                    "p90InferenceTime",
                                    "p99InferenceTime"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "apiKey": false,
                                    "count": false,
                                    "spend": false,
                                    "clientErrors": false,
                                    "serverErrors": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false
                                }
                              }
                            }
                          },
                          "model": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "model",
                                    "modelName",
                                    "avgInferenceTime",
                                    "p90InferenceTime",
                                    "p99InferenceTime"
                                  ],
                                  "properties": {
                                    "apiKey": false,
                                    "count": false,
                                    "spend": false,
                                    "clientErrors": false,
                                    "serverErrors": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false
                                },
                                "required": [
                                  "totalRequests",
                                  "totalResults",
                                  "totalSpend",
                                  "avgDailySpend",
                                  "projectedSpend",
                                  "avgInferenceTime",
                                  "p50InferenceTime",
                                  "p90InferenceTime",
                                  "p99InferenceTime"
                                ]
                              }
                            }
                          },
                          "apiKey": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "apiKey",
                                    "avgInferenceTime",
                                    "p90InferenceTime",
                                    "p99InferenceTime"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "count": false,
                                    "spend": false,
                                    "clientErrors": false,
                                    "serverErrors": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalErrors": false,
                                  "errorRate": false
                                },
                                "required": [
                                  "totalRequests",
                                  "totalResults",
                                  "totalSpend",
                                  "avgDailySpend",
                                  "projectedSpend",
                                  "avgInferenceTime",
                                  "p50InferenceTime",
                                  "p90InferenceTime",
                                  "p99InferenceTime"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                },
                {
                  "if": {
                    "properties": {
                      "operation": {
                        "const": "getUsageErrors"
                      }
                    },
                    "required": [
                      "operation"
                    ]
                  },
                  "then": {
                    "required": [
                      "startDate",
                      "endDate",
                      "usage"
                    ],
                    "properties": {
                      "organizationName": false,
                      "organizationUUID": false,
                      "balance": false,
                      "team": false,
                      "apiKeys": false,
                      "usage": {
                        "properties": {
                          "today": false,
                          "last7Days": false,
                          "last30Days": false,
                          "total": false,
                          "timeseries": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "date",
                                    "clientErrors",
                                    "serverErrors"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "apiKey": false,
                                    "count": false,
                                    "spend": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalRequests": false,
                                  "totalResults": false,
                                  "totalSpend": false,
                                  "avgDailySpend": false,
                                  "projectedSpend": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalErrors",
                                  "errorRate"
                                ]
                              }
                            }
                          },
                          "model": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "model",
                                    "modelName",
                                    "clientErrors",
                                    "serverErrors"
                                  ],
                                  "properties": {
                                    "apiKey": false,
                                    "count": false,
                                    "spend": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalRequests": false,
                                  "totalResults": false,
                                  "totalSpend": false,
                                  "avgDailySpend": false,
                                  "projectedSpend": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalErrors",
                                  "errorRate"
                                ]
                              }
                            }
                          },
                          "apiKey": {
                            "properties": {
                              "data": {
                                "items": {
                                  "required": [
                                    "apiKey",
                                    "clientErrors",
                                    "serverErrors"
                                  ],
                                  "properties": {
                                    "model": false,
                                    "modelName": false,
                                    "count": false,
                                    "spend": false,
                                    "avgInferenceTime": false,
                                    "p90InferenceTime": false,
                                    "p99InferenceTime": false
                                  }
                                }
                              },
                              "meta": {
                                "properties": {
                                  "totalRequests": false,
                                  "totalResults": false,
                                  "totalSpend": false,
                                  "avgDailySpend": false,
                                  "projectedSpend": false,
                                  "avgInferenceTime": false,
                                  "p50InferenceTime": false,
                                  "p90InferenceTime": false,
                                  "p99InferenceTime": false
                                },
                                "required": [
                                  "totalErrors",
                                  "errorRate"
                                ]
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              ],
              "additionalProperties": false
            }
          }
        }
      },
      "ErrorResponse": {
        "title": "Error Response",
        "description": "Standard error response returned by the Runware API.",
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "code",
                "message"
              ],
              "additionalProperties": true,
              "properties": {
                "code": {
                  "type": "string",
                  "description": "A short identifier for the error (e.g., invalidApiKey, timeoutProvider)."
                },
                "message": {
                  "type": "string",
                  "description": "A human-readable explanation of what went wrong."
                },
                "parameter": {
                  "type": "string",
                  "description": "The request parameter related to the error, if applicable."
                },
                "taskType": {
                  "type": "string",
                  "description": "The task type of the request that failed."
                },
                "taskUUID": {
                  "type": "string",
                  "description": "The unique identifier of the failed request."
                },
                "documentation": {
                  "type": "string",
                  "description": "A link to relevant documentation."
                }
              }
            }
          }
        },
        "required": [
          "errors"
        ],
        "additionalProperties": false
      }
    }
  },
  "paths": {
    "/": {
      "post": {
        "summary": "Run Account Management",
        "description": "Account management operation.",
        "operationId": "run_account_management",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RequestBody"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ResponseBody"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request — Missing or invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized — No valid API key provided.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required — Insufficient account balance.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden — The API key lacks permissions for this request.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "429": {
            "description": "Too Many Requests — Rate limit exceeded.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Server Error — Something went wrong on Runware's end.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "503": {
            "description": "Service Unavailable — Temporarily unavailable (maintenance or capacity).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "security": [
    {
      "apiKeyAuth": []
    }
  ]
}