{
  "openapi": "3.1.0",
  "info": {
    "title": "x402 Solver Bot + AI",
    "version": "5.0.0",
    "description": "Pay-per-call developer and on-chain utilities for AI agents: web to markdown, secret scanner, Solidity audit, token risk, Chainlink BTC/USD, swap payload builder, AI chat, summarize, translate and code review. Every route accepts GET query parameters or a POST JSON body with the same fields. Settlement is USDC on Base."
  },
  "paths": {
    "/v1/extract": {
      "get": {
        "summary": "Fetch a URL and return clean text/markdown. Use to read a web page cheaply.",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "extract_url",
        "description": "Fetch a URL and return clean text/markdown. Use to read a web page cheaply. Paid via x402: 0.003 USDC.",
        "parameters": [
          {
            "name": "url",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "http(s) URL"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "url": "https://example.com",
                  "markdown": "..."
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        }
      }
    },
    "/v1/scan/secrets": {
      "get": {
        "summary": "Detect leaked API keys, tokens, private keys.",
        "x-payment-info": {
          "price": {
            "amount": "2000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "scan_secrets",
        "summary": "Detect leaked API keys, tokens and private keys in text before publishing.",
        "description": "Detect leaked API keys, tokens and private keys in text before publishing. Paid via x402: 0.002 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text or code to scan"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "const k='AKIA...'"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "safe_to_publish": false,
                  "findings": [
                    {
                      "type": "aws_key"
                    }
                  ]
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "2000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/audit/solidity": {
      "get": {
        "summary": "Static Solidity audit (reentrancy, tx.origin, etc).",
        "x-payment-info": {
          "price": {
            "amount": "20000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "audit_solidity",
        "summary": "Static Solidity audit for common issues (tx.origin, delegatecall, reentrancy patterns).",
        "description": "Static Solidity audit for common issues (tx.origin, delegatecall, reentrancy patterns). Paid via x402: 0.02 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Solidity source"
                  }
                },
                "required": [
                  "code"
                ]
              },
              "example": {
                "code": "contract A {}"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "verdict": "PASS",
                  "issues": []
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "20000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/token": {
      "get": {
        "summary": "Token risk report from DexScreener liquidity and volume signals.",
        "x-payment-info": {
          "price": {
            "amount": "5000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "token_risk",
        "description": "Token risk report from DexScreener liquidity and volume signals. Paid via x402: 0.005 USDC.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Token contract address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "risk_level": "LOW",
                  "risk_signals": [],
                  "liquidity_usd": 1000000
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        }
      }
    },
    "/v1/ai/chat": {
      "get": {
        "summary": "AI chat with Llama 3.2 (Workers AI).",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "ai_chat",
        "summary": "General AI chat completion (Llama 3.3 70B with automatic fallback).",
        "description": "General AI chat completion (Llama 3.3 70B with automatic fallback). Paid via x402: 0.003 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "User prompt"
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "Explain x402 in one line"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "response": "..."
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/ai/summarize": {
      "get": {
        "summary": "Summarize text into 3 key points (Workers AI).",
        "x-payment-info": {
          "price": {
            "amount": "2000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "ai_summarize",
        "summary": "Summarize text into 3 key points.",
        "description": "Summarize text into 3 key points. Paid via x402: 0.002 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text to summarize"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Long text..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "summary": "..."
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "2000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/ai/translate": {
      "get": {
        "summary": "Translate text to any language (Workers AI).",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "ai_translate",
        "summary": "Translate text into any language.",
        "description": "Translate text into any language. Paid via x402: 0.003 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "text": {
                    "type": "string",
                    "description": "Text"
                  },
                  "target_lang": {
                    "type": "string",
                    "description": "Target language, e.g. spanish"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Hello",
                "target_lang": "spanish"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "translation": "Hola"
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/ai/code": {
      "get": {
        "summary": "AI code review with Gemma 4 26B A4B; Llama 3.3 70B fallback.",
        "x-payment-info": {
          "price": {
            "amount": "5000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "ai_code_review",
        "summary": "AI code audit with Qwen2.5-Coder.",
        "description": "AI code audit with Qwen2.5-Coder. Paid via x402: 0.005 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "code": {
                    "type": "string",
                    "description": "Code to review"
                  }
                },
                "required": [
                  "code"
                ]
              },
              "example": {
                "code": "function f(){}"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "audit": "..."
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "5000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/chainlink/price": {
      "get": {
        "summary": "On-chain Chainlink BTC/USD price.",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "chainlink_btc_usd",
        "description": "On-chain Chainlink BTC/USD price. Paid via x402: 0.003 USDC.",
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "pair": "BTC/USD",
                  "price_usd": 67000,
                  "source": "Chainlink on-chain"
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        }
      }
    },
    "/v1/token/trading": {
      "get": {
        "summary": "Current price, liquidity and 24h volume of a token via DexScreener.",
        "x-payment-info": {
          "price": {
            "amount": "5000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "token_trading",
        "description": "Current price, liquidity and 24h volume of a token via DexScreener. Paid via x402: 0.005 USDC.",
        "parameters": [
          {
            "name": "address",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Token contract address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "price_usd": "3000",
                  "liquidity_usd": 1000000,
                  "volume_24h_usd": 500000
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        }
      }
    },
    "/v1/execute/swap": {
      "get": {
        "summary": "Generate a swap transaction payload.",
        "x-payment-info": {
          "price": {
            "amount": "10000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "swap_payload",
        "summary": "Builds an unsigned swap instruction payload. Does not move funds.",
        "description": "Builds an unsigned swap instruction payload. Does not move funds. Paid via x402: 0.01 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from_token": {
                    "type": "string",
                    "description": "Token to sell"
                  },
                  "to_token": {
                    "type": "string",
                    "description": "Token to buy"
                  },
                  "amount": {
                    "type": "string",
                    "description": "Amount"
                  },
                  "recipient": {
                    "type": "string",
                    "description": "Recipient address"
                  },
                  "chain_id": {
                    "type": "integer"
                  }
                },
                "required": [
                  "from_token",
                  "to_token",
                  "amount",
                  "recipient"
                ]
              },
              "example": {
                "from_token": "USDC",
                "to_token": "WETH",
                "amount": "10",
                "recipient": "0x0000000000000000000000000000000000000001",
                "chain_id": 8453
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "swap_payload": {
                    "chain_id": 8453
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "10000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    },
    "/v1/ai/data-analysis": {
      "get": {
        "summary": "Analyze a JSON dataset with Workers AI.",
        "x-payment-info": {
          "price": {
            "amount": "4000",
            "asset": "USDC",
            "network": "base"
          }
        }
      },
      "post": {
        "operationId": "data_analysis",
        "summary": "Numeric statistics (count, mean, median, min, max) over a JSON array of records.",
        "description": "Numeric statistics (count, mean, median, min, max) over a JSON array of records. Paid via x402: 0.004 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "data": {
                    "type": "array",
                    "items": {
                      "type": "object"
                    }
                  }
                },
                "required": [
                  "data"
                ]
              },
              "example": {
                "data": [
                  {
                    "x": 1
                  },
                  {
                    "x": 3
                  }
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "dataset_size": 2,
                  "statistics": {
                    "x": {
                      "mean": 2
                    }
                  }
                }
              }
            }
          },
          "402": {
            "description": "x402 payment required. Decode the PAYMENT-REQUIRED header (base64 JSON), sign an EIP-3009 USDC authorization and retry with the PAYMENT-SIGNATURE header."
          }
        },
        "x-payment-info": {
          "price": {
            "amount": "4000",
            "asset": "USDC",
            "network": "base"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://x402-solver-gateway.alfrexo95.workers.dev"
    }
  ]
}