{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://kiankyars.github.io/model-tracker/api-schema.json",
  "title": "Language model",
  "description": "A released or officially announced model. Additional fields may be added without changing the v1 API. Unknown values are null; optional lifecycle fields may be absent on older records.",
  "type": "object",
  "required": [
    "id",
    "slug",
    "name",
    "developer",
    "developer_id",
    "family",
    "description",
    "release_date",
    "date_precision",
    "open_weights",
    "license",
    "parameters_b",
    "active_parameters_b",
    "parameters_source",
    "architecture",
    "context_window",
    "modalities",
    "reasoning",
    "tool_call",
    "source_url",
    "source_type",
    "sources",
    "aliases",
    "first_seen",
    "last_seen",
    "upstream_present"
  ],
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1
    },
    "slug": {
      "type": "string",
      "pattern": "^[a-z0-9][a-z0-9._-]*$"
    },
    "name": {
      "type": "string"
    },
    "developer": {
      "type": "string"
    },
    "developer_id": {
      "type": "string"
    },
    "family": {
      "type": [
        "string",
        "null"
      ]
    },
    "description": {
      "type": [
        "string",
        "null"
      ]
    },
    "release_date": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$",
      "description": "First verified external availability, including limited access; not the announcement date. Null when external access is not verified or when its first date is unknown. ISO day or month; preserve date_precision."
    },
    "date_precision": {
      "enum": [
        "day",
        "month",
        null
      ]
    },
    "open_weights": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "license": {
      "type": [
        "string",
        "null"
      ]
    },
    "parameters_b": {
      "type": [
        "number",
        "null"
      ],
      "exclusiveMinimum": 0
    },
    "active_parameters_b": {
      "type": [
        "number",
        "null"
      ],
      "exclusiveMinimum": 0
    },
    "parameters_source": {
      "type": [
        "string",
        "null"
      ]
    },
    "architecture": {
      "type": [
        "string",
        "null"
      ]
    },
    "context_window": {
      "type": [
        "number",
        "null"
      ],
      "exclusiveMinimum": 0
    },
    "modalities": {
      "type": "object",
      "required": [
        "input",
        "output"
      ],
      "properties": {
        "input": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "output": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "reasoning": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "tool_call": {
      "type": [
        "boolean",
        "null"
      ]
    },
    "source_url": {
      "type": "string",
      "format": "uri",
      "pattern": "^https://"
    },
    "source_type": {
      "type": "string"
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "label",
          "url",
          "type"
        ],
        "properties": {
          "label": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri",
            "pattern": "^https://"
          },
          "type": {
            "type": "string"
          }
        }
      }
    },
    "aliases": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "first_seen": {
      "type": "string",
      "format": "date-time"
    },
    "last_seen": {
      "type": "string",
      "format": "date-time"
    },
    "upstream_present": {
      "type": "boolean"
    },
    "notes": {
      "type": [
        "string",
        "null"
      ]
    },
    "parameters_scope": {
      "type": "string",
      "description": "Component covered by parameters_b when it is not a complete total; must match the named component count."
    },
    "active_parameters_scope": {
      "type": "string",
      "description": "Component or inference phase covered by active_parameters_b. If phase counts are supplied, this key must match the scalar's phase."
    },
    "parameter_components_b": {
      "type": "object",
      "additionalProperties": {
        "type": "number",
        "exclusiveMinimum": 0
      }
    },
    "active_parameters_by_phase_b": {
      "type": "object",
      "additionalProperties": {
        "type": "number",
        "exclusiveMinimum": 0
      }
    },
    "field_status": {
      "type": "object",
      "additionalProperties": {
        "enum": [
          "undisclosed",
          "not_applicable",
          "unverified"
        ]
      }
    },
    "audit_url": {
      "type": "string",
      "format": "uri"
    },
    "audited_at": {
      "type": "string",
      "format": "date-time"
    },
    "parameters_lower_bound_b": {
      "type": "number",
      "exclusiveMinimum": 0,
      "description": "Published lower bound in billions when parameters_b is null. This is not a point estimate."
    },
    "parameters_lower_bound_exclusive": {
      "type": "boolean",
      "description": "True means strictly greater than the lower bound; false means at least. Required with parameters_lower_bound_b."
    },
    "announcement_date": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^\\d{4}-\\d{2}(-\\d{2})?$",
      "description": "Official announcement day or month, separately recorded from first external availability. Optional on older records."
    },
    "availability": {
      "type": [
        "string",
        "null"
      ],
      "enum": [
        "announced",
        "limited",
        "public",
        null
      ],
      "description": "Verified release stage: announced with no external access verified; limited after restricted access; public after general access. This records the stage reached, not current service availability; models may later be retired. Omitted or null means not reviewed. Public release does not imply open weights."
    }
  },
  "additionalProperties": true,
  "allOf": [
    {
      "if": {
        "properties": {
          "availability": {
            "const": "announced"
          }
        },
        "required": [
          "availability"
        ]
      },
      "then": {
        "required": [
          "announcement_date"
        ],
        "properties": {
          "announcement_date": {
            "type": "string"
          },
          "release_date": {
            "type": "null"
          }
        }
      }
    }
  ]
}
