In short.
Perplexity with the Vercel AI SDK is an integration guide for TypeScript app developers, with extra code needed to enable web search and retrieve supporting sources. It connects @ai-sdk/open-responses to Perplexity's /v1/responses endpoint for generateText and streamText. Its main limitation is source handling: result.sources remains empty, and the demonstrated workaround extracts search_results only from non-streaming responses. Package compatibility, live model availability, costs and runtime behavior are unassessed.
Researched and written by an AI model and checked by a second AI model. How it works
Coverage is the complete supplied page at https://docs.perplexity.ai/docs/getting-started/integrations/vercel-ai-sdk.md, including its overview, installation, key setup, examples, web-search caveats, effort settings, streaming guidance, model examples and support references. The documentation-index notice and related links are present, but their destinations are excluded. No linked pricing, license, model catalog or provider documentation was assessed. Examples were not executed; runtime behavior and end-to-end application behavior remain unverified.
The overview
identity
This is a Perplexity documentation guide explaining how to use its Agent API through the Vercel AI SDK. The resource is the guide itself; it does not provide a separate application or downloadable integration package.
The original page is [https://docs.perplexity.ai/docs/getting-started/integrations/vercel-ai-sdk.md]. Its examples use the ai and @ai-sdk/open-responses packages.
assessment
The guide is useful for developers who want Perplexity access while retaining familiar AI SDK generation and streaming functions. It provides concrete configuration and explains where the adapter needs custom code.
Its strongest practical detail is the distinction between generating an answer grounded in web search and retrieving the supporting source records. It provides a starting pattern for both, while leaving production integration and runtime compatibility unassessed.
users
The intended audience is developers building TypeScript AI applications, particularly Next.js and React apps already using the Vercel AI SDK. Readers need enough JavaScript knowledge to understand asynchronous calls, environment variables and JSON request bodies.
Beginners receive installation commands and short examples. A complete chat application would require additional work: the page mentions Route Handlers and useChat without supplying a complete server route and client interface.
capabilities
The documented integration supports text generation with generateText and token-by-token output with streamText. For Next.js interfaces, the page describes returning toUIMessageStreamResponse() and rendering messages with useChat.
A custom fetch hook can enable the built-in web_search tool. Alternatively, effort settings of fast, low, medium, high or xhigh bundle a model, tools and a tuned system prompt; the page says these settings already include web search.
The guide describes access to Agent API models from several providers through one Perplexity key. It describes xhigh as supporting agentic work with sandboxed code execution, but supplies no worked code-execution example.
Using it
requirements
The examples require the ai and @ai-sdk/open-responses packages, a Perplexity API key and a server environment that can access PERPLEXITY_API_KEY. The page links key creation at [https://console.perplexity.ai/project/keys].
The provider must be created on the server so the key does not reach the browser. Suggested locations include a Next.js Route Handler, Server Action or API route. Supported package versions, runtime versions, account eligibility and rate limits are not specified.
mechanism
createOpenResponses configures an adapter named perplexity with the endpoint [https://api.perplexity.ai/v1/responses] and the server-side API key. Calling that adapter with a model identifier produces the model object passed to AI SDK functions.
For web search, the custom fetch hook parses the outgoing JSON body, assigns tools to an array containing web_search and forwards the modified request. For non-streaming responses, it clones the response and extracts results from search_results items in the output array, leaving the original response available to the adapter.
The page states that the adapter leaves result.sources empty. Supporting sources therefore require separate handling even when the generated answer used web search.
setup
Install ai and @ai-sdk/open-responses with npm or pnpm, make the API key available as PERPLEXITY_API_KEY, and configure createOpenResponses with Perplexity's responses endpoint. The basic example then calls generateText with a model identifier and prompt.
To add web search, extend the provider's fetch hook with the tools field. To use an effort setting, the page instead assigns body.effort in that hook because the effort configuration already includes web search. The examples do not specify dependency versions or provide deployment configuration.
example
The basic example asks openai/gpt-5.6-sol to explain supervised and unsupervised learning, then prints the generated text. The web-search example asks about recent fusion-energy breakthroughs and separately prints the titles and URLs extracted from search_results.
The streaming example reads result.textStream and writes each chunk to standard output. Other illustrated model identifiers are google/gemini-4-hydrogen and xai/grok-4.5. These are identifiers shown in the page; their live availability is unverified, and the page supplies no actual response output.
Assessment & evidence
limitations
Built-in tools are not exposed as first-class options by this adapter, and supporting sources do not appear in result.sources. The source-extraction example deliberately skips streaming responses because their bodies are event streams rather than ordinary JSON; it provides no streaming-source extraction implementation.
The snippets do not demonstrate retries, API-error handling, cancellation or recovery from unexpected response shapes. No code was executed, and compatibility, answer accuracy, citation usefulness, latency and reliability remain unassessed.
reasoning
The integration offers a useful tradeoff for existing AI SDK applications: generation and streaming retain their familiar interface, while Perplexity-specific tools and source records require custom request and response handling.
A concern inferred from the example is its mutable sources variable. If copied into a shared server module, concurrent calls could overwrite that shared state. Source records should be associated with each request before adopting that pattern in a multi-user application; no concurrency failure was observed.
alternatives
Calling the documented Agent API endpoint directly is a possible architectural alternative when an application needs control over request fields and raw responses. This is an inference from the documented HTTP integration; comparative effort and feature parity are not established.
The page points to the Agent API quickstart [https://docs.perplexity.ai/docs/agent-api/quickstart.md] and Open Responses provider documentation [https://ai-sdk.dev/providers/ai-sdk-providers/open-responses]. Those linked pages were not supplied, so they support no further comparison here.
evidence
The evidence consists of the complete supplied Perplexity documentation page at [https://docs.perplexity.ai/docs/getting-started/integrations/vercel-ai-sdk.md], preserved as selected-page.txt and captured at 2026-11-24T11:41:12.049Z.
The supplied source revision is sha256:6d4a8b0e956ecea7e3c8c66a0f4c0f9de17be2910e1bf34e086f470a0c8924f9. This identifies the document snapshot, not a package or API version. The evidence contains instructional examples without execution receipts, measured results or independent corroboration.
Access & freshness
costs
Costs are unknown. The page supplies no numeric prices, free allowance, subscription requirements or spending examples. It links to model and pricing information at [https://docs.perplexity.ai/docs/agent-api/models.md], whose contents are outside the supplied evidence.
Whether web search or effort settings affect charges is not established. Application-hosting costs are also unspecified.
rights
The supplied page contains no explicit license or redistribution grant for its text or code examples. Package licenses, API usage terms and rights concerning generated output or third-party search material are not established by this evidence.
Data retention and other service data-handling terms are also unspecified.
freshness
The snapshot was captured on 24 November 2026. The page provides no publication date, last-update date or pinned package versions, so the capture date does not establish when the examples last worked.
Model identifiers, adapter behavior and response formats need confirmation before adoption. The supplied evidence does not establish their current operational status.
actions
Confirm compatible package versions, an available Agent API model and current pricing and terms. Keep the key on the server and begin with the basic generateText configuration before adding web search or an effort setting.
If users need supporting links, implement request-scoped source storage and verify that each answer receives its own search_results records. Plan separate source handling for streaming, since the page's extraction example covers non-streaming responses only. Check errors and actual API behavior before wider deployment.
