We use cookies. Cookies and browser storage keep you signed in and remember your preferences. With your permission we also measure how the site is used. You can any time. See our cookie policy.

Perplexity: Sonar

perplexity/sonar
TextInput: text · image127KAdded Jan 27, 2025

Try Perplexity: Sonar now

Runs on your balance at the prices above. New accounts start with free usage.

One API. Every model.

5 of 5 free messages left today. A free account adds free usage and an API key.Create free accountSign in

Session cost $0.00

Perplexity: Sonar at a glance

  • Input price is 122% higher than the median of 434 Text models.
  • Context window of 127,072 tokens, enough for long documents and multi-turn conversations.
  • Accepts images as input (vision).
  • A typical request (1,000 input / 500 output tokens) costs about $0.00525.

About Perplexity: Sonar

Perplexity: Sonar is a text model from Perplexity, released on 27 January 2025. Perplexity describes it as lightweight, fast, affordable and simple to use, with citations and the ability to customize sources. It is aimed at companies that want to integrate lightweight question and answer features into their own products rather than build a general purpose assistant from scratch.

The model accepts text and images as input and returns text. It has a context window of 127,072 tokens and a maximum output of 114,364 tokens, so it can hold long inputs and produce long answers in a single call. The combination of image input with text output means it can read a screenshot, diagram or photo alongside a written question and answer in prose. Because the provider description highlights citations and customizable sources, answers can be grounded in sources you choose, which matters when you need to show where an answer came from.

Those traits point to a fairly specific set of uses. Question and answer features inside a product are the obvious fit: support widgets, documentation helpers, internal knowledge lookups and similar flows where a user asks something and expects a short, sourced reply. Image input extends this to cases where the question is about something visual, such as asking about the contents of a screenshot or a photographed document. The large output ceiling suits tasks that need a long written response, such as summarizing several documents or drafting a detailed explanation, while the large context window lets you pass in substantial background material without splitting it up.

You call the model through api14's OpenAI-compatible API using the model id "perplexity/sonar". The supported request parameters are frequency_penalty, max_tokens, presence_penalty, temperature, top_k, top_p and web_search_options. The first six are the usual sampling and length controls, so you can tune how deterministic or varied the output is and cap how many tokens come back. web_search_options is the parameter to reach for when you want the model to draw on web search and is the main lever for the source customization the provider mentions.

There is no information here about rate limits, latency figures or accuracy, so those need testing against your own workload. If your task is pure text generation with no need for citations or source control, a plain text model may be simpler. Sonar makes most sense when grounded, cited answers and optional image input are central to what you are building.

How to call the Perplexity: Sonar API

  1. Create an API key in your dashboard.
  2. Install the official openai SDK for your language.
  3. Set baseURL to https://api14.com/api/v1 and model to "perplexity/sonar".
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api14.com/api/v1",
  apiKey: process.env.API14_API_KEY,
});

const result = await client.chat.completions.create({
  "model": "perplexity/sonar",
  "messages": [
    {
      "role": "user",
      "content": "Explain vector databases in two sentences."
    }
  ]
});
console.log(result.choices[0].message.content);

Supported parameters

frequency_penaltymax_tokenspresence_penaltytemperaturetop_ktop_pweb_search_options

Specifications

Context length
127,072
Max output
114,364
Input
text, image
Output
text

Requests on api14 · last 7 days

10-1710-1810-1910-2010-2110-2210-23

Perplexity: Sonar: frequently asked questions

How much does the Perplexity: Sonar API cost?
Perplexity: Sonar costs Input $3.50 / 1M tokens. It is charged from your USD balance only for successful requests; failed requests are free.
What is the context window of Perplexity: Sonar?
Perplexity: Sonar reads up to 127,072 tokens per request: prompt, history and documents together. It writes up to 114,364 output tokens per response.
What can Perplexity: Sonar do?
Perplexity: Sonar accepts text, image and returns text.
How do I call Perplexity: Sonar from my code?
Point any OpenAI SDK at https://api14.com/api/v1 and set the model to "perplexity/sonar". No other code changes. Copy a ready example from the code panel on this page.
What are alternatives to Perplexity: Sonar?
Comparable Text models at a similar price: Mistral: Mistral Large 3 2512, OpenAI: GPT-4.1 Mini, Nous: Hermes 3 405B Instruct. Each runs through the same API key, so switching is one string.

Perplexity: Sonar community

New topic

This community has no topics yet. Open the first one about Perplexity: Sonar.