aisdk/perplexity

Official Perplexity provider for the PHP AI SDK.

Maintainers

Package info

github.com/phpaisdk/perplexity

pkg:composer/aisdk/perplexity

Transparency log

Fund package maintenance!

Open Collective

Statistics

Installs: 0

Dependents: 0

Suggesters: 0

Stars: 0

Open Issues: 0

v0.8.0 2026-07-15 12:07 UTC

This package is auto-updated.

Last update: 2026-07-17 02:24:56 UTC


README

GitHub Workflow Status Total Downloads Latest Version License Why PHP in 2026

Official Perplexity provider for the PHP AI SDK. Uses Perplexity's Chat Completions API.

Installation

composer require aisdk/perplexity

Basic Usage

use AiSdk\Generate;
use AiSdk\Perplexity;

$result = Generate::text('What happened in technology today?')
    ->model(Perplexity::model('sonar-pro'))
    ->run();

echo $result->text;

Configuration

Variable Description Default
PERPLEXITY_API_KEY API key for authentication Required
PERPLEXITY_BASE_URL Base URL for API requests https://api.perplexity.ai

Supported Capabilities

Capability Support
Text generation Native
Streaming Native
Tool calling Native
Structured output Adapted (json_object with an explicit JSON instruction)
Text input Native

Provider-specific fields can be passed through providerOptions('perplexity', [...]). Model IDs are opaque strings and Perplexity remains the authority on model availability.

Testing

composer test:all

Documentation

Community