{
  "openapi": "3.1.0",
  "info": {
    "title": "x402-neural-solver",
    "version": "1.0.0",
    "description": "AI-to-AI services with per-wallet conversation memory: chat, code review, summarize, translate and dataset analysis. Pay per call in USDC on Base. Send JSON bodies. Chat keeps the last 4 exchanges per paying wallet (or per session_id) for 24 hours."
  },
  "paths": {
    "/v1/ai/chat": {
      "post": {
        "summary": "AI chat with memory of your recent messages. Use for multi-turn agent reasoning.",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "ai_chat",
        "description": "AI chat with memory of your recent messages. Use for multi-turn agent reasoning. Paid via x402: 0.003 USDC.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "prompt": {
                    "type": "string",
                    "description": "User prompt"
                  },
                  "session_id": {
                    "type": "string",
                    "description": "Optional stable id to keep memory across calls"
                  }
                },
                "required": [
                  "prompt"
                ]
              },
              "example": {
                "prompt": "Plan the next step",
                "session_id": "agent-42"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "rail": "eip155:8453",
                  "result": {
                    "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."
          }
        }
      }
    },
    "/v1/ai/code": {
      "post": {
        "summary": "Audit and fix code (Gemma 4 26B A4B, fallback Llama 3.3 70B).",
        "x-payment-info": {
          "price": {
            "amount": "5000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "ai_code_review",
        "description": "Audit and fix code (Gemma 4 26B A4B, fallback Llama 3.3 70B). 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": {
                  "result": {
                    "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."
          }
        }
      }
    },
    "/v1/ai/summarize": {
      "post": {
        "summary": "Summarize text into 3 key points.",
        "x-payment-info": {
          "price": {
            "amount": "2000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "ai_summarize",
        "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"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Long text..."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "result": {
                    "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."
          }
        }
      }
    },
    "/v1/ai/translate": {
      "post": {
        "summary": "Translate text into any language.",
        "x-payment-info": {
          "price": {
            "amount": "3000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "ai_translate",
        "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"
                  }
                },
                "required": [
                  "text"
                ]
              },
              "example": {
                "text": "Hello",
                "target_lang": "spanish"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Result",
            "content": {
              "application/json": {
                "example": {
                  "result": {
                    "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."
          }
        }
      }
    },
    "/v1/ai/data-analysis": {
      "post": {
        "summary": "Statistics over a JSON dataset plus 3 AI insights.",
        "x-payment-info": {
          "price": {
            "amount": "4000",
            "asset": "USDC",
            "network": "base"
          }
        },
        "operationId": "data_analysis",
        "description": "Statistics over a JSON dataset plus 3 AI insights. 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": {
                  "result": {
                    "dataset_size": 2,
                    "statistics": {},
                    "insight": "..."
                  }
                }
              }
            }
          },
          "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."
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://x402-neural-solver.alfrexo95.workers.dev"
    }
  ]
}