Discussions

Ask a Question
Back to All

trying the sonar model?

is it correct that the sonar-online models should return some type of web references where the data was found, similar to the web experience? that seems to be the main differentiator of the service here.

I tried it and don't see anything. I don't see any params that flag it on/off in the docs

https://docs.perplexity.ai/reference/post_chat_completions

also: for just trying a single request using an -online model, does it cost the flat $5?

curl --request POST \
     --url https://api.perplexity.ai/chat/completions \
     --header 'accept: application/json' \
     --header 'authorization: Bearer [REDACTED]' \
     --header 'content-type: application/json' \
     --data '
{
  "model": "sonar-medium-online",
  "messages": [
    {
      "role": "system",
      "content": "Be precise and concise."
    },
    {
      "role": "user",
      "content": "How do you feel about blue vs black denim jackets?"
    }
  ]
}
'


{
  "id": "xxx",
  "model": "sonar-medium-online",
  "created": 1715014111,
  "usage": {
    "prompt_tokens": 48,
    "completion_tokens": 219,
    "total_tokens": 267
  },
  "object": "chat.completion",
  "choices": [
    {
      "index": 0,
      "finish_reason": "stop",
      "message": {
        "role": "assistant",
        "content": "Blue and black denim jackets both have their merits and can be suitable for different outfits and occasions. Blue denim jackets often provide a more classic, timeless look and can be easily paired with various colors, especially darker shades. They are versatile and can be dressed up or down, making them a popular choice for many.\n\nBlack denim jackets, on the other hand, offer a sleeker, more modern appearance and can be paired with lighter colors to create contrast. They can be particularly useful for dressing up outfits, such as pairing them with dresses for a more formal look. However, some might find that black denim jackets can be less versatile than blue ones, as they might not pair as well with other dark colors.\n\nUltimately, the choice between blue and black denim jackets depends on personal preference and the existing wardrobe. Both colors have their advantages and can be stylish options for different outfits and situations."
      },
      "delta": {
        "role": "assistant",
        "content": ""
      }
    }
  ]
}