feat: add Perplexity as a cloud model provider#8103
Conversation
Mirrors the existing OpenRouter integration so Perplexity is available as a first-party predefined provider — base URL, API-key setting, logo, provider title, and a docs page. Closes janhq#4115
There was a problem hiding this comment.
PR Review: feat: add Perplexity as a cloud model provider
Thanks for this contribution, @james-pplx! The structure is clean and follows existing provider patterns well. I found a few issues that need attention before this can be merged.
Critical: base_url missing /v1 suffix
The PR sets base_url: 'https://api.perplexity.ai', but every other provider in the codebase uses a base URL that includes the version path (e.g., https://api.openai.com/v1, https://api.mistral.ai/v1, etc.).
The codebase appends /models and /chat/completions directly to base_url, so with the current value:
- Model fetching would hit
https://api.perplexity.ai/modelsinstead ofhttps://api.perplexity.ai/v1/models - Chat completions would hit
https://api.perplexity.ai/chat/completionsinstead ofhttps://api.perplexity.ai/v1/chat/completions
Fix: Change to 'https://api.perplexity.ai/v1' in base_url, the placeholder, and the value field of the base-url setting.
Verify /v1/models endpoint exists
The PR changes models from a hardcoded list to true, which triggers dynamic model fetching via the provider's /models endpoint. Does Perplexity expose a standard OpenAI-compatible /v1/models endpoint? If not, the dynamic model fetching will fail for all users and the PR should keep the hardcoded model list (['sonar', 'sonar-pro', 'sonar-reasoning-pro']).
Capability detection won't work with boolean values
Changing supportsToolCalls from ['sonar', 'sonar-pro', 'sonar-reasoning-pro'] to true means getModelCapabilities() in lib/models.ts will not detect tool-call support for any Perplexity model, because it checks Array.isArray(supportsToolCalls) which returns false for booleans. The same applies to the OpenRouter entry (existing issue), but this PR extends the pattern.
If you keep a hardcoded model list, you can also keep the per-model capability arrays. If you switch to dynamic fetching, consider also updating getModelCapabilities() to handle boolean values (i.e., true = all models support the capability).
Minor: duplicate heading in docs
perplexity.mdx has ## Integrate Perplexity with Jan on both line 26 and line 34. One should be removed.
Minor: SVG logo
The included SVG appears to be a hand-drawn geometric shape rather than the official Perplexity logo. Consider replacing with the actual brand mark.
Recommendation: fix needed (base_url is critical; model fetching needs verification)
Review: feat: add Perplexity as a cloud model providerSummary: Registers Perplexity as a first-class predefined cloud provider in Jan, mirroring the existing OpenRouter pattern. Adds provider config, logo, utility wiring, and a docs page. Positive observations
Issues and observations
Recommendation: fix needed |
|
Friendly ping on this provider PR. The base_url was kept as |
- Replace placeholder hexagon SVG with official Perplexity logo mark - Remove duplicate '## Integrate Perplexity with Jan' heading in docs - Change supportsImages from false to [] for type-safe consistency with other providers - Update explore_models_url and doc links from /docs/agent/models to /models/model-cards (previous URL returns 404) - Add tests for Perplexity predefined provider and providerModels config shape
|
Addressed review feedback in 52911a3:
Tests could not be run locally due to disk constraints in the build environment, but the test file follows the same vitest pattern as the existing |
|
Re-verified all flagged review comments — already addressed in current HEAD tokamak-pm[bot] comment (#issuecomment-4357390559) — all 5 issues stale:
tokamak-pm[bot] review (#issuecomment-4201984541) — addressed or intentional:
|
|
Follow-up review (new activity detected) Since our last review (2026-05-01), there have been two new commits and significant discussion: New commits
Review of new changesAll 5 issues from our initial review are resolved:
New commit (
Recommendation: improve needed |
Review update (2026-06-06)Re-reviewing the full PR (3 commits: Status of previously raised issuesAll five items from the initial review have been addressed in
Remaining concerns1. The PR changes This is a functional bug. Two options:
2. The PR sets
The codebase appends 3. Merge conflicts The PR currently has merge conflicts ( 4. The PR carries a 5. Header ordering in In the new commit 6. The PR adds Summary
Recommendation: fix needed The |
Summary
Adds Perplexity as a predefined cloud model provider, mirroring the existing OpenRouter integration so Jan ships parity with the other first-party remote providers (OpenAI, Anthropic, OpenRouter, Mistral, Groq, xAI, Gemini, Hugging Face, NVIDIA NIM, MiniMax, Azure).
Closes #4115.
Perplexity exposes an OpenAI-compatible Agent API (
/v1/responses, alias of/v1/agent) and chat completions endpoint (/v1/chat/completions) athttps://api.perplexity.ai, so it slots into Jan's existing OpenAI-compatible client without any new transport code.Files changed
web-app/src/constants/providers.ts— registerperplexityinpredefinedProviders(base URL, API-key + base-URL settings, explore-models URL).web-app/src/constants/models.ts— switch the existingperplexityentry inproviderModelsfrom a fixed model list tomodels: trueso users aren't capped to a hardcoded list (matches the OpenRouter /openai-compatiblepattern). Drops Sonar-specific IDs from the file.web-app/src/lib/utils.ts— wireperplexityintogetProviderLogoandgetProviderTitle.web-app/public/images/model-provider/perplexity.svg— provider logo.docs/src/pages/docs/desktop/remote-models/perplexity.mdx— new docs page (mirrors the OpenRouter docs structure).docs/src/pages/docs/desktop/remote-models/_meta.json— register the new docs page.Configuration
perplexityhttps://api.perplexity.aiAuthorization: Bearer <PERPLEXITY_API_KEY>(standard, no extra plumbing needed)Test plan
yarn lint— passes (only the same 4 pre-existingreact-refresh/only-export-componentswarnings as ondev).tsc --noEmitonweb-app— passes.vitest runon the touched test files — all 122 tests pass; previously-emitted "Duplicate key 'perplexity'" esbuild warning is gone.