{
  "openapi": "3.0.0",
  "info": {
    "title": "AI Agent Cost Budget Guard API",
    "version": "1.0.0",
    "description": "Self-contained API for deterministic budget enforcement on AI agent actions."
  },
  "servers": [
    {
      "url": "https://your-vercel-url.vercel.app"
    }
  ],
  "paths": {
    "/": {
      "get": {
        "summary": "List all endpoints",
        "responses": {
          "200": {
            "description": "API index"
          }
        }
      }
    },
    "/openapi": {
      "get": {
        "summary": "Get OpenAPI specification",
        "responses": {
          "200": {
            "description": "OpenAPI 3.0 JSON spec"
          }
        }
      }
    },
    "/examples": {
      "get": {
        "summary": "Get example budget guard payloads",
        "responses": {
          "200": {
            "description": "Example inputs"
          }
        }
      }
    },
    "/priority-catalog": {
      "get": {
        "summary": "Get supported priorities",
        "responses": {
          "200": {
            "description": "Priority list"
          }
        }
      }
    },
    "/check-budget": {
      "post": {
        "summary": "Check whether the next agent action can proceed under budget",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "dailyBudgetUsd": {
                    "type": "number"
                  },
                  "monthlyBudgetUsd": {
                    "type": "number"
                  },
                  "currentDailySpendUsd": {
                    "type": "number"
                  },
                  "currentMonthlySpendUsd": {
                    "type": "number"
                  },
                  "nextActionCostUsd": {
                    "type": "number"
                  },
                  "actionType": {
                    "type": "string"
                  },
                  "priority": {
                    "type": "string",
                    "enum": [
                      "low",
                      "normal",
                      "high",
                      "critical"
                    ]
                  },
                  "reserveBufferUsd": {
                    "type": "number"
                  },
                  "hardDailyLimitUsd": {
                    "type": "number"
                  },
                  "hardMonthlyLimitUsd": {
                    "type": "number"
                  }
                },
                "required": [
                  "dailyBudgetUsd",
                  "monthlyBudgetUsd",
                  "currentDailySpendUsd",
                  "currentMonthlySpendUsd",
                  "nextActionCostUsd"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Budget decision result"
          }
        }
      }
    },
    "/simulate-run": {
      "post": {
        "summary": "Simulate a sequence of upcoming agent actions against the budget",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "baseBudget": {
                    "type": "object"
                  },
                  "actions": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                },
                "required": [
                  "baseBudget",
                  "actions"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Budget simulation result"
          }
        }
      }
    }
  }
}