Back Home

GitHub Repo

Vercel Perplexity SDK 5.0.0 switches to the Agent API; search and streaming integrations must migrate

The new version moves language generation to the Agent API and changes model configuration, streaming events, and usage data formats. Existing PDF inputs and image and video results are no longer supported, while official sources still disagree about the Sonar deprecation timeline.

GitLab, Inc. · MIT · Image source
zh-Hant

On September 26, Vercel released `@ai-sdk/perplexity` 5.0.0, switching language generation from Sonar Chat Completions to the Perplexity Agent API and classifying the update as a breaking change. Existing Sonar model IDs and provider options must be replaced with the new interface’s default configuration, model, and tool settings. Request, response, and usage data formats have also changed. [Release notes](https://github.com/vercel/ai/releases/tag/%40ai-sdk/perplexity%405.0.0)

The main technical difference is that a single request can now include multiple tool-execution steps. At the underlying API level, `messages` has been replaced by `input`, and the returned content has changed from `choices` to a typed `output` array containing the answer, search results, and other execution steps. This lets applications inspect intermediate steps, and means code that parses raw responses directly will need to be updated. [Official interface comparison](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview)

Search settings must also be migrated. The official guide says that freshness and domain-filtering parameters now go inside the `filters` object of the `web_search` tool. When specifying a model directly, you must also add a search tool. Raw streams are now handled by event type, with separate events for text deltas, tool calls, and reasoning. These are changes to the underlying protocol; applications using the SDK’s unified interface should still check any provider metadata they access directly. [Migration guide](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/how-to)

The package update also improves streaming integrity: it recovers missing text from the completion event, avoids repeating deltas already received, and preserves citation annotations and search-result IDs while emitting each source URL only once. However, the release notes explicitly state that the new interface does not support existing Sonar PDF inputs or image and video results, so products that use these features will need to handle them separately. [Version changes](https://github.com/vercel/ai/releases/tag/%40ai-sdk/perplexity%405.0.0)

The deprecation timeline remains unclear because official sources conflict. Perplexity’s August announcement set September 27 as the retirement date for Sonar endpoints, but the migration overview reviewed here still says Sonar remains supported. The announcement alone therefore does not establish that the old endpoints have been fully shut down. [Original announcement](https://community.perplexity.ai/t/sonar-is-moving-to-the-agent-api/5802), [current documentation](https://docs.perplexity.ai/docs/agent-api/migrate-from-sonar/overview)

Based on these changes, upgrade validation should cover complete answers, citation mapping, search constraints, and cost records, and should test incomplete responses and multiple kinds of tool events. For example, if a citation component maps sources by their positions in the old array, or a billing system reads only the old cost fields, seeing text in the interface does not mean the migration is complete. Engineering teams should next confirm whether official guidance on the support timeline has been unified, and whether the package can preserve the original search quality and traceability under real workloads.

Sources

  1. Release @ai-sdk/[email protected]
  2. Migrate from Sonar to the Agent API
  3. How to migrate from Sonar
  4. Sonar is moving to the Agent API