Building an AI Shopping Friend That Searches All Stores
How to build an AI shopping assistant that compares products across Amazon and Walmart using a unified multi-platform search API.
Shopping online means opening multiple tabs, comparing prices across stores, reading reviews on each platform, and trying to figure out which listing is actually the best deal. An AI shopping assistant can do all of this in one request -- search Amazon and Walmart simultaneously, compare prices, check ratings, and recommend the best option. Scavio's unified API makes this possible because both platforms use the same endpoint and return structured product data.
The Core Idea
A unified search API means you can query multiple e-commerce platforms with the same code. Change the platform field from "amazon" to "walmart" and the rest stays the same. This makes cross-platform comparison trivial to implement. No need for separate scrapers, different parsers, or platform-specific SDKs.
Searching Both Platforms
Here is a function that searches for a product across Amazon and Walmart and returns normalized results:
import requests
SCAVIO_URL = "https://api.scavio.dev/api/v1/search"
def search_product(query: str, api_key: str) -> dict:
results = {}
for platform in ["amazon", "walmart"]:
resp = requests.post(
SCAVIO_URL,
headers={"x-api-key": api_key},
json={
"platform": platform,
"query": query,
"type": "search"
}
)
data = resp.json()
results[platform] = data.get("results", [])[:5]
return resultsNormalizing Product Data
Amazon and Walmart return product data in slightly different structures. Normalizing them into a common format makes comparison straightforward:
def normalize_product(product: dict, platform: str) -> dict:
if platform == "amazon":
return {
"platform": "Amazon",
"title": product.get("title", ""),
"price": product.get("price", {}).get("current_price", 0),
"rating": product.get("rating", 0),
"reviews_count": product.get("ratings_total", 0),
"url": product.get("link", ""),
"id": product.get("asin", "")
}
else:
return {
"platform": "Walmart",
"title": product.get("title", ""),
"price": product.get("price", {}).get("current_price", 0),
"rating": product.get("rating", 0),
"reviews_count": product.get("reviews", 0),
"url": product.get("link", ""),
"id": product.get("product_id", "")
}
def normalize_all(results: dict) -> list:
normalized = []
for platform, products in results.items():
for p in products:
normalized.append(normalize_product(p, platform))
return normalizedBuilding the Comparison Engine
With normalized data, an LLM can compare products intelligently. It considers price, ratings, review volume, and product specifics to make a recommendation:
from anthropic import Anthropic
import json
client = Anthropic()
def compare_products(query: str, products: list) -> str:
msg = client.messages.create(
model="claude-sonnet-4-20250514",
max_tokens=1024,
messages=[{
"role": "user",
"content": f"""A user searched for: "{query}"
Here are products from Amazon and Walmart:
{json.dumps(products, indent=2)}
Compare the top options. Consider price, rating, review count, and value.
Recommend the best option and explain why in 2-3 sentences."""
}]
)
return msg.content[0].textGetting Product Details
For deeper comparison, pull full product details using the product ID. Scavio supports product detail lookups on both platforms:
def get_product_details(product_id: str, platform: str, api_key: str) -> dict:
product_type = "asin" if platform == "amazon" else "product_id"
resp = requests.post(
SCAVIO_URL,
headers={"x-api-key": api_key},
json={
"platform": platform,
"type": "product",
product_type: product_id
}
)
return resp.json()Full product details include specifications, feature lists, seller information, and delivery estimates. This gives the LLM enough data to make a genuinely useful recommendation rather than just comparing prices.
Putting It All Together
The complete flow is: user asks for a product, search both platforms, normalize results, compare with an LLM, and optionally fetch full details for the top picks. The entire thing runs in under 3 seconds and replaces 10 minutes of tab-switching. Wrap it in a simple API endpoint or a chat interface and you have a shopping assistant that actually saves time -- not by guessing at prices, but by pulling real data from real stores in real time.