Skip to content
Dashboard

Use Perplexity Web Search with Vercel AI Gateway

Link to headingHow it works

import { streamText } from 'ai';
import { gateway } from '@ai-sdk/gateway';
const result = streamText({
model: 'minimax/minimax-m2.1',
prompt: 'What were the major tech announcements this week?',
tools: {
perplexity_search: gateway.tools.perplexitySearch(),
},
});

Link to headingUse cases

Link to headingModels without native search

import { streamText } from 'ai';
import { gateway } from '@ai-sdk/gateway';
const result = streamText({
model: 'zai/glm-4.7', // No native search, but Perplexity works
prompt: 'What new features were added in React 19.2?',
tools: {
perplexity_search: gateway.tools.perplexitySearch(),
},
});

Link to headingDeveloper tooling and CI assistants

import { streamText } from 'ai';
import { gateway } from '@ai-sdk/gateway';
const result = streamText({
model: 'anthropic/claude-sonnet-4.5',
prompt: 'What is the latest stable version of Next.js and what breaking changes should I know about?',
tools: {
perplexity_search: gateway.tools.perplexitySearch(),
},
});

Link to headingProvider-agnostic chatbot

import { streamText } from 'ai';
import { gateway } from '@ai-sdk/gateway';
const models = ['openai/gpt-5.2', 'anthropic/claude-sonnet-4.5', 'zai/glm-4.7'];
const result = streamText({
model: models[selectedIndex], // Same search logic works across any model
prompt: 'What is the current status of the OpenAI API?',
tools: {
perplexity_search: gateway.tools.perplexitySearch({
searchDomainFilter: ['status.openai.com', 'openai.com'],
searchRecencyFilter: 'day',
}),
},
});

Link to headingOperational and market-aware agents

import { streamText } from 'ai';
import { gateway } from '@ai-sdk/gateway';
const result = streamText({
model: 'openai/gpt-5.2',
prompt: 'Are there any ongoing incidents affecting Vercel or AWS us-east-1?',
tools: {
perplexity_search: gateway.tools.perplexitySearch({
searchDomainFilter: ['status.vercel.com', 'health.aws.amazon.com'],
searchRecencyFilter: 'day',
}),
},
});

Link to headingProvider-specific tools

Link to headingPricing

Link to headingGet started

Ready to deploy?