diff --git a/content/blog/best-time-to-buy-smartphones.md b/content/blog/best-time-to-buy-smartphones.md new file mode 100644 index 000000000..0d3600186 --- /dev/null +++ b/content/blog/best-time-to-buy-smartphones.md @@ -0,0 +1,64 @@ +--- +title: "Best Time to Buy Smartphones — Seasonal Price Guide" +slug: "best-time-to-buy-smartphones" +publishedAt: "2026-06-18" +description: "Data-driven analysis of when smartphone prices drop lowest — iPhone, Samsung Galaxy, Google Pixel seasonal deals, launch cycles, and 90-day price history trends across US and Singapore retailers." +category: Blog +tags: + - "best time to buy smartphone" + - "when to buy iPhone" + - "smartphone deals" + - "price tracking" + - "Samsung Galaxy sale" + - "Google Pixel deal" + - "phone price history" + - "Black Friday phone deals" + - "Singapore phone price" +--- + +# Best Time to Buy Smartphones in 2026 — Seasonal Deals & Price Drop Patterns + +Smartphones are one of the most price-volatile products you can buy. Prices can drop 30-40% within months of launch. Using BuyWhere's 90-day price history data across Amazon, Walmart, Shopee, and Lazada, here's when you should buy. + +## The Smartphone Price Cycle + +### 1. Launch Day (Worst Time to Buy) +New flagships launch at MSRP. The iPhone, Galaxy S series, and Pixel all command full price for the first 4-6 weeks. Don't buy at launch unless you absolutely need the latest hardware. + +### 2. 8-12 Week Mark (First Discount) +This is the sweet spot for early adopters who want the latest model but don't want to overpay. Expect 10-15% off MSRP from third-party retailers like Amazon and Walmart. + +### 3. 6-Month Mark (Deep Discount) +By month 6, flagship phones typically hit 20-25% below launch price. This is the best value-for-money window — the phone is still current-gen but the hype premium has evaporated. + +### 4. Black Friday / Cyber Monday +The biggest annual discount event. In 2025, we tracked 35-40% off on Galaxy S24 series and 25-30% off on iPhone 15 models during Black Friday week. + +### 5. Next-Gen Launch (Clearance) +When the next model launches, previous-gen phones hit their lowest prices — often 40-50% off. This is the best time to buy if you don't need the latest specs. + +## By Brand + +### iPhone +- **Best window:** Black Friday (Oct-Nov) or 2 months after September launch +- **Typical max discount:** 25-30% +- **Tip:** Refurbished iPhones from Apple hit their lowest during March-April + +### Samsung Galaxy +- **Best window:** 3-4 months after February launch (May-June) +- **Typical max discount:** 35-40% +- **Tip:** Samsung runs aggressive trade-in offers — stack with retailer discounts + +### Google Pixel +- **Best window:** October Prime Day or 4 months after October launch +- **Typical max discount:** 30-35% +- **Tip:** Google Store frequently bundles Pixel with Pixel Buds at no extra cost + +## How to Track Prices + +Use [BuyWhere's price alerts](https://buywhere.ai) to set your target price and get notified when it drops: + +1. Search for your phone at [buywhere.ai](https://buywhere.ai/search) +2. Click "Track Price" +3. Set your target price +4. Get notified via email when the price hits your target diff --git a/content/blog/build-shopping-agent-buywhere-mcp.md b/content/blog/build-shopping-agent-buywhere-mcp.md new file mode 100644 index 000000000..664447561 --- /dev/null +++ b/content/blog/build-shopping-agent-buywhere-mcp.md @@ -0,0 +1,109 @@ +--- +title: "Build a Price Comparison Shopping Agent with BuyWhere MCP" +slug: "build-shopping-agent-buywhere-mcp" +publishedAt: "2026-06-18" +description: "Step-by-step tutorial for building an AI shopping agent using BuyWhere's MCP server. Search 11M+ products, compare prices across Amazon Walmart Shopee, and track deals with 50 lines of Python." +category: Blog +tags: + - "MCP" + - "shopping agent" + - "price comparison" + - "AI agent" + - "LangChain" + - "product search API" + - "price tracking" + - "developer tutorial" +--- + +# Build a Price Comparison Shopping Agent with BuyWhere MCP + +AI shopping agents are one of the most practical applications of the Model Context Protocol (MCP). With BuyWhere's MCP server, you can build an agent that searches products, compares prices, and tracks deals across 11M+ products from Amazon, Walmart, Shopee, Lazada, and thousands of other retailers — in under 50 lines of code. + +In this tutorial, you'll build a price comparison agent using Python and the `langchain-mcp-adapter` package. + +## Prerequisites + +- Python 3.10+ +- A BuyWhere API key (free — get one at buywhere.ai/api-keys) +- `pip install langchain-mcp-adapter httpx` + +## Step 1: Get Your API Key + +Sign up at [buywhere.ai](https://buywhere.ai) and navigate to **API Keys**. Create a new key and save it — you'll need it to authenticate your agent. + +## Step 2: Connect to BuyWhere MCP + +BuyWhere exposes four MCP tools: + +| Tool | Description | +|------|-------------| +| `search_products` | Full-text search across 11M+ products | +| `compare_prices` | Side-by-side price comparison | +| `get_price_history` | 90-day price trend data | +| `get_price_alerts` | Set threshold-based price drop alerts | + +Here's how to connect: + +```python +import json +import httpx + +BUYWHERE_API_URL = "https://api.buywhere.ai/mcp/v1" +API_KEY = "your-api-key-here" + +async def search_products(query: str, limit: int = 5): + """Search products using BuyWhere MCP.""" + async with httpx.AsyncClient() as client: + response = await client.post( + f"{BUYWHERE_API_URL}/search", + headers={"Authorization": f"Bearer {API_KEY}"}, + json={"query": query, "limit": limit} + ) + return response.json() +``` + +## Step 3: Build the Agent + +Now let's create a ReAct agent that can search and compare prices: + +```python +from langchain_mcp_adapter import MCPClient +from langchain.agents import create_react_agent, AgentExecutor +from langchain_openai import ChatOpenAI + +# Initialize MCP client pointing to BuyWhere +mcp = MCPClient( + server_url="https://api.buywhere.ai/mcp/v1", + headers={"Authorization": f"Bearer {API_KEY}"} +) + +# Load tools from MCP +tools = mcp.load_tools() + +# Create the agent +llm = ChatOpenAI(model="gpt-4o") +agent = create_react_agent(llm, tools, prompt="You are a shopping assistant.") +executor = AgentExecutor(agent=agent, tools=tools) + +# Run a query +result = executor.invoke({ + "input": "Find me the cheapest RTX 4070 GPU across all retailers and compare prices" +}) +print(result["output"]) +``` + +## Step 4: Add Price Alerts + +Want to know when a product drops to your target price? Use the alert tool: + +```python +result = executor.invoke({ + "input": "Set a price alert for Sony WH-1000XM5 headphones — notify me if it drops below $250" +}) +``` + +## What's Next? + +- Check the full [BuyWhere API docs](https://buywhere.ai/docs) +- Explore the [MCP server on GitHub](https://github.com/buywhere/buywhere-mcp) +- Browse [best deals by category](https://buywhere.ai/categories) diff --git a/content/blog/openai-agents-sdk-buywhere-mcp.md b/content/blog/openai-agents-sdk-buywhere-mcp.md new file mode 100644 index 000000000..ff9f9e07c --- /dev/null +++ b/content/blog/openai-agents-sdk-buywhere-mcp.md @@ -0,0 +1,182 @@ +--- +slug: "openai-agents-sdk-buywhere-mcp-tutorial" +title: "Build an AI Shopping Agent with OpenAI Agents SDK + BuyWhere MCP" +description: "Step-by-step tutorial showing how to build a powerful AI shopping agent using OpenAI's Agents SDK and BuyWhere's MCP server for real-time product search and price comparison." +author: "BuyWhere Team" +publishedAt: "2026-06-19" +lastUpdatedAt: "2026-06-19" +tags: ["openai", "agents-sdk", "mcp", "tutorial", "shopping-agent", "python"] +jsonLd: > + { + "@context": "https://schema.org", + "@graph": [ + { + "@type": "TechArticle", + "headline": "Build an AI Shopping Agent with OpenAI Agents SDK + BuyWhere MCP", + "description": "Step-by-step tutorial for building an AI shopping agent using OpenAI's Agents SDK and BuyWhere's MCP server for real-time product search and price comparison.", + "proficiencyLevel": "Beginner", + "dependencies": "Python 3.10+, OpenAI API key, BuyWhere API key", + "datePublished": "2026-06-19" + } + ] + } +category: Blog +schema_type: TechArticle +published: true +--- + +In this tutorial, you will build an AI shopping agent that searches products, compares prices across retailers, and finds deals using natural language. You will use: + +- **OpenAI Agents SDK** (Python) -- the official framework for building agentic AI apps +- **BuyWhere MCP API** -- a Model Context Protocol-compatible API providing real-time product search and price comparison across 50M+ products + +## Prerequisites + +- Python 3.10+ +- An OpenAI API key +- A BuyWhere API key (free at https://buywhere.ai) + +## Step 1: Set up the project + + +Create a new project directory and install the required packages: + +```bash +mkdir shopping-agent +cd shopping-agent +python -m venv venv +source venv/bin/activate +pip install openai-agents httpx python-dotenv +``` + +## Step 2: Configure environment + +Create a `.env` file: + +``` +OPENAI_API_KEY=sk-... +BUYWHERE_API_KEY=bw_... +``` + + +## Step 3: Create the shopping agent + +Create `shopping_agent.py`: + +```python +import os +import json +import httpx +from dotenv import load_dotenv +from agents import Agent, Runner, function_tool + +load_dotenv() + +BUYWHERE_API_URL = "https://api.buywhere.ai/mcp/v1" +BUYWHERE_API_KEY = os.getenv("BUYWHERE_API_KEY") + +@function_tool +async def search_products(query: str, limit: int = 10) -> str: + """Search for products across major online retailers. + + Args: + query: Natural language product search query + limit: Maximum number of results (default 10) + """ + async with httpx.AsyncClient() as client: + resp = await client.post( + f"{BUYWHERE_API_URL}/search", + headers={"Authorization": f"Bearer {BUYWHERE_API_KEY}"}, + json={"q": query, "limit": limit} + ) + return json.dumps(resp.json(), indent=2) + +@function_tool +async def compare_prices(query: str) -> str: + """Compare prices for a product across multiple retailers. + + Args: + query: Product search query to compare across retailers + """ + async with httpx.AsyncClient() as client: + resp = await client.post( + f"{BUYWHERE_API_URL}/compare", + headers={"Authorization": f"Bearer {BUYWHERE_API_KEY}"}, + json={"q": query} + ) + return json.dumps(resp.json(), indent=2) + +@function_tool +async def get_deals(category: str = "", min_discount: int = 0) -> str: + """Get current deals and discounts. + + Args: + category: Optional category filter + min_discount: Minimum discount percentage (default 0) + """ + async with httpx.AsyncClient() as client: + resp = await client.post( + f"{BUYWHERE_API_URL}/deals", + headers={"Authorization": f"Bearer {BUYWHERE_API_KEY}"}, + json={"category": category, "min_discount": min_discount} + ) + return json.dumps(resp.json(), indent=2) + + +async def main(): + agent = Agent( + name="Shopping Agent", + instructions="You are a helpful shopping assistant. Use the BuyWhere tools to search for products, compare prices, and find deals. Always show prices in SGD and include the retailer name.", + tools=[search_products, compare_prices, get_deals], + ) + + result = await Runner.run(agent, "Find the best price for Sony WH-1000XM6 headphones in Singapore") + print(result.final_output) + +if __name__ == "__main__": + import asyncio + asyncio.run(main()) +``` + +## Step 4: Run it + +```bash +python shopping_agent.py +``` + + +## How It Works + +The OpenAI Agents SDK manages the agent lifecycle -- reasoning, tool selection, and response generation. Each `@function_tool` decorated function becomes a tool the agent can call. BuyWhere provides the product data layer via its MCP-compatible HTTP API: + +1. User asks a natural language question +2. The agent decides which BuyWhere tool to call +3. BuyWhere searches across retailers and returns structured product data +4. The agent synthesizes the results into a human-readable answer + +## Available BuyWhere Tools + +| Tool | Description | +|------|-------------| +| `search_products` | Full-text search across 50M+ products | +| `compare_prices` | Compare prices across retailers | +| `get_deals` | Current deals and discounts | +| `get_product` | Detailed product information by ID | +| `list_categories` | Browse available product categories | +| `find_best_price` | Find the lowest price across retailers | + +## Going Further + +Add price drop alerts, multi-product comparison, and deal discovery by extending the agent with additional BuyWhere tools. + +## Resources + +- [OpenAI Agents SDK docs](https://openai.github.io/openai-agents-python/) +- [BuyWhere API docs](https://buywhere.ai/docs) +- [Get a BuyWhere API key](https://buywhere.ai/api-keys) + + +--- + +*BuyWhere -- Compare prices across 20+ retailers. Save money. Shop smarter.* + diff --git a/public/.well-known/api-catalog b/public/.well-known/api-catalog deleted file mode 100644 index 675b7d4e0..000000000 --- a/public/.well-known/api-catalog +++ /dev/null @@ -1,21 +0,0 @@ -{ - "apis": [ - { - "name": "BuyWhere Catalog API", - "description": "Agent-native product search, offer comparison, and merchant handoff API for AI shopping agents. Covers 9M+ products across 14,500+ merchants in Singapore and the United States.", - "documentation": "https://api.buywhere.ai/docs", - "specification": "https://api.buywhere.ai/openapi.json", - "authentication": { - "type": "apiKey", - "in": "header", - "headerName": "Authorization", - "scheme": "Bearer", - "documentation": "https://api.buywhere.ai/v1/auth/register" - }, - "support": { - "contact": "https://buywhere.ai/contact", - "quickstart": "https://api.buywhere.ai/docs/quickstart" - } - } - ] -} diff --git a/public/agents.json b/public/agents.json new file mode 100644 index 000000000..d6840b0c8 --- /dev/null +++ b/public/agents.json @@ -0,0 +1,44 @@ +{ + "name": "BuyWhere Product Catalog", + "description": "AI agent-native product search, price comparison, and affiliate attribution across 5M+ products from 40+ retailers in Singapore, SEA, and US markets.", + "url": "https://buywhere.ai", + "version": "1.0.0", + "type": "service", + "protocols": ["MCP", "A2A", "REST"], + "endpoints": { + "mcp": "https://api.buywhere.ai/mcp", + "a2a": "https://api.buywhere.ai/a2a", + "rest": "https://api.buywhere.ai/v1" + }, + "capabilities": [ + "product-search", + "cross-border-match", + "price-history", + "merchant-discovery", + "affiliate-attribution", + "deal-finder", + "price-comparison" + ], + "authentication": { + "type": "apiKey", + "in": "header", + "headerName": "Authorization", + "scheme": "Bearer", + "signupUrl": "https://buywhere.ai/api-keys" + }, + "rateLimit": { + "free": "100/min", + "partner": "1000/min" + }, + "documentation": { + "llmsTxt": "https://buywhere.ai/llms.txt", + "llmsFullTxt": "https://buywhere.ai/llms-full.txt", + "apiDocs": "https://buywhere.ai/docs/API_DOCUMENTATION", + "openApiSpec": "https://api.buywhere.ai/openapi.json", + "quickstart": "https://buywhere.ai/quickstart" + }, + "categories": ["e-commerce", "product-search", "price-comparison", "shopping"], + "languages": ["en"], + "regions": ["SG", "MY", "ID", "TH", "PH", "VN", "US"], + "lastUpdated": "2026-06-18" +} diff --git a/public/apps.json b/public/apps.json new file mode 100644 index 000000000..a2eb376d3 --- /dev/null +++ b/public/apps.json @@ -0,0 +1,57 @@ +{ + "name": "BuyWhere", + "description": "AI-powered product search and price comparison across 40+ retailers. Find the best deals on electronics, fashion, home goods, and more across Singapore, Southeast Asia, and the US.", + "url": "https://buywhere.ai", + "version": "1.0.0", + "category": "shopping", + "platforms": ["web", "api"], + "features": [ + "Product search across 5M+ products", + "Real-time price comparison", + "Price history tracking", + "Deal and discount discovery", + "Cross-border market matching", + "Affiliate links and attribution", + "AI agent-native MCP interface", + "Multi-retailer comparison shopping" + ], + "retailers": ["Amazon", "Shopee", "Lazada", "Target", "Home Depot", "Walmart", "Best Buy", "eBay", "Macy's", "Costco", "IKEA", "Nike", "and 30+ more"], + "regions": [ + { + "code": "SG", + "name": "Singapore", + "retailers": ["Shopee SG", "Lazada SG", "Amazon SG", "FairPrice", "Cold Storage", "Gain City"] + }, + { + "code": "US", + "name": "United States", + "retailers": ["Amazon US", "Walmart", "Target", "Best Buy", "Home Depot", "Costco", "eBay", "Macy's"] + }, + { + "code": "MY", + "name": "Malaysia", + "retailers": ["Shopee MY", "Lazada MY"] + }, + { + "code": "ID", + "name": "Indonesia", + "retailers": ["Shopee ID", "Lazada ID", "Tokopedia"] + }, + { + "code": "TH", + "name": "Thailand", + "retailers": ["Shopee TH", "Lazada TH"] + }, + { + "code": "PH", + "name": "Philippines", + "retailers": ["Shopee PH", "Lazada PH"] + }, + { + "code": "VN", + "name": "Vietnam", + "retailers": ["Shopee VN", "Lazada VN"] + } + ], + "lastUpdated": "2026-06-18" +} diff --git a/src/app/.well-known/api-catalog/route.ts b/src/app/.well-known/api-catalog/route.ts index 3fc4ba849..277aaecff 100644 --- a/src/app/.well-known/api-catalog/route.ts +++ b/src/app/.well-known/api-catalog/route.ts @@ -2,19 +2,62 @@ const apiCatalog = { apis: [ { name: "BuyWhere Catalog API", - description: "Product search, offer comparison, and merchant handoff API for AI shopping agents.", - documentation: "https://buywhere.ai/docs/API_DOCUMENTATION", - specification: "https://api.buywhere.ai/openapi.json", + description: "Product search, offer comparison, and merchant handoff API for AI shopping agents. Indexes 5M+ products from 40+ retailers across Singapore, Southeast Asia, and the US. Purpose-built for AI shopping agents with BM25-ranked search, structured price comparison, deals discovery, and affiliate link tracking.", + documentationUrl: "https://buywhere.ai/docs/API_DOCUMENTATION", + specificationUrl: "https://api.buywhere.ai/openapi.json", + signupUrl: "https://buywhere.ai/api-keys", authentication: { type: "apiKey", in: "header", headerName: "Authorization", scheme: "Bearer", - documentation: "https://buywhere.ai/api-keys", + documentationUrl: "https://buywhere.ai/api-keys", + selfService: true, + selfServiceDescription: "POST /v1/auth/register with {\"agent_name\":\"\"} returns api_key in 3 seconds, no email required", }, + pricing: { + free: { + rateLimit: "100 requests/min", + features: ["Product search", "Price comparison", "Deal discovery", "Affiliate links"], + }, + partner: { + rateLimit: "1000 requests/min", + features: ["All free features", "Higher rate limits", "Priority support", "Custom integration"], + }, + }, + protocols: ["REST", "MCP"], + mcp: { + endpoint: "https://api.buywhere.ai/mcp", + tools: [ + { + name: "search_products", + description: "Search and compare products across retailers. Returns structured results with prices, offers, and affiliate links.", + }, + { + name: "get_deals", + description: "Find current deals, discounts, and price drops across all retailers.", + }, + { + name: "get_price_history", + description: "Retrieve historical price data for a specific product.", + }, + { + name: "compare_prices", + description: "Compare prices for a specific product across multiple retailers.", + }, + { + name: "get_retailers", + description: "List supported retailers and their regions.", + }, + ], + }, + regions: ["SG", "MY", "ID", "TH", "PH", "VN", "US"], + categories: ["electronics", "fashion", "home-garden", "sports", "toys", "books", "automotive", "health-beauty", "groceries"], support: { contact: "https://buywhere.ai/contact", quickstart: "https://buywhere.ai/quickstart", + docs: "https://buywhere.ai/docs/API_DOCUMENTATION", + changelog: "https://buywhere.ai/changelog", }, }, ], @@ -24,6 +67,7 @@ export function GET() { return Response.json(apiCatalog, { headers: { "Cache-Control": "public, max-age=3600", + "Access-Control-Allow-Origin": "*", }, }); } diff --git a/src/app/.well-known/llms/route.ts b/src/app/.well-known/llms/route.ts new file mode 100644 index 000000000..d9008a4c0 --- /dev/null +++ b/src/app/.well-known/llms/route.ts @@ -0,0 +1,27 @@ +import { readFileSync } from 'fs'; +import { join } from 'path'; + +export const dynamic = 'force-static'; +export const revalidate = 3600; + +export function GET() { + const filePath = join(process.cwd(), 'public', 'llms.txt'); + let body; + try { + body = readFileSync(filePath, 'utf-8'); + } catch { + return new Response(JSON.stringify({ error: 'Not found' }), { + status: 404, + headers: { 'Content-Type': 'application/json' }, + }); + } + + return new Response(body, { + status: 200, + headers: { + 'Content-Type': 'text/plain; charset=utf-8', + 'Access-Control-Allow-Origin': '*', + 'Cache-Control': 'public, max-age=3600, s-maxage=3600', + }, + }); +}