Perplexity combines LLM reasoning with real-time web search, producing responses grounded in current information. Their Sonar models are uniquely suited for research-heavy coding tasks.
Get an API Key
- Go to perplexity.ai/settings/api
- Create an account or sign in
- Generate an API key and copy it
Configure VibeCody
Option 1: Environment variable (recommended)
export PERPLEXITY_API_KEY="pplx-..."
vibecli --provider perplexity
Option 2: Config file (~/.vibecli/config.toml)
[perplexity]
enabled = true
api_key = "pplx-..."
model = "sonar-pro"
Model Selection
| Model | Strengths | Best for |
|---|---|---|
sonar-pro |
Deep research, citations | Complex research tasks |
sonar |
Fast search-augmented | Quick lookups |
sonar-reasoning-pro |
Multi-step reasoning with search | Harder questions |
sonar-deep-research |
Long, multi-step research | Reports; can run for minutes |
Default: sonar-pro
Override from the CLI:
vibecli --provider perplexity --model sonar
Agent API
Perplexity ended Sonar Chat Completions support on 2026-09-27 and is moving each
Sonar model onto its Agent API.
VibeCody calls the Agent API directly (POST /v1/agent), so the model names above
keep working unchanged. They map onto Perplexity’s presets as its migration guide
does:
| Model | Agent API preset |
|---|---|
sonar, sonar-pro |
fast |
sonar-reasoning-pro |
low |
sonar-deep-research |
high |
Any model id containing a / — for example anthropic/claude-opus-5-5 or
perplexity/sonar — is sent as the Agent API model, so a typed-in id reaches the
model Perplexity brokers for it. Web search is always requested.
Not yet verified against a live account: the request and response shapes follow Perplexity’s published guide and are covered by unit tests, not by a call to the API. If a Perplexity request fails after upgrading, the error text is returned verbatim.
Best For
- Research-heavy tasks – find current documentation, API references, library versions
- Debugging with context – search for error messages and known issues in real-time
- Technology comparison – evaluate libraries and tools with up-to-date information
- Learning new APIs – get current examples and best practices
Verify Connection
vibecli --provider perplexity -c "What are the latest changes in React 19?"
Troubleshooting
Invalid API key
- Verify the key starts with
pplx- - Check your key at perplexity.ai/settings/api
Slow responses
- Search-augmented models perform web searches before responding
- Expect 3-10 seconds for research-heavy queries;
sonar-deep-researchcan take minutes (requests time out after 300 s)