{
  "openapi": "3.1.0",
  "info": {
    "title": "AI.GG Agent API",
    "version": "0.1.0",
    "description": "Agent-readable sketch of the AI.GG TEE-aware account-level payment and gateway surface. Authenticated endpoints, exact schemas, provider TEE policy, and model availability depend on deployment configuration."
  },
  "servers": [
    {
      "url": "https://ai.gg",
      "description": "AI.GG production surface"
    }
  ],
  "paths": {
    "/llms.txt": {
      "get": {
        "summary": "Get concise AI.GG agent context",
        "responses": {
          "200": {
            "description": "Markdown agent context"
          }
        }
      }
    },
    "/facts.json": {
      "get": {
        "summary": "Get canonical AI.GG product facts",
        "responses": {
          "200": {
            "description": "Canonical product facts"
          }
        }
      }
    },
    "/api/v1/payment/x402/top-up": {
      "post": {
        "summary": "Create or settle an x402 top-up for ordinary balance or GCT",
        "description": "Used by wallet-enabled clients to top up AI.GG account balance with USDC or deposit GCT into the platform GCT balance. The request may receive an x402 payment challenge before settlement.",
        "security": [
          {
            "sessionAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "amount": {
                    "type": "number",
                    "description": "Requested top-up amount."
                  },
                  "asset": {
                    "type": "string",
                    "enum": [
                      "balance",
                      "usdc",
                      "gct"
                    ],
                    "description": "Target asset. Use gct for direct GCT top-up."
                  }
                },
                "required": [
                  "amount"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Top-up settled or accepted"
          },
          "402": {
            "description": "x402 payment challenge"
          },
          "401": {
            "description": "Authentication required"
          }
        }
      }
    },
    "/api/v1/admin/tee/image-hashes": {
      "get": {
        "summary": "List trusted TEE image hashes for provider capacity",
        "description": "Administrative surface for reviewing the TEE image hash allowlist used by provider endpoint trust policy.",
        "security": [
          {
            "sessionAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Trusted TEE image hash list"
          },
          "401": {
            "description": "Authentication required"
          },
          "403": {
            "description": "Admin permission required"
          }
        }
      }
    },
    "/v1/chat/completions": {
      "post": {
        "summary": "OpenAI-compatible chat completion through AI.GG",
        "description": "Representative OpenAI-compatible gateway path for agent skill model calls. Exact route availability depends on deployment and account configuration.",
        "security": [
          {
            "apiKeyAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Model response"
          },
          "401": {
            "description": "Invalid or missing API key"
          },
          "402": {
            "description": "Insufficient GCT or ordinary balance"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "apiKeyAuth": {
        "type": "http",
        "scheme": "bearer",
        "description": "AI.GG API key used by agent skills."
      },
      "sessionAuth": {
        "type": "apiKey",
        "in": "cookie",
        "name": "session",
        "description": "Authenticated browser or wallet-linked session."
      }
    }
  }
}
