Repository navigation
fix(agent): call Perplexity's Agent API, chat completions now returns 403 - #267
Closed
LeslieCBarry wants to merge 1 commit into
Closed
LeslieCBarry wants to merge 1 commit into
LeslieCBarry wants to merge 1 commit into
Conversation
…nswers 403 Perplexity retired Sonar chat completions on 27 Sep 2026. A key created after that gets 403 "Sonar is now the Agent API" from /chat/completions, so research_person, find_contact_socials and the LinkedIn slug search all fail. ask() now posts to /v1/agent: sonar maps to effort fast, sonar-pro to effort low, the system text to instructions, and a domain list to a web_search tool filter. The answer is read from the message item's output_text and the sources from every search_results item, parsed with zod.
|
@LeslieCBarry is attempting to deploy a commit to the Comp AI - PoC Team on Vercel. A member of the Team first needs to authorize it. |
|
The latest updates on your projects. Learn more about Vercel for GitHub. |
This branch was previously deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
We installed the CRM on Vercel this week and web research never worked. With a new key, every call from
apps/agent/agent/lib/perplexity.tscomes back 403 with "Sonar is now the Agent API. Use /v1/responses instead of /v1/sonar." Perplexity ended Sonar chat completions on 27 September 2026, so any key made after that gets the 403. The capability still shows as on, so the agent keeps trying, andresearch_person,find_contact_socialsand the LinkedIn slug search all come back empty.This moves
ask()toPOST https://api.perplexity.ai/v1/agent.sonarmaps to effortfastandsonar-protolow, the system text goes ininstructions, and a domain list becomes a filter on theweb_searchtool. The answer comes from themessageitem'soutput_textand the sources from everysearch_resultsitem, parsed with zod. Callers don't change.I checked it live with a new key. A question about a company came back with 20 sources, a
sonar-proquestion with 30, and the LinkedIn search found the right profile.apps/agent/test/perplexity.spec.tscovers the request and response mapping, and check-types, lint, lint:slop and test pass.bun run auditfails on main until #266 lands.