{
  "openapi": "3.1.0",
  "info": {
    "title": "Price of AI",
    "version": "1.0.0",
    "summary": "Normalised, day-fresh pricing for hosted LLM APIs.",
    "description": "Price of AI is a licensed JSON API that publishes normalised LLM pricing for OpenAI, Anthropic, Azure AI Foundry, Google Cloud (Vertex AI), AWS Bedrock, STACKIT, Mistral AI, IONOS, xAI and Oracle Cloud.\n\nEach record is enriched with currency, billing unit, region bucket (EU / Global), freshness, confidence, license and source-provenance metadata, so downstream consumers can drive billing, cost dashboards, FinOps reporting, or LLM-gateway price routing.\n\nPricing is refreshed daily at 00:00 Europe/Berlin and pushed atomically into the live snapshot. `priceHistory` is delta-written so consumers can rely on `ETag`/`X-Data-Version`/`Last-Modified` cache validators to skip unchanged pulls.\n\nThe component schemas in this document are auto-derived at build time from the production Zod definitions, so they cannot drift apart from the live API.",
    "termsOfService": "https://price-of-ai.innfactory.de/api/terms",
    "contact": {
      "name": "innFactory GmbH",
      "url": "https://innfactory.de"
    },
    "license": {
      "name": "Price of AI Commercial License",
      "url": "https://price-of-ai.innfactory.de/api/terms"
    }
  },
  "servers": [
    {
      "url": "https://price-of-ai.web.app",
      "description": "Production hosting URL (recommended; rewrites to the regional Cloud Function)."
    },
    {
      "url": "https://api-onl7zw5nwa-ey.a.run.app",
      "description": "Direct Cloud Run URL of the API function in europe-west3."
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "tags": [
    {
      "name": "Prices",
      "description": "Normalised price records with multi-tier (on-demand, cache, batch) billing dimensions."
    },
    {
      "name": "Models",
      "description": "Canonical model registry with context window, capabilities, and aliases."
    },
    {
      "name": "Quote",
      "description": "Deterministic per-call cost quote for AI-gateway billing."
    },
    {
      "name": "Diff",
      "description": "Catalog change feed since a given timestamp."
    },
    {
      "name": "Status",
      "description": "Per-provider crawl freshness, retrieval status and source attribution."
    },
    {
      "name": "Quarantine",
      "description": "Records withheld from the public catalog after a cross-source mismatch."
    },
    {
      "name": "LocalInference",
      "description": "GPU + open-source LLM catalogs powering the local-vs-cloud TCO calculator."
    },
    {
      "name": "Admin",
      "description": "Privileged operations for trusted clients (e.g. trigger an out-of-band crawl)."
    }
  ],
  "paths": {
    "/api/v1/prices": {
      "get": {
        "tags": [
          "Prices"
        ],
        "summary": "List price records",
        "description": "Returns normalised price records matching the given filters. Supports cursor-based pagination via the `cursor` query parameter; cursors are bound to a `dataVersion` and become invalid when the underlying snapshot rotates (returns HTTP 409 `DATA_VERSION_CONFLICT`).",
        "operationId": "listPrices",
        "parameters": [
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Filter by provider ID. Comma-separated list.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "azure",
                  "google",
                  "aws",
                  "stackit",
                  "mistral",
                  "ionos",
                  "xai",
                  "oracle"
                ]
              }
            }
          },
          {
            "name": "platform",
            "in": "query",
            "required": false,
            "description": "Filter by platform ID. Comma-separated list.",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string",
                "enum": [
                  "openai-direct",
                  "anthropic-direct",
                  "azure-ai-foundry",
                  "vertex-ai",
                  "aws-bedrock",
                  "stackit-direct",
                  "mistral-direct",
                  "ionos-ai-model-hub",
                  "xai-direct",
                  "oracle-genai"
                ]
              }
            }
          },
          {
            "name": "model",
            "in": "query",
            "required": false,
            "description": "Filter by stable model ID (provider-scoped, e.g. `openai.gpt-5`).",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "description": "Filter by region ID (e.g. `europe-west3`, `eu-average`, `global-average`).",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "modality",
            "in": "query",
            "required": false,
            "description": "Filter by modality (`text`, `embedding`, `image`, `audio_stt`, `audio_tts`, `video`).",
            "style": "form",
            "explode": false,
            "schema": {
              "type": "array",
              "items": {
                "type": "string"
              }
            }
          },
          {
            "name": "billing_dimension",
            "in": "query",
            "required": false,
            "description": "Filter by billing dimension (e.g. `input_tokens`, `output_tokens`).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "source_currency",
            "in": "query",
            "required": false,
            "description": "ISO 4217 currency filter (records are USD-denominated today).",
            "schema": {
              "type": "string",
              "pattern": "^[A-Z]{3}$"
            },
            "example": "USD"
          },
          {
            "name": "freshness_status",
            "in": "query",
            "required": false,
            "description": "Filter by freshness bucket.",
            "schema": {
              "type": "string",
              "enum": [
                "fresh",
                "stale",
                "expired"
              ]
            }
          },
          {
            "name": "include_stale",
            "in": "query",
            "required": false,
            "description": "Set to `false` to exclude stale records.",
            "schema": {
              "type": "boolean",
              "default": true
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "description": "Max records per page (default 100, hard cap 500).",
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 500,
              "default": 100
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "description": "Opaque continuation cursor (URL-safe base64), bound to a `dataVersion`.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Page of normalised price records.",
            "headers": {
              "ETag": {
                "description": "Strong validator equal to `X-Data-Version`.",
                "schema": {
                  "type": "string"
                }
              },
              "Last-Modified": {
                "description": "Server time at which this page was assembled.",
                "schema": {
                  "type": "string",
                  "format": "http-date"
                }
              },
              "X-Data-Version": {
                "description": "Stable hash of the underlying snapshot.",
                "schema": {
                  "type": "string"
                }
              },
              "Cache-Control": {
                "description": "`private, max-age=300` — clients may cache for up to 5 minutes.",
                "schema": {
                  "type": "string"
                }
              },
              "X-RateLimit-Limit": {
                "description": "Per-key rate limit ceiling (reserved; today returns `0`).",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Remaining": {
                "description": "Per-key rate-limit remaining (reserved; today returns `0`).",
                "schema": {
                  "type": "integer"
                }
              },
              "X-RateLimit-Reset": {
                "description": "Window reset epoch seconds (reserved; today returns `0`).",
                "schema": {
                  "type": "integer"
                }
              }
            },
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/PricesPage"
                }
              }
            }
          },
          "400": {
            "description": "Invalid filter values (malformed cursor, unknown provider, bad currency, etc.).",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "405": {
            "description": "Method not allowed; only GET is supported.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "The supplied cursor belongs to an older `dataVersion`; restart pagination.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/status": {
      "get": {
        "tags": [
          "Status"
        ],
        "summary": "List provider crawl statuses",
        "description": "Returns one entry per supported provider with the most-recent crawl outcome.",
        "operationId": "listProviderStatus",
        "responses": {
          "200": {
            "description": "Latest per-provider status.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/StatusResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/crawl": {
      "post": {
        "tags": [
          "Admin"
        ],
        "summary": "Trigger an out-of-band crawl",
        "description": "Privileged endpoint that runs the full crawler and atomically replaces the live catalog. Requires an API key with the `canCrawl` scope.",
        "operationId": "triggerCrawl",
        "responses": {
          "200": {
            "description": "Crawl finished; latest counts attached.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CrawlResponse"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Authenticated, but the API key lacks the `canCrawl` scope.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/models": {
      "get": {
        "tags": [
          "Models"
        ],
        "summary": "List canonical models",
        "description": "Returns every model in the canonical registry with its display name, family, context window, max output tokens, capabilities and known aliases. Useful for AI-gateway routing tables and capability gating.",
        "operationId": "listModels",
        "parameters": [
          {
            "name": "family",
            "in": "query",
            "required": false,
            "description": "Filter by family marker (`gpt`, `claude`, `gemini`, `mistral`, etc.).",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "capability",
            "in": "query",
            "required": false,
            "description": "Filter to models supporting a given capability.",
            "schema": {
              "type": "string",
              "enum": [
                "text",
                "vision",
                "audio_in",
                "audio_out",
                "image_out",
                "video_out",
                "embeddings",
                "tool_use",
                "thinking"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Model registry.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/quote": {
      "get": {
        "tags": [
          "Quote"
        ],
        "summary": "Deterministic cost quote",
        "description": "Returns the USD/EUR cost for a request given input/output/cached token counts, an optional batch share and a region.",
        "operationId": "getQuote",
        "parameters": [
          {
            "name": "model",
            "in": "query",
            "required": true,
            "description": "Canonical model ID.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "inputTokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "outputTokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "cachedTokens",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0
            }
          },
          {
            "name": "batchShare",
            "in": "query",
            "required": false,
            "description": "0..1 fraction of volume routed through the Batch API.",
            "schema": {
              "type": "number",
              "minimum": 0,
              "maximum": 1
            }
          },
          {
            "name": "region",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "eu",
                "global"
              ],
              "default": "global"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Override which cloud/API to bill against.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Quote with itemised breakdown.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "object"
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing/invalid parameters.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "No price records for the requested model/region.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/diff": {
      "get": {
        "tags": [
          "Diff"
        ],
        "summary": "Catalog change feed",
        "description": "Lists every priceId whose history changed since `since`. Powered by the delta-written `priceHistory` log.",
        "operationId": "listDiffs",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": true,
            "description": "ISO 8601 timestamp.",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "until",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "provider",
            "in": "query",
            "required": false,
            "description": "Comma-separated provider IDs.",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 2000,
              "default": 500
            }
          }
        ],
        "responses": {
          "200": {
            "description": "List of changes, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Missing/invalid `since`.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/prices/{priceId}/history": {
      "get": {
        "tags": [
          "Prices"
        ],
        "summary": "Per-record history",
        "description": "Immutable observation log for a single price ID. Useful for billing reconciliation.",
        "operationId": "getPriceHistory",
        "parameters": [
          {
            "name": "priceId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "from",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 1,
              "maximum": 1000,
              "default": 200
            }
          }
        ],
        "responses": {
          "200": {
            "description": "History entries, newest first.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/PriceRecord"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Malformed priceId.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/gpus": {
      "get": {
        "tags": [
          "LocalInference"
        ],
        "summary": "List GPU hardware catalog",
        "description": "Returns the GPU catalog used by the local-vs-cloud calculator: VRAM, FP8 TFLOPS, memory bandwidth, TDP, MSRP and performance factor relative to an H100 SXM.",
        "operationId": "listGpus",
        "responses": {
          "200": {
            "description": "GPU catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/oss-models": {
      "get": {
        "tags": [
          "LocalInference"
        ],
        "summary": "List open-source LLM catalog",
        "description": "Returns every open-source LLM in the local-inference catalog with parameter counts (total / active for MoE), benchmark scores (MMLU / GPQA / HumanEval / MATH), single-stream H100 throughput estimates, and `cloudReferences[]` linking to managed cloud equivalents in `/v1/prices`.",
        "operationId": "listOssModels",
        "responses": {
          "200": {
            "description": "OSS LLM catalog.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/v1/quarantine": {
      "get": {
        "tags": [
          "Quarantine"
        ],
        "summary": "Records withheld from the public catalog",
        "description": "Lists records flagged as critical outliers by the cross-source check. Useful for audit/review workflows.",
        "operationId": "listQuarantine",
        "responses": {
          "200": {
            "description": "Quarantined records.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "data",
                    "total",
                    "meta"
                  ],
                  "properties": {
                    "data": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "total": {
                      "type": "integer",
                      "minimum": 0
                    },
                    "meta": {
                      "$ref": "#/components/schemas/Meta"
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing or invalid bearer token.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "opaque",
        "description": "Issued out-of-band by innFactory. Send as `Authorization: Bearer <token>`. Tokens are validated against Firestore-managed API keys."
      }
    },
    "schemas": {
      "PriceRecord": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "minLength": 1,
            "pattern": "^[a-z0-9._-]+__[A-Z]{3}__[a-z0-9_]+__[a-z0-9_]+$"
          },
          "schemaVersion": {
            "type": "string",
            "minLength": 1
          },
          "provider": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "enum": [
                  "openai",
                  "anthropic",
                  "azure",
                  "google",
                  "aws",
                  "stackit",
                  "mistral",
                  "ionos",
                  "xai",
                  "oracle"
                ]
              },
              "name": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "id",
              "name"
            ],
            "additionalProperties": false
          },
          "platform": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "enum": [
                  "openai-direct",
                  "anthropic-direct",
                  "azure-ai-foundry",
                  "vertex-ai",
                  "aws-bedrock",
                  "stackit-direct",
                  "mistral-direct",
                  "ionos-ai-model-hub",
                  "xai-direct",
                  "oracle-genai"
                ]
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "commercialSurface": {
                "type": "string",
                "minLength": 1
              }
            },
            "required": [
              "id",
              "name",
              "commercialSurface"
            ],
            "additionalProperties": false
          },
          "model": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "providerModelId": {
                "type": "string",
                "minLength": 1
              },
              "aliases": {
                "default": [],
                "type": "array",
                "items": {
                  "type": "string",
                  "minLength": 1
                }
              }
            },
            "required": [
              "id",
              "name",
              "providerModelId",
              "aliases"
            ],
            "additionalProperties": false
          },
          "region": {
            "type": "object",
            "properties": {
              "id": {
                "type": "string",
                "minLength": 1
              },
              "name": {
                "type": "string",
                "minLength": 1
              },
              "group": {
                "type": "string",
                "enum": [
                  "eu",
                  "us",
                  "global",
                  "provider_specific",
                  "unknown"
                ]
              }
            },
            "required": [
              "id",
              "name",
              "group"
            ],
            "additionalProperties": false
          },
          "modality": {
            "type": "string",
            "minLength": 1
          },
          "billingDimension": {
            "type": "string",
            "minLength": 1
          },
          "billingUnit": {
            "type": "string",
            "minLength": 1
          },
          "meterCategory": {
            "type": "string",
            "enum": [
              "tokens",
              "embeddings",
              "images",
              "audio",
              "video",
              "requests",
              "storage",
              "fine_tuning",
              "provisioned_throughput",
              "hosting",
              "tools",
              "agents",
              "batch",
              "other"
            ]
          },
          "meterName": {
            "type": "string",
            "minLength": 1
          },
          "usageType": {
            "type": "string",
            "enum": [
              "on_demand",
              "batch",
              "cached",
              "cache_write",
              "cache_read",
              "realtime",
              "training",
              "hosting",
              "provisioned",
              "priority",
              "flex",
              "provider_specific"
            ]
          },
          "sourceAmount": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "sourceCurrency": {
            "type": "string",
            "pattern": "^[A-Z]{3}$"
          },
          "displayAmount": {
            "anyOf": [
              {
                "type": "number",
                "minimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "displayCurrency": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^[A-Z]{3}$"
              },
              {
                "type": "null"
              }
            ]
          },
          "conversionRate": {
            "anyOf": [
              {
                "type": "number",
                "exclusiveMinimum": 0
              },
              {
                "type": "null"
              }
            ]
          },
          "conversionTimestamp": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              {
                "type": "null"
              }
            ]
          },
          "conversionStatus": {
            "type": "string",
            "enum": [
              "converted",
              "source_currency",
              "unavailable"
            ]
          },
          "source": {
            "type": "object",
            "properties": {
              "url": {
                "type": "string",
                "format": "uri"
              },
              "status": {
                "type": "string",
                "enum": [
                  "verified",
                  "changed",
                  "unavailable",
                  "ambiguous",
                  "manual_review_required",
                  "fallback_used"
                ]
              },
              "retrievalMethod": {
                "type": "string",
                "enum": [
                  "official_api",
                  "official_page",
                  "copied_content",
                  "bright_data",
                  "manual"
                ]
              },
              "lastCheckedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "lastChangedAt": {
                "anyOf": [
                  {
                    "type": "string",
                    "format": "date-time",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
                  },
                  {
                    "type": "null"
                  }
                ]
              }
            },
            "required": [
              "url",
              "status",
              "retrievalMethod",
              "lastCheckedAt",
              "lastChangedAt"
            ],
            "additionalProperties": false
          },
          "freshness": {
            "type": "object",
            "properties": {
              "lastUpdatedAt": {
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d(?::[0-5]\\d(?:\\.\\d+)?)?(?:Z|([+-](?:[01]\\d|2[0-3]):[0-5]\\d)))$"
              },
              "ageSeconds": {
                "type": "integer",
                "minimum": 0,
                "maximum": 9007199254740991
              },
              "status": {
                "type": "string",
                "enum": [
                  "fresh",
                  "stale",
                  "expired"
                ]
              }
            },
            "required": [
              "lastUpdatedAt",
              "ageSeconds",
              "status"
            ],
            "additionalProperties": false
          },
          "confidence": {
            "type": "object",
            "properties": {
              "score": {
                "anyOf": [
                  {
                    "type": "number",
                    "minimum": 0,
                    "maximum": 1
                  },
                  {
                    "type": "null"
                  }
                ]
              },
              "status": {
                "type": "string",
                "enum": [
                  "high",
                  "medium",
                  "low"
                ]
              },
              "reasons": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            },
            "required": [
              "score",
              "status",
              "reasons"
            ],
            "additionalProperties": false
          },
          "availability": {
            "type": "object",
            "properties": {
              "status": {
                "type": "string",
                "enum": [
                  "available",
                  "unavailable",
                  "preview",
                  "deprecated",
                  "unknown"
                ]
              },
              "region": {
                "type": "string",
                "minLength": 1
              },
              "confidence": {
                "type": "string",
                "enum": [
                  "high",
                  "medium",
                  "low"
                ]
              }
            },
            "required": [
              "status",
              "region",
              "confidence"
            ],
            "additionalProperties": false
          },
          "license": {
            "type": "object",
            "properties": {
              "termsUrl": {
                "type": "string",
                "format": "uri"
              },
              "approvedUseCase": {
                "type": "string",
                "enum": [
                  "public_site",
                  "internal_gateway",
                  "licensed_partner"
                ]
              },
              "thirdPartyCommercialReuseAllowed": {
                "type": "boolean"
              },
              "redistributionAllowed": {
                "type": "boolean"
              },
              "attributionRequired": {
                "type": "boolean"
              }
            },
            "required": [
              "termsUrl",
              "approvedUseCase",
              "thirdPartyCommercialReuseAllowed",
              "redistributionAllowed",
              "attributionRequired"
            ],
            "additionalProperties": false
          },
          "providerSpecific": {
            "default": null,
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "rawName": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rawUnit": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rawTier": {
                    "type": "string",
                    "minLength": 1
                  },
                  "rawDescription": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "rawName"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "id",
          "schemaVersion",
          "provider",
          "platform",
          "model",
          "region",
          "modality",
          "billingDimension",
          "billingUnit",
          "meterCategory",
          "meterName",
          "usageType",
          "sourceAmount",
          "sourceCurrency",
          "displayAmount",
          "displayCurrency",
          "conversionRate",
          "conversionTimestamp",
          "conversionStatus",
          "source",
          "freshness",
          "confidence",
          "availability",
          "license",
          "providerSpecific"
        ],
        "additionalProperties": false,
        "example": {
          "id": "openai-direct__openai__openai.gpt-5__global__input_tokens__USD__input_tokens__on_demand",
          "schemaVersion": "1.0.0",
          "provider": {
            "id": "openai",
            "name": "OpenAI"
          },
          "platform": {
            "id": "openai-direct",
            "name": "OpenAI API",
            "commercialSurface": "direct_api"
          },
          "model": {
            "id": "openai.gpt-5",
            "name": "GPT-5",
            "providerModelId": "gpt-5",
            "aliases": []
          },
          "region": {
            "id": "global",
            "name": "Global",
            "group": "global"
          },
          "modality": "text",
          "billingDimension": "input_tokens",
          "billingUnit": "1M_tokens",
          "meterCategory": "tokens",
          "meterName": "input_tokens",
          "usageType": "on_demand",
          "sourceAmount": 1.25,
          "sourceCurrency": "USD",
          "displayAmount": null,
          "displayCurrency": null,
          "conversionRate": null,
          "conversionTimestamp": null,
          "conversionStatus": "source_currency",
          "source": {
            "url": "https://developers.openai.com/api/docs/pricing",
            "status": "verified",
            "retrievalMethod": "official_page",
            "lastCheckedAt": "2026-05-17T00:00:00.000Z",
            "lastChangedAt": null
          },
          "freshness": {
            "lastUpdatedAt": "2026-05-17T00:00:00.000Z",
            "ageSeconds": 0,
            "status": "fresh"
          },
          "confidence": {
            "score": 0.9,
            "status": "high",
            "reasons": [
              "crawled from official source"
            ]
          },
          "availability": {
            "status": "available",
            "region": "global",
            "confidence": "high"
          },
          "license": {
            "termsUrl": "https://price-of-ai.innfactory.de/api/terms",
            "approvedUseCase": "internal_gateway",
            "thirdPartyCommercialReuseAllowed": false,
            "redistributionAllowed": false,
            "attributionRequired": true
          },
          "providerSpecific": null
        }
      },
      "License": {
        "type": "object",
        "properties": {
          "termsUrl": {
            "type": "string",
            "format": "uri"
          },
          "approvedUseCase": {
            "type": "string",
            "enum": [
              "public_site",
              "internal_gateway",
              "licensed_partner"
            ]
          },
          "thirdPartyCommercialReuseAllowed": {
            "type": "boolean"
          },
          "redistributionAllowed": {
            "type": "boolean"
          },
          "attributionRequired": {
            "type": "boolean"
          }
        },
        "required": [
          "termsUrl",
          "approvedUseCase",
          "thirdPartyCommercialReuseAllowed",
          "redistributionAllowed",
          "attributionRequired"
        ],
        "additionalProperties": false,
        "example": {
          "termsUrl": "https://price-of-ai.innfactory.de/api/terms",
          "approvedUseCase": "internal_gateway",
          "thirdPartyCommercialReuseAllowed": false,
          "redistributionAllowed": false,
          "attributionRequired": true
        }
      },
      "Pagination": {
        "type": "object",
        "required": [
          "limit",
          "nextCursor",
          "hasMore"
        ],
        "properties": {
          "limit": {
            "type": "integer",
            "minimum": 1,
            "maximum": 500
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "hasMore": {
            "type": "boolean"
          }
        }
      },
      "Meta": {
        "type": "object",
        "required": [
          "requestId",
          "generatedAt",
          "apiVersion",
          "schemaVersion",
          "dataVersion",
          "license"
        ],
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid"
          },
          "generatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "apiVersion": {
            "type": "string",
            "example": "v1"
          },
          "schemaVersion": {
            "type": "string",
            "example": "1.0.0"
          },
          "dataVersion": {
            "type": "string",
            "description": "Hash of the underlying snapshot (mirrors `X-Data-Version`)."
          },
          "totalRecords": {
            "type": "integer",
            "minimum": 0
          },
          "checksum": {
            "type": [
              "string",
              "null"
            ]
          },
          "license": {
            "$ref": "#/components/schemas/License"
          }
        }
      },
      "PricesPage": {
        "type": "object",
        "required": [
          "data",
          "nextCursor",
          "dataVersion",
          "total",
          "pagination",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PriceRecord"
            }
          },
          "nextCursor": {
            "type": [
              "string",
              "null"
            ]
          },
          "dataVersion": {
            "type": "string"
          },
          "total": {
            "type": "integer",
            "minimum": 0,
            "description": "Number of records in this page (not total across pages)."
          },
          "pagination": {
            "$ref": "#/components/schemas/Pagination"
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "ProviderStatus": {
        "type": "object",
        "required": [
          "providerId",
          "status",
          "lastSuccessfulUpdateAt",
          "stale",
          "githubIssueUrls"
        ],
        "properties": {
          "providerId": {
            "type": "string",
            "enum": [
              "openai",
              "anthropic",
              "azure",
              "google",
              "aws",
              "stackit",
              "mistral",
              "ionos",
              "xai",
              "oracle"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "current",
              "partial",
              "stale",
              "failed"
            ]
          },
          "lastSuccessfulUpdateAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          },
          "stale": {
            "type": "boolean"
          },
          "githubIssueUrls": {
            "type": "array",
            "items": {
              "type": "string",
              "format": "uri"
            }
          }
        }
      },
      "StatusResponse": {
        "type": "object",
        "required": [
          "data",
          "meta"
        ],
        "properties": {
          "data": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ProviderStatus"
            }
          },
          "meta": {
            "$ref": "#/components/schemas/Meta"
          }
        }
      },
      "CrawlResponse": {
        "type": "object",
        "required": [
          "ok",
          "records",
          "skipped",
          "providers"
        ],
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          },
          "records": {
            "type": "integer",
            "minimum": 0
          },
          "skipped": {
            "type": "integer",
            "minimum": 0
          },
          "providers": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "id",
                "status"
              ],
              "properties": {
                "id": {
                  "type": "string",
                  "enum": [
                    "openai",
                    "anthropic",
                    "azure",
                    "google",
                    "aws",
                    "stackit",
                    "mistral",
                    "ionos",
                    "xai",
                    "oracle"
                  ]
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "current",
                    "partial",
                    "stale",
                    "failed"
                  ]
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "required": [
          "error"
        ],
        "properties": {
          "error": {
            "type": "object",
            "required": [
              "code",
              "message",
              "details",
              "requestId",
              "timestamp",
              "documentationUrl"
            ],
            "properties": {
              "code": {
                "type": "string",
                "enum": [
                  "AUTHENTICATION_REQUIRED",
                  "INVALID_TOKEN",
                  "INSUFFICIENT_SCOPE",
                  "VALIDATION_ERROR",
                  "UNKNOWN_PROVIDER",
                  "UNKNOWN_MODEL",
                  "DATA_VERSION_CONFLICT",
                  "NOT_FOUND"
                ]
              },
              "message": {
                "type": "string"
              },
              "details": {
                "type": "array",
                "items": {
                  "type": "object",
                  "additionalProperties": true
                }
              },
              "requestId": {
                "type": "string",
                "format": "uuid"
              },
              "timestamp": {
                "type": "string",
                "format": "date-time"
              },
              "documentationUrl": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        },
        "example": {
          "error": {
            "code": "VALIDATION_ERROR",
            "message": "cursor parameter is malformed.",
            "details": [],
            "requestId": "0e8d6a4a-5b9b-4f6f-b0fa-2af0d3d72ee7",
            "timestamp": "2026-05-17T00:00:00.000Z",
            "documentationUrl": "https://price-of-ai.innfactory.de/api/errors#VALIDATION_ERROR"
          }
        }
      }
    }
  }
}
