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.
Overview
Google Antigravity is an agent-first development environment where AI agents plan, write, and iterate on your code across editor, terminal, and browser surfaces. While Antigravity ships with its own built-in agent models, the code your agents author can call any external API — including Perplexity’s Agent API and Search API — for real-time web research, citations, and grounded answers. This guide shows how to add the Perplexity Agent API to a project you’re building inside Antigravity, using the OpenAI Responses‑compatible interface.Scope of this guide. Antigravity does not currently expose a BYOK or custom-provider hook for swapping its built-in agent model with Perplexity. This guide covers the supported path: calling Perplexity from your application code authored inside Antigravity (web apps, CLIs, coding assistants, internal tools, etc.). If Antigravity adds a custom-provider configuration in the future, the same base URL and API key documented here will apply.
Get a Perplexity API Key
Generate an API key in the Perplexity API Console, then store it in your project as
PERPLEXITY_API_KEY.When to Use This
The Agent API is a strong fit when your Antigravity-built project needs grounded, web-aware answers without you having to wire up search, scraping, and citation handling yourself. Common patterns:- AI features in web or mobile apps — drop a research or Q&A surface into a product without standing up your own retrieval stack.
- Coding assistants and dev tools — let agents fetch up-to-date library docs, error explanations, or changelogs at runtime.
- Internal tools and dashboards — answer questions over the live web (market data, competitive moves, news) with sources attached.
- CLIs and scripts — quick research utilities you run from the Antigravity terminal.
Setup
Store Your API Key as an Environment Variable
In the Antigravity terminal (or your project’s Never hardcode the key in source files — Antigravity agents may commit or share code they read, so treating the key as an environment variable keeps it out of the repo.
.env file), set:- macOS / Linux
- Windows (PowerShell)
- .env file
Install an SDK
The Agent API is compatible with the OpenAI Responses API, so the OpenAI SDK works directly. The native Perplexity SDK is also available and provides cleaner preset syntax.
- TypeScript / Node
- Python
Point the Client at Perplexity
Set the base URL to The OpenAI SDK sends
https://api.perplexity.ai/v1 and read the API key from the environment.- TypeScript / Node
- Python
client.responses.create(...) to POST /v1/responses, which Perplexity accepts as an alias for the canonical POST /v1/agent endpoint. No other configuration is required.Using It from Inside Antigravity
Once the client is wired up, you can prompt Antigravity’s agent to use the Perplexity client wherever your app needs grounded answers. A few prompts that work well:- “Add a
/researchendpoint that takes aquerystring and returns the Perplexity Agent API response with citations.” - “Wrap the Perplexity call in a
researchTopic(topic: string)helper and call it from the dashboard’s news widget.” - “Write a CLI subcommand
pplx askthat streams a Perplexity Agent API response to stdout.”
baseURL and reads PERPLEXITY_API_KEY from the environment.
Troubleshooting
Base URL Must Be Exactly https://api.perplexity.ai/v1
Base URL Must Be Exactly https://api.perplexity.ai/v1
The OpenAI SDK appends
Wrong base URLs typically surface as 404s or authentication errors.
/responses to the base URL on its own. Do not include /agent or /responses in the base URL, and do not omit /v1.| Correct | Wrong |
|---|---|
https://api.perplexity.ai/v1 | https://api.perplexity.ai/v1/agent |
https://api.perplexity.ai/v1/responses | |
https://api.perplexity.ai (missing /v1) |
Can I Replace Antigravity's Built-In Agent Model with Perplexity?
Can I Replace Antigravity's Built-In Agent Model with Perplexity?
Not today. Antigravity does not expose a custom-provider or BYOK setting that would let you route its in-editor agent through Perplexity. Use this guide’s pattern — calling the Perplexity Agent API from your application code — instead.If Antigravity adds custom-provider support in the future, the configuration will be: base URL
https://api.perplexity.ai/v1, API key from PERPLEXITY_API_KEY, and an OpenAI Responses‑compatible transport.API Key Isn't Being Picked Up
API Key Isn't Being Picked Up
Antigravity terminal sessions inherit environment variables from where Antigravity was launched. If
echo $PERPLEXITY_API_KEY is empty in the integrated terminal, either set it in your shell profile (~/.zshrc, ~/.bashrc) and relaunch Antigravity, or load it from a project-local .env file using something like dotenv.Choosing a Model vs. a Preset
Choosing a Model vs. a Preset
Presets like
pro-search are pre-configured for common research workloads and are the easiest starting point. If you need a specific third-party model (Claude, GPT, Gemini, etc.), pass model="anthropic/claude-sonnet-4-6" (or another value from the Agent API models list) instead of preset.Links & Resources
Agent API Quickstart
Build with the Agent API using OpenAI-compatible or native SDKs.
OpenAI Compatibility
Full reference for using the OpenAI SDK against Perplexity.
Agent API Presets
Pre-configured setups like
pro-search for common workloads.Agent API Models
Full list of third-party and Perplexity models available via the Agent API.
Perplexity SDK
Native SDK with cleaner preset syntax and full type safety.
API Console
Generate and manage your Perplexity API keys.