> ## Documentation Index
> Fetch the complete documentation index at: https://docs.perplexity.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Perplexity API Cookbook

> Practical guides, runnable examples, and integration patterns for building with every Perplexity API

A collection of practical guides, runnable examples, and integration patterns for building with [**Perplexity's API Platform**](https://docs.perplexity.ai/) — covering the Agent API, Search API, Embeddings API, and Sonar API.

## How to Use This Cookbook

<CardGroup cols={2}>
  <Card title="Guides" icon="book" href="/docs/cookbook/articles/function-calling-e2e/README">
    Practical deep-dives on patterns that go beyond the docs — structured outputs, function calling, RAG pipelines, and cross-cutting best practices.
  </Card>

  <Card title="Examples" icon="code-circle" href="/docs/cookbook/examples/README">
    Runnable projects covering every API. From research assistants and news monitors to document Q\&A and image analysis — with Python and TypeScript.
  </Card>

  <Card title="Integration Guides" icon="link" href="/docs/cookbook/articles/openai-agents-integration/README">
    Connect Perplexity with external frameworks like the OpenAI Agents SDK, LangChain memory systems, and persistent storage.
  </Card>

  <Card title="Community Showcase" icon="sparkles" href="/docs/cookbook/showcase/briefo">
    Real-world applications built by the community — see what others are building with the API Platform.
  </Card>
</CardGroup>

## Quick Start

<Steps>
  <Step title="Get API Access">
    To use the Perplexity API Platform, you'll need an API key. If you don't have one yet:

    <Card title="Get your Perplexity API Key" icon="key" arrow="True" horizontal="True" iconType="solid" cta="Click here" href="https://perplexity.ai/account/api">
      Navigate to the **API Keys** tab in the API Portal and generate a new key.
    </Card>
  </Step>

  <Step title="Install the SDK">
    The Perplexity API SDK is available in Python and TypeScript. Install the package for your preferred language:

    <CodeGroup>
      ```bash Python theme={null}
      pip install perplexityai
      ```

      ```bash TypeScript theme={null}
      npm install @perplexity-ai/perplexity_ai
      ```
    </CodeGroup>
  </Step>

  <Step title="Pick a Starting Point">
    The Perplexity API Platform supports a wide range of use cases across its different APIs. Here are some recommended starting points based on your goals:

    * New to the platform? Refer to our <u>[Quick Start Guide](/docs/getting-started/quickstart)</u>
    * Want to build something? Take a look at our <u>[Examples](/docs/cookbook/examples/README)</u>
  </Step>
</Steps>

## What's Covered

| API                | Guides                                                                                                                                                                                                                                                                 | Examples                                                                                                                                                                                                                                                                                                                                                              |
| ------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Agent API**      | [Multi-Provider Orchestration](/docs/cookbook/articles/multi-provider-orchestration/README), [Function Calling End-to-End](/docs/cookbook/articles/function-calling-e2e/README), [OpenAI Agents Integration](/docs/cookbook/articles/openai-agents-integration/README) | [Research Assistant](/docs/cookbook/examples/agent-research-assistant/README), [Model Comparison](/docs/cookbook/examples/model-comparison/README), [TypeScript CLI](/docs/cookbook/examples/typescript-agent-cli/README), [Image Analysis](/docs/cookbook/examples/image-analysis/README), [File Attachment Q\&A](/docs/cookbook/examples/file-attachment-qa/README) |
| **Search API**     | [Search Domain Filtering](/docs/cookbook/articles/search-domain-filtering/README)                                                                                                                                                                                      | [News Monitor](/docs/cookbook/examples/search-news-monitor/README), [SEC Filing Search](/docs/cookbook/examples/sec-filing-search/README)                                                                                                                                                                                                                             |
| **Embeddings API** | [RAG Pipeline](/docs/cookbook/articles/embeddings-rag/README)                                                                                                                                                                                                          | [Document Q\&A](/docs/cookbook/examples/document-qa/README)                                                                                                                                                                                                                                                                                                           |
| **Sonar API**      | [Streaming Citations](/docs/cookbook/articles/streaming-citations/README), [Academic Search](/docs/cookbook/articles/academic-search/README), [Async Deep Research](/docs/cookbook/articles/async-deep-research/README)                                                | —                                                                                                                                                                                                                                                                                                                                                                     |
