AGENT SKILL

perplexity-deploy-integration

Deploy Perplexity integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying Perplexity-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy perplexity", "perplexity Vercel", "perplexity production deploy", "perplexity Cloud Run", "perplexity Fly.io".

License 许可
MIT
最近更新
2026-03-20
Stars
★ 4
Forks
0

01 前言 Front Matter

name
perplexity-deploy-integration
author
Jeremy Longshore <jeremy@intentsolutions.io>
license
MIT
version
1.0.0
description
Deploy Perplexity integrations to Vercel, Fly.io, and Cloud Run platforms. Use when deploying Perplexity-powered applications to production, configuring platform-specific secrets, or setting up deployment pipelines. Trigger with phrases like "deploy perplexity", "perplexity Vercel", "perplexity production deploy", "perplexity Cloud Run", "perplexity Fly.io".
allowed-tools
Read, Write, Edit, Bash(vercel:*), Bash(fly:*), Bash(gcloud:*)
compatible-with
claude-code, codex, openclaw

03 SKILL.md 正文

Perplexity Deploy Integration

Overview

Deploy applications using Perplexity's AI search API (api.perplexity.ai). Perplexity uses an OpenAI-compatible chat completions format with real-time web search grounding.

Prerequisites

  • Perplexity API key stored in PERPLEXITY_API_KEY environment variable
  • Application using fetch or OpenAI-compatible SDK
  • Platform CLI installed (vercel, docker, or gcloud)

Instructions

Step 1: Configure Secrets

# Vercel
vercel env add PERPLEXITY_API_KEY production

# Cloud Run
echo -n "your-key" | gcloud secrets create perplexity-api-key --data-file=-

Step 2: Deploy Search API with Streaming

// api/search.ts
export const config = { runtime: "edge" };

export default async function handler(req: Request) {
  const { query, model } = await req.json();

  const response = await fetch("https://api.perplexity.ai/chat/completions", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.PERPLEXITY_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: model || "sonar",
      messages: [{ role: "user", content: query }],
      stream: true,
      return_citations: true,
    }),
  });

  return new Response(response.body, {
    headers: { "Content-Type": "text/event-stream" },
  });
}

Step 3: Docker with Cache Layer

import { Redis } from "ioredis";

const redis = new Redis(process.env.REDIS_URL!);

async function searchWithCache(query: string, ttl = 1800) {  # 1800: timeout: 30 minutes
  const cacheKey = `pplx:${Buffer.from(query).toString("base64")}`;
  const cached = await redis.get(cacheKey);
  if (cached) return JSON.parse(cached);

  const response = await fetch("https://api.perplexity.ai/chat/completions", {
    method: "POST",
    headers: {
      "Authorization": `Bearer ${process.env.PERPLEXITY_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({
      model: "sonar",
      messages: [{ role: "user", content: query }],
      return_citations: true,
    }),
  });

  const result = await response.json();
  await redis.set(cacheKey, JSON.stringify(result), "EX", ttl);
  return result;
}

Step 4: Vercel Configuration

{
  "functions": {
    "api/search.ts": { "maxDuration": 30 }
  }
}

Step 5: Health Check

export async function GET() {
  try {
    const response = await fetch("https://api.perplexity.ai/chat/completions", {
      method: "POST",
      headers: {
        "Authorization": `Bearer ${process.env.PERPLEXITY_API_KEY}`,
        "Content-Type": "application/json",
      },
      body: JSON.stringify({
        model: "sonar",
        messages: [{ role: "user", content: "ping" }],
        max_tokens: 1,
      }),
    });
    return Response.json({ status: response.ok ? "healthy" : "degraded" });
  } catch {
    return Response.json({ status: "unhealthy" }, { status: 503 });  # HTTP 503 Service Unavailable
  }
}

Error Handling

Issue Cause Solution
Rate limited Too many requests Cache responses, use queue
Stale search results Cached too long Reduce cache TTL for time-sensitive queries
API key invalid Key expired Regenerate at perplexity.ai settings
Stream interrupted Network timeout Implement reconnection logic

Examples

Basic usage: Apply perplexity deploy integration to a standard project setup with default configuration options.

Advanced scenario: Customize perplexity deploy integration for production environments with multiple constraints and team-specific requirements.

Resources

Next Steps

For multi-environment setup, see perplexity-multi-env-setup.

Output

  • Configuration files or code changes applied to the project
  • Validation report confirming correct implementation
  • Summary of changes made and their rationale

04 同仓库更多 Skills

micsapp
micsapp/micstec-skills

azure-apim-architecture

Analyzes and explains Azure API Management architecture decisions for enterprise API marketplace implementations using VNet Internal mode, Front Door, hybrid authentication, and multi-environment strategies. Use when discussing APIM component selection, network topology, cost optimization, or comparing alternatives like workspaces vs instances, VNet Internal vs External mode, or Front Door vs Application Gateway.

★ 4
micsapp
micsapp/micstec-skills

apiops-deployment

Guides deployment of Azure API Management infrastructure using Infrastructure as Code (Bicep/Terraform), CI/CD pipelines (GitHub Actions/Azure DevOps), and APIOps workflows. Use when deploying APIM, creating pipelines, or implementing dev→test→prod promotion strategies.

★ 4
micsapp
micsapp/micstec-skills

apim-policy-authoring

Creates production-ready Azure API Management policy XML for authentication (OAuth 2.0, JWT validation, subscription keys), rate limiting, CORS configuration, error handling, and API transformations. Use when implementing API security, access control, or request/response processing logic.

★ 4
micsapp
micsapp/micstec-skills

api-security-review

Reviews Azure API Management configurations for security vulnerabilities, OWASP API Security Top 10 compliance, VNet Internal mode validation, Private Link verification, and Azure Security Benchmark alignment. Use when performing security audits, pre-deployment validation, or compliance reviews.

★ 4
micsapp
micsapp/micstec-skills

jira-cli

Interact with Jira from the command line to create, list, view, edit, and transition issues, manage sprints and epics, and perform common Jira workflows. Use when the user asks about Jira tasks, tickets, issues, sprints, or needs to manage project work items.

★ 4
micsapp
micsapp/micstec-skills

calculator

Performs arbitrary-precision arithmetic calculations including addition, subtraction, multiplication, division, and exponents. Use when the user asks to calculate, compute, or evaluate math expressions, or when precise decimal arithmetic is needed to avoid floating-point errors.

★ 4