{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/operatornest-com/json-schema/operatornest-com-ai-api-cost-calculator-result-schema.json",
  "title": "ai-api-cost-calculator-result",
  "x-generated": "2026-11-20",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/operatornest-com-openapi.json#/components/schemas/ai-api-cost-calculator-result",
  "type": "object",
  "properties": {
    "tool": {
      "const": "ai-api-cost-calculator"
    },
    "input": {
      "$ref": "#/$defs/ai-api-cost-calculator-input"
    },
    "units": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "method": {
      "type": "string"
    },
    "assumptions": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "provenance": {
      "type": "object",
      "additionalProperties": {
        "type": "string"
      }
    },
    "estimates": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "modelId": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "perRequest": {
            "type": [
              "number",
              "null"
            ]
          },
          "perDay": {
            "type": [
              "number",
              "null"
            ]
          },
          "perMonth": {
            "type": [
              "number",
              "null"
            ]
          },
          "longContext": {
            "type": "boolean"
          },
          "batch": {
            "type": "boolean"
          },
          "ratesPerMillion": {
            "type": "object",
            "properties": {
              "input": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "cachedInput": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "output": {
                "type": [
                  "number",
                  "null"
                ]
              }
            },
            "required": [
              "input",
              "cachedInput",
              "output"
            ],
            "additionalProperties": false
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri"
          },
          "note": {
            "type": "string"
          }
        },
        "required": [
          "modelId",
          "name",
          "perRequest",
          "perDay",
          "perMonth",
          "longContext",
          "batch",
          "ratesPerMillion",
          "sourceUrl",
          "note"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "tool",
    "input",
    "units",
    "method",
    "assumptions",
    "provenance",
    "estimates"
  ],
  "additionalProperties": false,
  "$defs": {
    "ai-api-cost-calculator-input": {
      "type": "object",
      "additionalProperties": false,
      "properties": {
        "inputTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000000,
          "description": "Total input tokens per request, including cached input tokens."
        },
        "cachedInputTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000000,
          "description": "Cached portion of inputTokens per request; must not exceed inputTokens. Use 0 without caching."
        },
        "outputTokens": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000000,
          "description": "Generated output tokens per request."
        },
        "requestsPerDay": {
          "type": "integer",
          "minimum": 0,
          "maximum": 10000000,
          "description": "Requests used to scale the daily estimate, independent of requestsPerMonth."
        },
        "requestsPerMonth": {
          "type": "integer",
          "minimum": 0,
          "maximum": 100000000,
          "description": "Requests used to scale the monthly estimate; not inferred from the daily count."
        },
        "modelIds": {
          "type": "array",
          "minItems": 1,
          "maxItems": 20,
          "uniqueItems": true,
          "description": "Unique providerId/id values from the MCP pricing catalog. Unknown or unavailable IDs fail validation.",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "description": "Model ID accepted by the MCP pricing catalog."
          }
        },
        "batchModelIds": {
          "type": "array",
          "minItems": 0,
          "maxItems": 20,
          "uniqueItems": true,
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 200,
            "pattern": "\\S",
            "description": "Selected model ID with a published batch discount."
          },
          "description": "Optional subset of modelIds to price with published batch discounts. Omission or [] uses standard rates; IDs without a published discount are rejected."
        }
      },
      "required": [
        "inputTokens",
        "cachedInputTokens",
        "outputTokens",
        "requestsPerDay",
        "requestsPerMonth",
        "modelIds"
      ]
    }
  }
}