YepAPI
AI Models

Sonar

Perplexity's fast search-augmented model. Grounded answers with citations at a budget-friendly price. Great for high-volume research tasks.

POST/v1/ai/chat
$0.01/call

Overview

Perplexity's fast search-augmented model. Grounded answers with citations at a budget-friendly price. Great for high-volume research tasks.

PropertyValue
Model IDperplexity/sonar
Context Window200,000 tokens
Max Output8,192 tokens
Input Price$1.00 / 1M tokens
Output Price$1.00 / 1M tokens

Usage

const res = await fetch('https://api.yepapi.com/v1/ai/chat', {
  method: 'POST',
  headers: {
    'x-api-key': 'YOUR_API_KEY',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    model: 'perplexity/sonar',
    messages: [{ role: 'user', content: 'What is the current market cap of the top 5 AI companies?' }],
  }),
});
const { data } = await res.json();
console.log(data.message.content);
curl -X POST https://api.yepapi.com/v1/ai/chat \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "perplexity/sonar", "messages": [{"role": "user", "content": "What is the current market cap of the top 5 AI companies?"}]}'

Request Body

ParameterTypeRequiredDescriptionDefault
modelstringYesModel ID (e.g. perplexity/sonar)
messagesMessage[]YesArray of { role, content } objects
maxTokensnumberNoMaximum tokens in the responseModel default
temperaturenumberNoSampling temperature (0.0–2.0)1.0
topPnumberNoNucleus sampling threshold1.0
frequencyPenaltynumberNoPenalize repeated tokens0
presencePenaltynumberNoPenalize tokens already present0
streambooleanNoEnable SSE streamingfalse
Info

All AI models use the /v1/ai/chat endpoint. Specify the model with the model field.

Response

{
  "ok": true,
  "data": {
    "model": "perplexity/sonar",
    "message": {
      "role": "assistant",
      "content": "As of early 2025, the top AI companies by market cap are: Apple (~$3.4T), Microsoft (~$3.1T), NVIDIA (~$2.9T), Alphabet (~$2.1T), and Amazon (~$2.0T) [1][2]."
    },
    "usage": {
      "promptTokens": 19,
      "completionTokens": 118,
      "totalTokens": 137
    }
  }
}

Streaming

Set "stream": true to receive Server-Sent Events. Each chunk contains a delta object:

data: {"delta":{"content":"As"},"model":"perplexity/sonar","index":0}
data: [DONE]
Under the Hood

We handle auth, billing, and response normalization — you just send messages.

On this page