knbknb / perplexity-api-search

Scripts to send a prompt to 5-10 ai systems (LLMs) at once

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Querying the Perplexity Web-APIs

... with a simple Python script.

In a Linux terminal, send your human-language query to Perplexity.ai's various LLM API endpoint paths.

A spare-time project to explore the Perplexity.ai API. This is a work in progress.

The goals are

  • Make it easy to query the Perplexity.ai Web-API endpoints from the command line, and to compare the results of ~10 different models available. This means saving the API responses into a textfile, then reading and inspecting them. I'm not systematically benchmarking the models.
  • Demonstrate how to use a Postman collection .json-file (and Postman environment .json-file) from the command line (with the Newman CLI tool), thus exerting very fine-grained control over the API calls, and conserving the responses with lots of metadata (e.g., runtime duration).

API Key required

Running the script requires an API key, available only to "Perplexity Pro" users. Thus running the script is not free of charge. You need to be a registered customer to use this script. See Perplexity API Pricing for more details.

I think there is a free 5$-per-month plan, which is the cheapest option. If your API usage is low, you might be able to use the API for free.

See

Installation

See INSTALL.md for more details.

Future Work

  • See TODO.md for more details.
  • Make setting the "custom instruction" more flexible, and more interactive.
  • Finish the Python rewrite of this script.

License

Use it as you like.

About

Scripts to send a prompt to 5-10 ai systems (LLMs) at once


Languages

Language:Python 57.9%Language:Shell 42.1%