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...
from openai import OpenAI
client = OpenAI(
base_url="https://infergate.ru/api/v1",
api_key="ig-•••",
)
resp = client.chat.completions.create(
model="perplexity/sonar",
messages=[{"role": "user", "content": "Привет!"}],
)
print(resp.choices[0].message.content)modelstringобязательныйmessagesarrayобязательныйtemperaturenumbermax_tokensintegertop_pnumbertop_kintegerfrequency_penaltynumberpresence_penaltynumberweb_search_optionsobject