{
  "openapi": "3.1.0",
  "info": {
    "title": "AI IQ Public API",
    "version": "1",
    "description": "Read-only JSON API for AI IQ model scores, benchmarks, rankings, charts, domains, and methodology. Every response carries an `apiVersion` (this document tracks the request/response contract) and a `methodologyVersion` (tracks the scoring semantics, e.g. dimension weighting and imputation rules) so clients can detect breaking contract changes separately from scoring changes."
  },
  "servers": [
    {
      "url": "https://www.aiiq.org/api/v1"
    },
    {
      "url": "https://www.aiiq.org/api",
      "description": "always-current alias"
    }
  ],
  "paths": {
    "/models": {
      "get": {
        "summary": "List all public models with summary scores, cost, and speed",
        "operationId": "listModels",
        "responses": {
          "200": {
            "description": "Model catalog",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "models": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/ModelSummary"
                          }
                        }
                      },
                      "required": [
                        "models"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/models/{id}": {
      "get": {
        "summary": "Get full detail for a single model, including per-benchmark results",
        "operationId": "getModel",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Model id (slug)",
            "schema": {
              "type": "string"
            },
            "example": "gpt-5.5"
          }
        ],
        "responses": {
          "200": {
            "description": "Model detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ModelDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/benchmarks": {
      "get": {
        "summary": "List all public benchmark definitions (metadata only, no results)",
        "operationId": "listBenchmarks",
        "responses": {
          "200": {
            "description": "Benchmark catalog",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "benchmarks": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/BenchmarkMetadata"
                          }
                        }
                      },
                      "required": [
                        "benchmarks"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/rankings": {
      "get": {
        "summary": "List all public ranking catalog entries (composite, per-dimension, and per-benchmark)",
        "operationId": "listRankings",
        "responses": {
          "200": {
            "description": "Ranking catalog",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "rankings": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/RankingCatalogEntry"
                          }
                        }
                      },
                      "required": [
                        "rankings"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/rankings/{id}": {
      "get": {
        "summary": "Get the full ranked model list for a single ranking",
        "operationId": "getRanking",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "description": "Ranking id (slug)",
            "schema": {
              "type": "string"
            },
            "example": "composite-iq"
          }
        ],
        "responses": {
          "200": {
            "description": "Ranking detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RankingDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/charts": {
      "get": {
        "summary": "List all public charts",
        "operationId": "listCharts",
        "responses": {
          "200": {
            "description": "Chart catalog",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "charts": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/Chart"
                          }
                        }
                      },
                      "required": [
                        "charts"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/methodology": {
      "get": {
        "summary": "Get the current scoring methodology summary and derived ranking definitions",
        "operationId": "getMethodology",
        "responses": {
          "200": {
            "description": "Methodology",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Methodology"
                }
              }
            }
          }
        }
      }
    },
    "/domains": {
      "get": {
        "summary": "List all public domain pages (e.g. cybersecurity, bio)",
        "operationId": "listDomains",
        "responses": {
          "200": {
            "description": "Domain catalog",
            "content": {
              "application/json": {
                "schema": {
                  "allOf": [
                    {
                      "$ref": "#/components/schemas/Envelope"
                    },
                    {
                      "type": "object",
                      "properties": {
                        "domains": {
                          "type": "array",
                          "items": {
                            "$ref": "#/components/schemas/DomainSummary"
                          }
                        }
                      },
                      "required": [
                        "domains"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/domains/{slug}": {
      "get": {
        "summary": "Get domain benchmark definitions and leaderboard rows for a single domain",
        "operationId": "getDomain",
        "parameters": [
          {
            "name": "slug",
            "in": "path",
            "required": true,
            "description": "Domain slug",
            "schema": {
              "type": "string"
            },
            "example": "cybersecurity"
          }
        ],
        "responses": {
          "200": {
            "description": "Domain detail",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DomainDetail"
                }
              }
            }
          },
          "404": {
            "description": "Not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Envelope": {
        "type": "object",
        "description": "Fields present on every public API response.",
        "properties": {
          "apiVersion": {
            "type": "string",
            "description": "Request/response contract version."
          },
          "methodologyVersion": {
            "type": "string",
            "description": "Scoring semantics version."
          },
          "updatedAt": {
            "type": [
              "string",
              "null"
            ],
            "format": "date-time"
          }
        },
        "required": [
          "apiVersion",
          "methodologyVersion",
          "updatedAt"
        ]
      },
      "ModelCost": {
        "type": "object",
        "properties": {
          "inputPer1M": {
            "type": [
              "number",
              "null"
            ]
          },
          "outputPer1M": {
            "type": [
              "number",
              "null"
            ]
          },
          "ioPer1M": {
            "type": [
              "number",
              "null"
            ]
          },
          "usageMultiplier": {
            "type": [
              "number",
              "null"
            ]
          },
          "usageMultiplierSource": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "measured",
              "lineage-imputed",
              "peer-imputed",
              null
            ]
          },
          "effectivePer1M": {
            "type": [
              "number",
              "null"
            ]
          },
          "unit": {
            "type": "string"
          }
        },
        "required": [
          "inputPer1M",
          "outputPer1M",
          "ioPer1M",
          "usageMultiplier",
          "usageMultiplierSource",
          "effectivePer1M",
          "unit"
        ],
        "additionalProperties": true
      },
      "ModelSpeed": {
        "type": "object",
        "properties": {
          "responseTimeSec": {
            "type": [
              "number",
              "null"
            ]
          },
          "medianTokensPerSecond": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "responseTimeSec",
          "medianTokensPerSecond"
        ],
        "additionalProperties": true
      },
      "DimensionScoreCompact": {
        "type": "object",
        "description": "Compact slug -> IQ map, one entry per scored dimension (nulls allowed when unscored).",
        "additionalProperties": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "DimensionScoreDetailed": {
        "type": "object",
        "properties": {
          "iq": {
            "type": [
              "number",
              "null"
            ]
          },
          "benchmarksCovered": {
            "type": "integer"
          },
          "benchmarksTotal": {
            "type": "integer"
          },
          "imputed": {
            "type": "boolean"
          }
        },
        "required": [
          "iq",
          "benchmarksCovered",
          "benchmarksTotal",
          "imputed"
        ],
        "additionalProperties": true
      },
      "ModelBenchmarkResult": {
        "type": "object",
        "description": "One raw benchmark result attached to a model, keyed by benchmark id in ModelDetail.benchmarkResults.",
        "properties": {
          "value": {
            "type": "number"
          },
          "field": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "iq",
              "eq"
            ]
          },
          "dimension": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "higher_is_better",
              "lower_is_better"
            ]
          }
        },
        "required": [
          "value",
          "field",
          "name",
          "category",
          "dimension",
          "direction"
        ],
        "additionalProperties": true
      },
      "ModelSummary": {
        "type": "object",
        "description": "One row of /models — identity, composite scores, cost, and speed. No per-benchmark detail.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "country": {
            "type": "string"
          },
          "rank": {
            "type": [
              "integer",
              "null"
            ]
          },
          "iq": {
            "type": [
              "number",
              "null"
            ]
          },
          "dimensions": {
            "$ref": "#/components/schemas/DimensionScoreCompact"
          },
          "emotionalReasoning": {
            "type": [
              "number",
              "null"
            ]
          },
          "cost": {
            "$ref": "#/components/schemas/ModelCost"
          },
          "speed": {
            "$ref": "#/components/schemas/ModelSpeed"
          },
          "parametersB": {
            "type": [
              "number",
              "null"
            ]
          },
          "contextWindow": {
            "type": [
              "number",
              "null"
            ]
          },
          "releaseDate": {
            "type": [
              "string",
              "null"
            ],
            "format": "date"
          },
          "openSource": {
            "type": "boolean"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "name",
          "provider",
          "country",
          "rank",
          "iq",
          "dimensions",
          "emotionalReasoning",
          "cost",
          "speed",
          "parametersB",
          "contextWindow",
          "releaseDate",
          "openSource",
          "updatedAt",
          "url"
        ],
        "additionalProperties": true
      },
      "ModelDetail": {
        "type": "object",
        "description": "GET /models/{id} — identity and scores plus every raw benchmark result behind them.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "provider": {
                "type": "string"
              },
              "country": {
                "type": "string"
              },
              "rank": {
                "type": [
                  "integer",
                  "null"
                ]
              },
              "iq": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "dimensions": {
                "type": "object",
                "description": "Slug -> detailed dimension score map.",
                "additionalProperties": {
                  "$ref": "#/components/schemas/DimensionScoreDetailed"
                }
              },
              "emotionalReasoning": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "cost": {
                "$ref": "#/components/schemas/ModelCost"
              },
              "speed": {
                "$ref": "#/components/schemas/ModelSpeed"
              },
              "parametersB": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "contextWindow": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "releaseDate": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date"
              },
              "openSource": {
                "type": "boolean"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "benchmarkResults": {
                "type": "object",
                "description": "Benchmark id -> raw result.",
                "additionalProperties": {
                  "$ref": "#/components/schemas/ModelBenchmarkResult"
                }
              }
            },
            "required": [
              "id",
              "name",
              "provider",
              "country",
              "rank",
              "iq",
              "dimensions",
              "emotionalReasoning",
              "cost",
              "speed",
              "parametersB",
              "contextWindow",
              "releaseDate",
              "openSource",
              "url",
              "benchmarkResults"
            ]
          }
        ],
        "additionalProperties": true
      },
      "BenchmarkMetadata": {
        "type": "object",
        "description": "One row of /benchmarks — a benchmark definition, without any model results.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "category": {
            "type": "string",
            "enum": [
              "iq",
              "eq"
            ]
          },
          "dimension": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "higher_is_better",
              "lower_is_better"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "category",
          "dimension",
          "direction",
          "unit",
          "updatedAt",
          "url"
        ],
        "additionalProperties": true
      },
      "RankingCatalogEntry": {
        "type": "object",
        "description": "One row of /rankings.",
        "properties": {
          "id": {
            "type": "string"
          },
          "rankingName": {
            "type": "string"
          },
          "rankingType": {
            "type": "string",
            "enum": [
              "derived",
              "dimension",
              "benchmark"
            ]
          },
          "dimension": {
            "type": [
              "string",
              "null"
            ]
          },
          "direction": {
            "type": "string",
            "enum": [
              "higher_is_better",
              "lower_is_better"
            ]
          },
          "modelCount": {
            "type": "integer"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "rankingName",
          "rankingType",
          "dimension",
          "direction",
          "modelCount",
          "url"
        ],
        "additionalProperties": true
      },
      "RankedModel": {
        "type": "object",
        "description": "One row of RankingDetail.models.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "provider": {
            "type": "string"
          },
          "rank": {
            "type": "integer"
          },
          "score": {
            "type": [
              "number",
              "null"
            ]
          }
        },
        "required": [
          "id",
          "name",
          "provider",
          "rank",
          "score"
        ],
        "additionalProperties": true
      },
      "RankingDetail": {
        "type": "object",
        "description": "GET /rankings/{id} — full ranked model list for one ranking.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "rankingName": {
                "type": "string"
              },
              "rankingType": {
                "type": "string",
                "enum": [
                  "derived",
                  "dimension",
                  "benchmark"
                ]
              },
              "direction": {
                "type": "string",
                "enum": [
                  "higher_is_better",
                  "lower_is_better"
                ]
              },
              "models": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/RankedModel"
                }
              }
            },
            "required": [
              "id",
              "rankingName",
              "rankingType",
              "direction",
              "models"
            ]
          }
        ],
        "additionalProperties": true
      },
      "Chart": {
        "type": "object",
        "description": "One row of /charts.",
        "properties": {
          "id": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          },
          "image": {
            "type": "string",
            "format": "uri"
          },
          "relatedBenchmarks": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "tags": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "id",
          "title",
          "description",
          "url",
          "image",
          "relatedBenchmarks",
          "tags"
        ],
        "additionalProperties": true
      },
      "RankingBenchmarkRef": {
        "type": "object",
        "properties": {
          "field": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "required": [
          "field",
          "name"
        ],
        "additionalProperties": true
      },
      "RankingDimensionRef": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "slug": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "minBenchmarks": {
            "type": "integer"
          },
          "benchmarks": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RankingBenchmarkRef"
            }
          }
        },
        "required": [
          "id",
          "slug",
          "name",
          "minBenchmarks",
          "benchmarks"
        ],
        "additionalProperties": true
      },
      "DerivedRanking": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "rankingName": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "higher_is_better",
              "lower_is_better"
            ]
          },
          "scoreField": {
            "type": "string"
          },
          "dimensions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RankingDimensionRef"
            }
          }
        },
        "required": [
          "id",
          "rankingName",
          "direction",
          "scoreField",
          "dimensions"
        ],
        "additionalProperties": true
      },
      "Methodology": {
        "type": "object",
        "description": "GET /methodology — current scoring methodology summary and derived ranking definitions.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "version": {
                "type": "string"
              },
              "summary": {
                "type": "string"
              },
              "derivedRankings": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DerivedRanking"
                }
              },
              "url": {
                "type": "string",
                "format": "uri"
              }
            },
            "required": [
              "version",
              "summary",
              "derivedRankings",
              "url"
            ]
          }
        ],
        "additionalProperties": true
      },
      "DomainSummary": {
        "type": "object",
        "description": "One row of /domains.",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "benchmarkCount": {
            "type": "integer"
          },
          "updatedAt": {
            "type": "string",
            "format": "date-time"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "name",
          "benchmarkCount",
          "updatedAt",
          "url"
        ],
        "additionalProperties": true
      },
      "DomainBenchmarkSource": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "url": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "name",
          "url"
        ],
        "additionalProperties": true
      },
      "DomainResultRow": {
        "type": "object",
        "description": "One leaderboard row for a domain benchmark.",
        "properties": {
          "model": {
            "type": "string"
          },
          "harness": {
            "type": [
              "string",
              "null"
            ]
          },
          "score": {
            "type": "number"
          },
          "modelUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        },
        "required": [
          "model",
          "harness",
          "score",
          "modelUrl"
        ],
        "additionalProperties": true
      },
      "DomainBenchmark": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "direction": {
            "type": "string",
            "enum": [
              "higher_is_better",
              "lower_is_better"
            ]
          },
          "unit": {
            "type": [
              "string",
              "null"
            ]
          },
          "source": {
            "$ref": "#/components/schemas/DomainBenchmarkSource"
          },
          "results": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DomainResultRow"
            }
          }
        },
        "required": [
          "id",
          "name",
          "description",
          "direction",
          "unit",
          "source",
          "results"
        ],
        "additionalProperties": true
      },
      "DomainCompositeEntry": {
        "type": "object",
        "description": "One model's domain composite IQ — the same score the domain page displays, computed by the shared scoring modules.",
        "properties": {
          "model": {
            "type": "string"
          },
          "compositeIQ": {
            "type": "integer"
          },
          "benchmarksCovered": {
            "type": "integer"
          },
          "benchmarksTotal": {
            "type": "integer"
          },
          "modelUrl": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          }
        },
        "required": [
          "model",
          "compositeIQ",
          "benchmarksCovered",
          "benchmarksTotal",
          "modelUrl"
        ],
        "additionalProperties": true
      },
      "DomainDetail": {
        "type": "object",
        "description": "GET /domains/{slug} — domain composite scores, benchmark definitions, and leaderboard rows.",
        "allOf": [
          {
            "$ref": "#/components/schemas/Envelope"
          },
          {
            "type": "object",
            "properties": {
              "id": {
                "type": "string"
              },
              "name": {
                "type": "string"
              },
              "url": {
                "type": "string",
                "format": "uri"
              },
              "models": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DomainCompositeEntry"
                }
              },
              "benchmarks": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DomainBenchmark"
                }
              }
            },
            "required": [
              "id",
              "name",
              "url",
              "models",
              "benchmarks"
            ]
          }
        ],
        "additionalProperties": true
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          },
          "code": {
            "type": "string"
          }
        },
        "required": [
          "error",
          "code"
        ],
        "additionalProperties": false
      }
    }
  }
}
