{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://tokenswatch.net/data/v1/schema.json",
  "title": "TokensWatch LLM API pricing dataset",
  "description": "Schema v1.0.0. Fields are only ever added within v1.",
  "type": "object",
  "required": [
    "schemaVersion",
    "license",
    "unit",
    "lastVerified",
    "models"
  ],
  "properties": {
    "$schema": {
      "type": "string",
      "format": "uri"
    },
    "schemaVersion": {
      "type": "string"
    },
    "source": {
      "type": "string",
      "format": "uri"
    },
    "attribution": {
      "type": "string"
    },
    "license": {
      "type": "string",
      "description": "SPDX licence id."
    },
    "licenseUrl": {
      "type": "string",
      "format": "uri"
    },
    "unit": {
      "const": "USD per 1,000,000 tokens"
    },
    "lastPriceChange": {
      "type": "string",
      "format": "date"
    },
    "lastVerified": {
      "type": "string",
      "format": "date"
    },
    "generated": {
      "type": "string",
      "format": "date-time"
    },
    "description": {
      "type": "string"
    },
    "links": {
      "type": "object",
      "additionalProperties": {
        "type": "string",
        "format": "uri"
      }
    },
    "modelCount": {
      "type": "integer",
      "minimum": 0
    },
    "models": {
      "type": "array",
      "description": "Current models, cheapest blended price first.",
      "items": {
        "type": "object",
        "required": [
          "id",
          "name",
          "provider",
          "inputPerMTok",
          "outputPerMTok",
          "url"
        ],
        "properties": {
          "id": {
            "type": "string",
            "description": "Stable TokensWatch model id."
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "tier": {
            "enum": [
              "frontier",
              "workhorse",
              "fast"
            ]
          },
          "inputPerMTok": {
            "type": "number",
            "minimum": 0,
            "description": "Standard-tier input price."
          },
          "outputPerMTok": {
            "type": "number",
            "minimum": 0,
            "description": "Standard-tier output price."
          },
          "blendedPerMTok": {
            "type": "number",
            "minimum": 0,
            "description": "(3 × input + output) / 4 — used for ranking."
          },
          "cachedInputPerMTok": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "Prompt-cache read (cache hit) price."
          },
          "cacheWritePerMTok": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "Prompt-cache write price (Anthropic: 5-minute cache). null where there is no separate charge or it is not tracked."
          },
          "batchInputPerMTok": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "USD per 1,000,000 tokens; null = not offered or not published."
          },
          "batchOutputPerMTok": {
            "type": [
              "number",
              "null"
            ],
            "minimum": 0,
            "description": "USD per 1,000,000 tokens; null = not offered or not published."
          },
          "longContext": {
            "type": [
              "object",
              "null"
            ],
            "description": "Higher rates for long prompts. Applies when the prompt exceeds promptTokens (or reaches it, if inclusive).",
            "properties": {
              "promptTokens": {
                "type": "integer"
              },
              "inclusive": {
                "type": "boolean"
              },
              "inputPerMTok": {
                "type": "number",
                "minimum": 0,
                "description": "USD per 1,000,000 tokens."
              },
              "outputPerMTok": {
                "type": "number",
                "minimum": 0,
                "description": "USD per 1,000,000 tokens."
              },
              "cachedInputPerMTok": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "description": "USD per 1,000,000 tokens; null = not offered or not published."
              },
              "batchInputPerMTok": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "description": "USD per 1,000,000 tokens; null = not offered or not published."
              },
              "batchOutputPerMTok": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "description": "USD per 1,000,000 tokens; null = not offered or not published."
              }
            }
          },
          "offPeak": {
            "type": [
              "object",
              "null"
            ],
            "description": "Discounted off-peak rates (e.g. DeepSeek).",
            "properties": {
              "inputPerMTok": {
                "type": "number",
                "minimum": 0,
                "description": "USD per 1,000,000 tokens."
              },
              "outputPerMTok": {
                "type": "number",
                "minimum": 0,
                "description": "USD per 1,000,000 tokens."
              },
              "cachedInputPerMTok": {
                "type": [
                  "number",
                  "null"
                ],
                "minimum": 0,
                "description": "USD per 1,000,000 tokens; null = not offered or not published."
              },
              "schedule": {
                "type": "string"
              }
            }
          },
          "contextWindow": {
            "type": "integer"
          },
          "maxOutput": {
            "type": [
              "integer",
              "null"
            ]
          },
          "priceNote": {
            "type": [
              "string",
              "null"
            ]
          },
          "extrasNote": {
            "type": [
              "string",
              "null"
            ],
            "description": "How cache/batch prices were derived, when not listed per model."
          },
          "extrasVerified": {
            "anyOf": [
              {
                "type": "string",
                "format": "date"
              },
              {
                "type": "null"
              }
            ],
            "description": "Date cache/batch/long-context prices were last checked by hand."
          },
          "upcomingChanges": {
            "type": "array",
            "items": {
              "type": "object",
              "required": [
                "effective",
                "inputPerMTok",
                "outputPerMTok"
              ],
              "properties": {
                "effective": {
                  "type": "string",
                  "format": "date"
                },
                "inputPerMTok": {
                  "type": "number",
                  "minimum": 0,
                  "description": "USD per 1,000,000 tokens."
                },
                "outputPerMTok": {
                  "type": "number",
                  "minimum": 0,
                  "description": "USD per 1,000,000 tokens."
                },
                "cachedInputPerMTok": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "description": "USD per 1,000,000 tokens; null = not offered or not published."
                },
                "batchInputPerMTok": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "description": "USD per 1,000,000 tokens; null = not offered or not published."
                },
                "batchOutputPerMTok": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "minimum": 0,
                  "description": "USD per 1,000,000 tokens; null = not offered or not published."
                },
                "source": {
                  "type": "string"
                }
              }
            }
          },
          "providerDocs": {
            "type": "string",
            "format": "uri"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "recentChanges": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "date",
          "modelId",
          "field",
          "summary",
          "source"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "modelId": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Provider URL, or \"litellm:<key>\" for changes detected from community data."
          },
          "oldInput": {
            "type": [
              "number",
              "null"
            ]
          },
          "newInput": {
            "type": [
              "number",
              "null"
            ]
          },
          "oldOutput": {
            "type": [
              "number",
              "null"
            ]
          },
          "newOutput": {
            "type": [
              "number",
              "null"
            ]
          },
          "note": {
            "type": "string",
            "description": "Caveat on this record, e.g. never confirmed by the provider."
          }
        }
      }
    },
    "changeCount": {
      "type": "integer"
    },
    "changes": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "date",
          "modelId",
          "field",
          "summary",
          "source"
        ],
        "properties": {
          "date": {
            "type": "string",
            "format": "date"
          },
          "modelId": {
            "type": "string"
          },
          "field": {
            "type": "string"
          },
          "summary": {
            "type": "string"
          },
          "source": {
            "type": "string",
            "description": "Provider URL, or \"litellm:<key>\" for changes detected from community data."
          },
          "oldInput": {
            "type": [
              "number",
              "null"
            ]
          },
          "newInput": {
            "type": [
              "number",
              "null"
            ]
          },
          "oldOutput": {
            "type": [
              "number",
              "null"
            ]
          },
          "newOutput": {
            "type": [
              "number",
              "null"
            ]
          },
          "note": {
            "type": "string",
            "description": "Caveat on this record, e.g. never confirmed by the provider."
          }
        }
      }
    }
  }
}