Skip to content
OpenKey

Sonar

PerplexityReleased Jan 27, 2025

Sonar is lightweight, affordable, fast, and simple to use — now featuring citations and the ability to customize sources. It is designed for companies seeking to integrate lightweight question-and-answer features...

Try in playground
Context window
127K tokens
Input
text, image
Output
text
Tokenizer
Other
Released
Jan 27, 2025

Pricing

Per 1M tokens. The provider price and our flat 3% fee are separate columns — what you pay is their sum.

Per 1M tokensProvider+ 3% feeYou pay
Input$1.00$0.030$1.03
Output$1.00$0.030$1.03

Supported parameters

  • frequency_penalty
  • max_tokens
  • presence_penalty
  • temperature
  • top_k
  • top_p
  • web_search_options

Call it

OpenAI-compatible: point your SDK at api.openkey.ai/v1 and use model perplexity/sonar.

Code sample language
curl https://api.openkey.ai/v1/chat/completions \
  -H "Authorization: Bearer $OPENKEY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "perplexity/sonar",
    "messages": [{"role": "user", "content": "Hello"}]
  }'
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.openkey.ai/v1",
    api_key=os.environ["OPENKEY_API_KEY"],
)

completion = client.chat.completions.create(
    model="perplexity/sonar",
    messages=[{"role": "user", "content": "Hello"}],
)
print(completion.choices[0].message.content)
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://api.openkey.ai/v1",
  apiKey: process.env.OPENKEY_API_KEY,
});

const completion = await client.chat.completions.create({
  model: "perplexity/sonar",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(completion.choices[0].message.content);

Questions

How much does Sonar cost via API?
Through OpenKey, Sonar costs $1.03 per 1M input tokens and $1.03 per 1M output tokens. That is the provider price ($1.00 / $1.00) plus a flat 3% fee — nothing else.
What is Sonar's context window?
Sonar accepts up to 127K tokens of context.
Is Sonar OpenAI-compatible?
Yes. Send requests to OpenKey's /v1/chat/completions endpoint with model "perplexity/sonar" using any OpenAI SDK — only the base URL and API key change.
What inputs does Sonar support?
Sonar accepts text, image input and produces text output.

More from Perplexity

All Perplexity models →