{
  "openapi": "3.1.0",
  "info": {
    "title": "x402 AI Gateway",
    "version": "1.0.0",
    "description": "AI-powered API endpoints powered by Gemini 2.0 Flash. Pay with USDC on Base or Solana.",
    "contact": {
      "email": "sna4an@users.noreply.github.com"
    },
    "x-guidance": "This API provides AI-powered text processing via Gemini. All endpoints require USDC payment via x402. Use POST with JSON body for all endpoints except /api/info which uses GET."
  },
  "servers": [
    {
      "url": "https://x402-ai-gateway-rosy.vercel.app"
    }
  ],
  "paths": {
    "/api/summarize": {
      "post": {
        "operationId": "summarize",
        "summary": "Summarize text",
        "description": "Generate a concise summary of input text using Gemini AI.",
        "tags": [
          "AI Text Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.020000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 50,
                    "description": "Text to summarize"
                  },
                  "maxSentences": {
                    "type": "integer",
                    "default": 3
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Summary result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/translate": {
      "post": {
        "operationId": "translate",
        "summary": "Translate text",
        "description": "Translate text to a target language using Gemini AI.",
        "tags": [
          "AI Text Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.020000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1
                  },
                  "targetLanguage": {
                    "type": "string",
                    "minLength": 2
                  }
                },
                "required": [
                  "text",
                  "targetLanguage"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Translation result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/sentiment": {
      "post": {
        "operationId": "sentiment",
        "summary": "Analyze sentiment",
        "description": "Analyze sentiment of text. Returns label and confidence score.",
        "tags": [
          "AI Text Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sentiment result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/extract-keywords": {
      "post": {
        "operationId": "extractKeywords",
        "summary": "Extract keywords",
        "description": "Extract top 10 keywords and key phrases from text.",
        "tags": [
          "AI Text Processing"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.010000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "minLength": 1
                  }
                },
                "required": [
                  "text"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Keywords result",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    },
    "/api/code-explain": {
      "post": {
        "operationId": "codeExplain",
        "summary": "Explain code",
        "description": "Explain code snippet in plain English.",
        "tags": [
          "AI Code Analysis"
        ],
        "x-payment-info": {
          "price": {
            "mode": "fixed",
            "currency": "USD",
            "amount": "0.030000"
          },
          "protocols": [
            {
              "x402": {}
            }
          ]
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "minLength": 1
                  },
                  "language": {
                    "type": "string"
                  }
                },
                "required": [
                  "code"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Code explanation",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          },
          "402": {
            "description": "Payment Required"
          }
        }
      }
    }
  }
}