واجهة برمجة النموذج perplexity/sonar لدى OpenRouter, $1 / $1 لكل مليون رمز, سياق 127,072 رمز. أمثلة بـ curl وPython وJavaScript، واختبار مباشر.
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...
- النوع
- نموذج
- المزوّد
- OpenRouter
- معرّف النموذج
perplexity/sonar- التسعير
- مدفوع
- سعر الإدخال / الإخراج
- $1 / $1 لكل مليون رمز
- الوصول دون مفتاح
- لا
- متغيّر المفتاح
OPENROUTER_API_KEY- عنوان URL الأساسي (متوافق مع OpenAI)
https://openrouter.ai/api/v1- السياق
- 127,072 رمز
- المدخلات
- نص, صورة
- الميزات
- البحث على الويب
- تقييم المطوّرين
- لم يُقيَّم بعد
- التوثيق
- https://openrouter.ai/perplexity/sonar
أمثلة برمجية
cURL
curl https://openrouter.ai/api/v1/chat/completions \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $OPENROUTER_API_KEY" \
-d '{"model":"perplexity/sonar","messages":[{"role":"user","content":"مرحبًا، عرّف بنفسك في جملة واحدة."}]}'Python
# pip install openai
import os
from openai import OpenAI
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"])
r = client.chat.completions.create(
model="perplexity/sonar",
messages=[{"role": "user", "content": "مرحبًا، عرّف بنفسك في جملة واحدة."}],
)
print(r.choices[0].message.content)JavaScript
// npm install openai
import OpenAI from 'openai'
const client = new OpenAI({ baseURL: 'https://openrouter.ai/api/v1', apiKey: process.env.OPENROUTER_API_KEY })
const r = await client.chat.completions.create({
model: 'perplexity/sonar',
messages: [{ role: 'user', content: 'مرحبًا، عرّف بنفسك في جملة واحدة.' }],
})
console.log(r.choices[0].message.content)
عمليات بحث شائعة
الأسئلة الشائعة
هل واجهة Perplexity: Sonar مجانية؟
لا: Perplexity: Sonar واجهة مدفوعة ($1 / $1 لكل مليون رمز).
كيف أستدعي Perplexity: Sonar من شيفرتي؟
يوفّر Perplexity: Sonar واجهة متوافقة مع OpenAI على العنوان https://openrouter.ai/api/v1: استخدم أي مكتبة OpenAI (Python أو JavaScript…) مع عنوان URL الأساسي هذا. معرّف النموذج: perplexity/sonar. تتوفّر شيفرة جاهزة (بث، JSON، إعادة محاولة) في صندوق أدوات المطوّر.
ما حجم نافذة السياق في Perplexity: Sonar؟
يقبل Perplexity: Sonar حتى 127,072 رمز من السياق (الرسالة والسجل).
ما بدائل Perplexity: Sonar؟
واجهات مشابهة في الفهرس: Perplexity: Sonar Pro Search, Perplexity: Sonar Reasoning Pro, Perplexity: Sonar Pro, Perplexity: Sonar Deep Research, Perplexity · sonar.
بدائل
- Perplexity: Sonar Pro Search — مدفوع
- Perplexity: Sonar Reasoning Pro — مدفوع
- Perplexity: Sonar Pro — مدفوع
- Perplexity: Sonar Deep Research — مدفوع
- Perplexity · sonar — السعر غير مُعلن