Tutorials
TutorialsPerplexityAI Search

Building a Perplexity Clone with Keiro API

Build your own AI search engine like Perplexity.

Building a Perplexity Clone with Keiro API

What We Are Building

A Perplexity-style search engine for under ten dollars per month.

Implementation

import requests
import openai

def answer(question):
    results = requests.post(
        "https://keiro.cloud/api/research",
        headers={"Authorization": "Bearer KEIRO_KEY"},
        json={"query": question}
    ).json()
    
    context = "\n".join([r["content"][:500] for r in results["results"]])
    
    return openai.chat.completions.create(
        model="gpt-4",
        messages=[{"role": "user", "content": f"{context}\n\nAnswer: {question}"}]
    ).choices[0].message.content

Cost

Solution Monthly
Perplexity Pro $20
Your Clone Less than $5

Build your clone

✦ ✦ ✦

Filed under

PerplexityAI SearchTutorial
K
About the author
Written by Keiro Team

Building the most cost-effective AI search API. We're on a mission to make web scraping accessible and affordable for every developer.

Try Keiro free
Get started today

Ready to build something?

Join thousands of developers using Keiro to power their AI applications.

Start free trial Read the docs