{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/greenpixie/json-schema/greenpixie-ratecard-discovery-response-schema.json",
  "title": "RatecardDiscoveryResponse",
  "x-generated": "2026-11-24",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/greenpixie-openapi.yml#/components/schemas/RatecardDiscoveryResponse",
  "properties": {
    "cloud": {
      "items": {
        "$ref": "#/$defs/CloudRatecardSummary"
      },
      "type": "array",
      "title": "Cloud",
      "description": "Every cloud ratecard, by provider + granularity, each tagged with your `access` level. Rows outside your plan are returned masked rather than withheld, so every ratecard here is queryable."
    },
    "grid": {
      "items": {
        "$ref": "#/$defs/GridRatecardSummary"
      },
      "type": "array",
      "title": "Grid",
      "description": "Grid ratecards available to this API key, by granularity."
    },
    "ai": {
      "$ref": "#/$defs/AIRatecardSummary",
      "description": "The AI-token comparison ratecard — per-model electricity, total carbon (operational + embodied), water and list price per 1000 tokens, tagged with your access level."
    }
  },
  "type": "object",
  "required": [
    "cloud",
    "grid",
    "ai"
  ],
  "$defs": {
    "AIRatecardSummary": {
      "properties": {
        "access": {
          "type": "string",
          "title": "Access",
          "description": "Your access to the AI ratecard: `full` (every model returned with real figures) or `preview` (queryable, but the per-token electricity, carbon, water and price are masked as \"OUTSIDE_OF_PLAN\"). All-or-nothing, like grid."
        },
        "latest_version": {
          "title": "Latest Version",
          "description": "The latest AI ratecard version (highest version number), or null if none exists yet.",
          "type": "string"
        },
        "versions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Versions",
          "description": "All AI ratecard versions available, highest version number first."
        },
        "columns": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Columns",
          "description": "Columns returned by the AI ratecard endpoint."
        }
      },
      "type": "object",
      "required": [
        "access",
        "versions",
        "columns"
      ],
      "title": "AIRatecardSummary"
    },
    "CloudRatecardSummary": {
      "properties": {
        "provider": {
          "type": "string",
          "title": "Provider",
          "description": "Cloud service provider."
        },
        "granularity": {
          "type": "string",
          "title": "Granularity",
          "description": "Ratecard granularity. One of: full, service, usage."
        },
        "access": {
          "type": "string",
          "title": "Access",
          "description": "Your access to this cloud ratecard: `full` (every row returned with real values), `partial` (some rows real, the rest masked as \"OUTSIDE_OF_PLAN\"), or `preview` (queryable, but every row masked)."
        },
        "latest_version": {
          "title": "Latest Version",
          "description": "The latest cloud ratecard version (highest version number), or null if none exists yet.",
          "type": "string"
        },
        "versions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Versions",
          "description": "All cloud ratecard versions available, highest version number first."
        },
        "columns": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Columns",
          "description": "Columns returned by this cloud ratecard."
        },
        "filterable_columns": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Filterable Columns",
          "description": "Subset of `columns` the values endpoint accepts as sibling-column equality filters — the string-typed, non-gated, non-internal dimensions. Numeric columns are excluded (a numeric equality filter 400s the values request). A caller scoping value suggestions to the current selection should forward only these columns."
        }
      },
      "type": "object",
      "required": [
        "provider",
        "granularity",
        "access",
        "versions",
        "columns"
      ],
      "title": "CloudRatecardSummary"
    },
    "GridRatecardSummary": {
      "properties": {
        "granularity": {
          "type": "string",
          "title": "Granularity",
          "description": "Grid granularity. One of: yearly, monthly, daily."
        },
        "access": {
          "type": "string",
          "title": "Access",
          "description": "Your access to this grid ratecard: `full` (every row returned with real carbon-intensity values) or `preview` (queryable, but every row's intensity is masked as \"OUTSIDE_OF_PLAN\"). Grid is all-or-nothing per granularity."
        },
        "latest_version": {
          "title": "Latest Version",
          "description": "The latest grid ratecard version (highest version number), or null if none exists yet.",
          "type": "string"
        },
        "versions": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Versions",
          "description": "All grid ratecard versions available, highest version number first."
        },
        "columns": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Columns",
          "description": "Columns returned by the grid ratecard endpoint. Every record carries all of them; `month`, `day` and the data_*_date fields are null where the granularity doesn't apply."
        },
        "time_range": {
          "$ref": "#/$defs/GridTimeRange"
        },
        "latest_available_period": {
          "title": "Latest Available Period",
          "description": "The latest grid period a client can select without hitting a \"no grid data\" error, as a canonical grid_period string for this granularity (`YYYY-MM-DD` daily, `YYYY-MM` monthly, `YYYY` yearly), or null when the latest version has no data. Daily is the latest loaded day; monthly/yearly are the last *complete* period (a partial trailing period from the ~2-day ingest lag is excluded). Scoped to `latest_version`, and version-wide (grid coverage is uniform across csps). Lets a date picker cap its options to what actually exists.",
          "type": "string"
        }
      },
      "type": "object",
      "required": [
        "granularity",
        "access",
        "versions",
        "columns",
        "time_range"
      ],
      "title": "GridRatecardSummary"
    },
    "GridTimeRange": {
      "properties": {
        "start_date": {
          "title": "Start Date",
          "description": "Earliest date covered by the latest version of the grid ratecard data.",
          "type": "string",
          "format": "date"
        },
        "end_date": {
          "title": "End Date",
          "description": "Latest date covered by the latest version of the grid ratecard data.",
          "type": "string",
          "format": "date"
        }
      },
      "type": "object",
      "title": "GridTimeRange"
    }
  }
}