Skip to content
Dashboard

Introducing AI Integrations on Vercel

VP of Product, AI

Incorporate AI models and services from industry-leading providers into your Vercel projects with just a few clicks.

Explore and play with the popular AI models from various providers.Explore and play with the popular AI models from various providers.
Explore and play with the popular AI models from various providers.

Link to headingBuilding the future with AI

Our first cohort of AI Integration partners, now available in the AI tab.Our first cohort of AI Integration partners, now available in the AI tab.
Our first cohort of AI Integration partners, now available in the AI tab.

Link to headingConnecting to models with the AI SDK

app/api/chat/route.ts
import { OpenAIStream, StreamingTextResponse } from 'ai';
import OpenAI from 'openai';
const perplexity = new OpenAI({
apiKey: process.env.PERPLEXITY_API_KEY || '',
baseUrl: 'https://api.perplexity.ai',
});
export async function POST(req: Request) {
const { messages } = await req.json();
// Generated a chat completion based on the prompt
const response = await perplexity.chat.completions.create({
model: 'pplx-7b-chat',
stream: true,
messages: messages,
});
// Convert the response into a friendly text-stream
const stream = OpenAIStream(response);
// Respond with the stream
return new StreamingTextResponse(stream);
}

Using the Perplexity API with the Next.js App Router.

Link to headingGet Started Today

Start building today

Explore, preview, and seamlessly integrate AI models and databases into your Vercel projects.

Get Started

Ready to deploy?