Sonar
Sonar is Perplexity's lightweight search model. It combines language generation with built-in web search to deliver citation-backed answers at low cost within a context window of 127K tokens.
import { streamText } from 'ai'
const result = streamText({ model: 'perplexity/sonar', prompt: 'Why is the sky blue?'})Frequently Asked Questions
How does Sonar's built-in web search work?
Every API call triggers a live web search. The model formulates search queries from your prompt, retrieves and evaluates web sources, then synthesizes the information into a response with inline citations. You don't need an external search API or RAG pipeline.
What is the difference between Sonar and Sonar Pro?
Sonar Pro searches more sources, produces longer and more detailed answers, and handles more complex multi-source queries. Sonar is optimized for speed and cost on straightforward factual queries.
Does Sonar include citations in its responses?
Yes. Responses include inline citations referencing the web sources used for each claim. This gives your application verifiable provenance.
What is the context window for Sonar?
127K tokens. This supports multi-turn conversations where search context accumulates across exchanges.
How much does Sonar cost?
Current pricing is shown on this page. AI Gateway routes across providers, and rates may vary by provider.
How do I authenticate with Sonar through AI Gateway?
Use your AI Gateway API key with the model identifier `
perplexity/sonar`. AI Gateway handles provider routing and authentication. You don't need a separate Perplexity API key when using gateway-managed access.Can I use Sonar without the web search feature?
No. Web search is integral to the Sonar architecture and runs on every request. If you need a model without search, use a general-purpose language model from another provider.