LLM access to pplx-api 3 by Perplexity Labs
Install this plugin in the same environment as LLM.
llm install llm-perplexity
First, set an API key for Perplexity AI:
llm keys set perplexity
# Paste key here
Run llm models
to list the models, and llm models --options
to include a list of their options.
Run prompts like this:
llm -m sonar-pro 'Fun facts about pelicans'
llm -m sonar 'Fun facts about walruses'
You can also access these models through OpenRouter. First install the OpenRouter plugin:
llm install llm-openrouter
Then set your OpenRouter API key:
llm keys set openrouter
Use the --option use_openrouter true
flag to route requests through OpenRouter:
llm -m sonar-small --option use_openrouter true 'Fun facts about pelicans'
To set up this plugin locally, first checkout the code. Then create a new virtual environment:
cd llm-perplexity
python3 -m venv venv
source venv/bin/activate
Now install the dependencies and test dependencies:
llm install -e '.[test]'
This plugin was made after the llm-claude-3 plugin by Simon Willison.