{
  "openapi": "3.1.0",
  "info": {
    "title": "API Price Index — open data API",
    "version": "1",
    "summary": "Live, verified LLM API prices as static JSON/CSV endpoints.",
    "description": "Read-only data endpoints of apipriceindex.com. 539 tracked endpoints as of 2026-09-05T14:11:24Z. Every price carries its verification date and official source URL. Files are regenerated from the index on every rebuild — same data as the human pages, never a diverging export. No auth, no rate key: plain HTTPS GET.",
    "license": {
      "name": "CC BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "contact": {
      "name": "API Price Index",
      "url": "https://apipriceindex.com/use-this-data/",
      "email": "contact@apipriceindex.com"
    },
    "x-attribution": "API Price Index (https://apipriceindex.com) — CC BY 4.0, attribution required",
    "x-as-of": "2026-09-05T14:11:24Z"
  },
  "servers": [
    {
      "url": "https://apipriceindex.com"
    }
  ],
  "paths": {
    "/api/all.json": {
      "get": {
        "operationId": "getAllModels",
        "summary": "Full dataset: every tracked endpoint with price, specs and freshness",
        "description": "Stability contract: within a schema_version, existing fields never change name or type; fields may be ADDED. Any removal/rename bumps schema_version.",
        "responses": {
          "200": {
            "description": "The full index",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "schema_version": {
                      "type": "integer"
                    },
                    "name": {
                      "type": "string"
                    },
                    "description": {
                      "type": "string"
                    },
                    "license": {
                      "type": "string"
                    },
                    "license_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "attribution": {
                      "type": "string"
                    },
                    "docs": {
                      "type": "string",
                      "format": "uri"
                    },
                    "as_of": {
                      "type": [
                        "string",
                        "null"
                      ],
                      "format": "date"
                    },
                    "count": {
                      "type": "integer"
                    },
                    "models": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable endpoint id (provider:model)"
                          },
                          "name": {
                            "type": "string"
                          },
                          "provider": {
                            "type": "object",
                            "properties": {
                              "id": {
                                "type": "string"
                              },
                              "name": {
                                "type": "string"
                              },
                              "url": {
                                "type": "string",
                                "format": "uri"
                              }
                            }
                          },
                          "base_model": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "description": "Underlying model when the endpoint is a hosted open model"
                          },
                          "category": {
                            "type": "string"
                          },
                          "context_window": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Tokens"
                          },
                          "max_output": {
                            "type": [
                              "integer",
                              "null"
                            ],
                            "description": "Tokens"
                          },
                          "release_date": {
                            "type": [
                              "string",
                              "null"
                            ],
                            "format": "date"
                          },
                          "license": {
                            "type": [
                              "string",
                              "null"
                            ]
                          },
                          "open_weights": {
                            "type": [
                              "boolean",
                              "null"
                            ]
                          },
                          "pricing": {
                            "type": [
                              "object",
                              "null"
                            ],
                            "description": "Verified price. null when the endpoint is tracked but not priced.",
                            "properties": {
                              "input_per_mtok": {
                                "type": "number",
                                "description": "USD per 1M input tokens"
                              },
                              "output_per_mtok": {
                                "type": "number",
                                "description": "USD per 1M output tokens"
                              },
                              "cached_input_per_mtok": {
                                "type": [
                                  "number",
                                  "null"
                                ],
                                "description": "USD per 1M cached input tokens; null when the provider publishes no cached price"
                              },
                              "currency": {
                                "type": "string",
                                "const": "USD"
                              },
                              "confidence": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "description": "Cross-check confidence of the price"
                              },
                              "verified_at": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "date",
                                "description": "Date the price was last verified against its source"
                              },
                              "source_url": {
                                "type": [
                                  "string",
                                  "null"
                                ],
                                "format": "uri",
                                "description": "Official pricing page the price was read from"
                              }
                            }
                          },
                          "no_credit_card": {
                            "type": "boolean"
                          },
                          "page": {
                            "type": "string",
                            "format": "uri",
                            "description": "Per-model JSON page for this endpoint"
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/pricing-history.csv": {
      "get": {
        "operationId": "getPricingHistory",
        "summary": "Price history CSV: one row per (endpoint, date), a point only when the price actually changed",
        "description": "Columns: id,provider,model,date,input_usd_per_mtok,output_usd_per_mtok. New columns may be appended at the END of the line only. X-As-Of response header carries the index date.",
        "responses": {
          "200": {
            "description": "CSV, header row first",
            "content": {
              "text/csv": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/api/{provider}/{model}.json": {
      "get": {
        "operationId": "getModel",
        "summary": "Full record of one endpoint: pricing with source, price history, specs, latency, license",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Provider slug, e.g. anthropic"
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Model slug, e.g. claude-sonnet-5"
          }
        ],
        "responses": {
          "200": {
            "description": "One endpoint record; _meta carries attribution and license",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint not tracked (static file absent)"
          }
        }
      }
    },
    "/api/badge/{provider}/{model}.json": {
      "get": {
        "operationId": "getBadge",
        "summary": "shields.io endpoint-badge JSON with the live price of one endpoint",
        "description": "Render via https://img.shields.io/endpoint?url=<this URL>. Green = price verified <7 days, orange = older.",
        "parameters": [
          {
            "name": "provider",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "model",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "shields.io schemaVersion 1 payload",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "404": {
            "description": "Endpoint not tracked or not priced"
          }
        }
      }
    },
    "/health.json": {
      "get": {
        "operationId": "getHealth",
        "summary": "Pipeline health: freshness of each data job, so consumers can detect a stale index",
        "responses": {
          "200": {
            "description": "Per-job freshness status",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    }
  }
}