{
  "openapi": "3.1.0",
  "info": {
    "title": "AI Pricing Guru Public API",
    "version": "1.0.0",
    "summary": "Free, daily-updated AI model pricing data.",
    "description": "Public JSON endpoint exposing up-to-date per-token pricing for major AI model providers (OpenAI, Anthropic, Google, DeepSeek, xAI, Mistral, Meta, Groq, Cohere, Together, Perplexity, and more). CORS is enabled for all origins. Data is licensed CC-BY 4.0 — attribution requested: \"Data: aipricing.guru\".",
    "license": {
      "name": "CC-BY 4.0",
      "url": "https://creativecommons.org/licenses/by/4.0/"
    },
    "contact": {
      "name": "AI Pricing Guru",
      "url": "https://www.aipricing.guru/about/",
      "email": "hello@aipricing.guru"
    }
  },
  "servers": [
    { "url": "https://www.aipricing.guru", "description": "Production" }
  ],
  "paths": {
    "/api/pricing.json": {
      "get": {
        "operationId": "getPricing",
        "summary": "Fetch the full pricing dataset.",
        "description": "Returns the complete pricing dataset covering every tracked model. Updated daily via an automated scraper. Cached for 1 hour at the edge.",
        "tags": ["pricing"],
        "responses": {
          "200": {
            "description": "Pricing dataset",
            "headers": {
              "Access-Control-Allow-Origin": { "schema": { "type": "string" }, "description": "Always \"*\"." },
              "Cache-Control": { "schema": { "type": "string" }, "description": "public, max-age=3600" }
            },
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/PricingDataset" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "PricingDataset": {
        "type": "object",
        "required": ["lastUpdated", "models"],
        "properties": {
          "lastUpdated": { "type": "string", "format": "date-time", "description": "ISO-8601 timestamp of last dataset refresh." },
          "scrapedAt": { "type": "string", "format": "date-time" },
          "modelCount": { "type": "integer", "minimum": 0 },
          "providerCount": { "type": "integer", "minimum": 0 },
          "models": { "type": "array", "items": { "$ref": "#/components/schemas/Model" } }
        }
      },
      "Model": {
        "type": "object",
        "required": ["id", "name", "provider", "pricing"],
        "properties": {
          "id": { "type": "string", "example": "gpt-5.4" },
          "name": { "type": "string", "example": "GPT-5.4" },
          "family": { "type": "string", "example": "GPT-5.4" },
          "provider": { "type": "string", "example": "openai", "description": "Provider slug, lowercase." },
          "status": { "type": "string", "enum": ["active", "preview", "legacy", "deprecated"] },
          "pricing": { "$ref": "#/components/schemas/Pricing" }
        }
      },
      "Pricing": {
        "type": "object",
        "description": "All prices in USD per 1 million tokens.",
        "properties": {
          "inputPerM": { "type": "number", "minimum": 0, "example": 2.5 },
          "cachedInputPerM": { "type": "number", "minimum": 0, "example": 0.25 },
          "outputPerM": { "type": "number", "minimum": 0, "example": 15 }
        }
      }
    }
  }
}
