Skip to content

Cannot use Perplexity Sonar Api #826

@siimaus

Description

@siimaus

It looks like plano always adds /v1 to base url which makes inpossible to use api-s which otherwise serve openAI compatible interface on paths without /v1 in path..

curl https://api.perplexity.ai/chat/completions \
  -H "Authorization: Bearer $PERPLEXITY_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"model": "sonar-pro", "messages": [{"role": "user", "content": "Hello"}]}' -i

works but trying to use it via plano,

url to perplexity is translated to

https://api.perplexity.ai/v1/chat/completions

which gets error 404

When trying to use plano endpoint without v1 in path also gives 404 but from plano envoy I suspect, not finding anything on
http://localhost:12000/chat/completions

model_providers is configured as

model_providers:
  - model: perplexity/sonar-pro
    base_url: https://api.perplexity.ai  # Root, not /v1/sonar
    provider_interface: openai
    access_key: $PERPLEXITY_API_KEY

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions