{
  "openapi": "3.1.0",
  "info": {
    "title": "PCH II Inference & Data Gateway",
    "version": "2.0.0",
    "description": "Pay-per-call AI inference and data. Each endpoint returns HTTP 402 with x402 payment terms until an X-PAYMENT header carrying a signed EIP-3009 USDC authorization (Base mainnet) is supplied."
  },
  "servers": [
    {
      "url": "https://pathcoursehealth.com"
    }
  ],
  "components": {
    "securitySchemes": {
      "x402": {
        "type": "http",
        "scheme": "x402",
        "description": "Send X-PAYMENT: base64(JSON) of a signed EIP-3009 authorization for the amount quoted in the 402 challenge."
      }
    }
  },
  "security": [
    {
      "x402": []
    }
  ],
  "paths": {
    "/v1/chat/completions": {
      "post": {
        "summary": "Chat completion (fast). Flat USDC price per call.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "messages": {
                    "type": "array"
                  },
                  "max_tokens": {
                    "type": "integer"
                  },
                  "stream": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "messages"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "chat.completion or SSE stream"
          },
          "402": {
            "description": "Payment required — body carries x402 accepts[] with price and schema"
          }
        }
      }
    },
    "/v1/chat/completions/pro": {
      "post": {
        "summary": "Chat completion (pro).",
        "responses": {
          "200": {
            "description": "OK"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  }
}
