Using Perplexity Web Search in Vercel AI Gateway
Key point
Vercel AI Gateway has introduced Perplexity web search functionality, providing real-time web search capability to all LLM models.
Details
LLMs are vulnerable to the latest news or real-time information due to the limitations of their training data. Vercel AI Gateway grants any model the ability to perform real-time web searches through the Perplexity Web Search feature.
With just a single line of code, search functionality can be integrated into any model provided through AI Gateway, including OpenAI, Anthropic, and Google. When using the AI SDK, this can be simply implemented by importing gateway.tools.perplexitySearch() from @ai-sdk/gateway.
Perplexity Web Search is especially useful in the following situations:
- Code assistants: Checking the latest package versions, recently merged PRs, and the latest documentation updates
- Production chatbots: Maintaining consistent search behavior even when switching between multiple models
- AI agents: Monitoring real-time information such as price changes, service outages, and job postings
AI Gateway also supports the native web search features of Anthropic, OpenAI, and Google, but using Perplexity provides a consistent search experience regardless of the model type.
The cost is $5 per 1,000 requests, following Perplexity's pricing policy as-is without any additional markup from Vercel.
This summary was generated automatically by AI. Check the original for the author's claims and context. Copyright belongs to the original author.
Our guide explains how the AI works. Report summary errors, attribution issues, or removal requests via Contact.