Perplexity

Configure Perplexity, Agno's model class for Perplexity's language models.

The Perplexity model provides access to Perplexity's language models.

Parameters

ParameterTypeDefaultDescription
idstr"sonar"The ID of the Perplexity model to use
namestr"Perplexity"The name of the model
providerstr"Perplexity"The provider of the model
api_keyOptional[str]NoneThe API key for Perplexity (defaults to PERPLEXITY_API_KEY env var)
base_urlstr"https://api.perplexity.ai/"The base URL for the Perplexity API
max_tokensint1024Maximum number of tokens to generate
top_kOptional[float]NoneDeclared but sent under an unsupported OpenAI SDK keyword. Leave None and use the request-body workaround below.
collect_metrics_on_completionboolTrueCollect token metrics only from the final streaming chunk (for providers with cumulative token counts)
supports_native_structured_outputsboolFalseWhether the model supports native structured outputs
supports_json_schema_outputsboolTrueWhether the model requires a JSON schema for structured outputs

Perplexity extends OpenAILike and inherits its constructor parameters. This adapter forwards a limited set of request fields; inherited extra_body, seed, and reasoning_effort are currently omitted. Pass supported provider-specific JSON through request_params={"extra_body": {...}}. For example, Perplexity(request_params={"extra_body": {"top_k": 2}}) sends top_k in the request body while leaving the incompatible direct field unset.