Your AI models are smart, but they’re living in the past. AnyAPI’s web search feature fixes that by giving them access to real-time web data, so they can answer questions about what’s happening right now, not just what they learned in training.
Slap :online on any model name and boom—instant web search:
Copy
import requestsurl = "https://api.anyapi.ai/api/v1/chat/completions"headers = { "Authorization": f"Bearer {API_KEY}", "Content-Type": "application/json"}payload = { "model": "openai/gpt-4o:online", # This one simple trick... "messages": [ { "role": "user", "content": "What are the latest developments in AI research this week?" } ]}response = requests.post(url, headers=headers, json=payload)result = response.json()print(result["choices"][0]["message"]["content"])# Get answers about stuff that happened yesterday
# What you'll actually paypricing_examples = [ {"results": 5, "cost": "$0.02"}, # Default - perfect for most stuff {"results": 10, "cost": "$0.04"}, # More thorough research {"results": 20, "cost": "$0.08"} # Go all-out comprehensive]# Don't forget model costs for processing the search resultsmodel_processing = { "gpt-4o": "$0.005 per 1k tokens", "claude-3-5-sonnet": "$0.003 per 1k tokens"}
Search results get woven right into the AI’s response, with handy metadata:
Copy
{ "choices": [ { "message": { "content": "Based on recent web search results, here are the latest AI developments...\n\n[Search results were used from: example.com, news-site.com]", "search_metadata": { "query_used": "latest AI research developments 2024", "results_count": 5, "sources": [ { "url": "https://example.com/ai-news", "title": "Latest AI Research Breakthroughs", "snippet": "Recent developments in..." } ] } } } ]}
payload = { "model": "openai/gpt-4o:online", "messages": [ {"role": "user", "content": "What are the top news stories today?"} ]}# Get today's headlines, not last year's training data
payload = { "model": "anthropic/claude-3-5-sonnet-20241022", "messages": [ {"role": "user", "content": "Analyze the current trends in renewable energy investments"} ], "plugins": [ { "id": "web", "max_results": 15, "search_context": "high", "domains": ["bloomberg.com", "reuters.com", "energycentral.com"] } ]}# Skip the fluff, get data from sources that matter
Web search plays nice with all the popular models:
OpenAI: GPT-4, GPT-3.5 Turbo, the whole gang
Anthropic: All the Claude 3 variants
Google: Gemini models
Open source: Llama, Mistral, and the rest
Pick whatever model fits your needs—they all handle web search context like champs.Ready to give your AI models internet access? Web search turns any model into a research assistant that knows what happened five minutes ago, not just what it learned in training.