Skip to content

docs(providers): add Perplexity (Agent API + Search API)#24976

Open
jliounis wants to merge 5 commits into
anomalyco:devfrom
jliounis:docs-add-perplexity-provider
Open

docs(providers): add Perplexity (Agent API + Search API)#24976
jliounis wants to merge 5 commits into
anomalyco:devfrom
jliounis:docs-add-perplexity-provider

Conversation

@jliounis
Copy link
Copy Markdown

@jliounis jliounis commented Apr 29, 2026

Issue for this PR

Closes #

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Adds a ### Perplexity section to packages/web/src/content/docs/providers.mdx (between ### OpenRouter and ### LLM Gateway) so opencode users can wire up Perplexity without reverse-engineering it.

It documents two integration paths:

  1. Agent API — Perplexity's Agent API is OpenAI Responses-compatible (/v1/responses aliases /v1/agent), so the example uses @ai-sdk/openai. This matches the guidance already in opencode's "Custom provider" section ("If your provider/model uses /v1/responses, use @ai-sdk/openai"). The opencode.json snippet is shaped exactly like the surrounding custom-provider examples (llama.cpp / LM Studio): provider id, npm, name, options.baseURL, options.apiKey via {env:PERPLEXITY_API_KEY}, and a models map. The example lists routed third-party models (openai/gpt-5.4, anthropic/claude-sonnet-4-6) to demonstrate the Agent API's main differentiator — multi-provider routing. The full model list is linked.
  2. Search API — shown two ways:
    • Direct HTTP via curl against https://api.perplexity.ai/search for scripts and one-off calls.
    • Via MCP using the official Perplexity MCP server (@perplexity-ai/mcp-server) configured as a type: "local" stdio MCP in opencode. The schema (type, command, environment) matches packages/web/src/content/docs/mcp-servers.mdx exactly.

Why it works:

  • The @ai-sdk/openai package handles /v1/responses providers and is already the recommended package for that case in this same docs file, so no AI SDK / opencode code changes are needed.
  • The mcp.<id> block uses the documented local-stdio schema; nothing is invented.
  • The MCP command (npx -y @perplexity-ai/mcp-server) is the canonical install command from the official MCP server README.
  • All external links resolve to canonical Perplexity docs pages (Agent API quickstart / models / OpenAI compatibility / presets / reference; Search API quickstart / reference; API key dashboard) or the official MCP server repository.

This is documentation-only — no runtime code, schema, or build pipeline is touched.

How did you verify your code works?

  • bun run lint from the repo root — 0 errors (pre-existing warnings only, none in providers.mdx).
  • bun --cwd packages/web run build — Astro build completes successfully; the new section renders correctly in dist/docs/providers/index.html with anchor #perplexity, every link intact, and zero Sonar references in the output.
  • Manually inspected the rendered HTML to confirm heading levels, code fences, and link anchors match the surrounding OpenRouter / LLM Gateway sections.
  • The 148 errors astro check reports on .tsx / .astro files are pre-existing on dev (confirmed by stashing this change and re-running) and unrelated to this PR.

Screenshots / recordings

N/A — text-only docs change. The new section renders in the existing providers page layout with no UI changes.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Note: only the English packages/web/src/content/docs/providers.mdx is updated. Locale translations under packages/web/src/content/docs/<locale>/providers.mdx should be regenerated by maintainers using the project's translation workflow.

@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Apr 29, 2026
- Replace fabricated remote MCP URL with the official @perplexity-ai/mcp-server
  npm package run via stdio (matches https://github.com/perplexityai/modelcontextprotocol)
- Replace Sonar model entries in the Agent API example with routed third-party
  models (openai/gpt-5.4, anthropic/claude-sonnet-4-6) so the example reflects
  the Agent API's third-party routing capability
@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Apr 29, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@jliounis
Copy link
Copy Markdown
Author

jliounis commented May 5, 2026

Closing in favor of a more complete PR that combines these provider docs with code support for Perplexity as a websearch backend (parallel to Exa, configurable via websearch.provider). Will link the new PR here once it's up.

Net effect for reviewers: same docs content + new TypeScript module + config plumbing, in one PR instead of two.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant