Perplexity
Perplexity

Sonar

perplexity/sonar

Lightweight offering with search grounding, quicker and cheaper than Sonar Pro

Context Window

127,000

Max Output Tokens

8,000

Using Sonar with Python API

Using Sonar with OpenAI compatible API

import openai

client = openai.Client(
  api_key= '{your_api_key}',
  base_url="https://api.model.box/v1",
)
response = client.chat.completions.create(
model="perplexity/sonar",
messages: [
  {
    role: 'user',
    content:
      'introduce your self',
    },
  ]
)
print(response)