Building a Client
Implement a PLP client
Official SDKs
Use the official JavaScript or Python SDK to connect to any PLP-compatible server.
import { PLPClient } from "@goreal-ai/plp-client"
const client = new PLPClient("https://api.example.com/v1", {
apiKey: "your-key"
})
const prompt = await client.get("welcome-email")Building a Custom Client
A minimal PLP client needs to: check discovery, fetch prompts by ID, handle Bearer auth, and handle both string and multimodal content.
Content Handling
Prompts can have string or array content. The SDKs provide helpers:
import { isMultiModal, normalizeContent, getTextContent } from "@goreal-ai/plp-client"
isMultiModal(prompt) // true if content is ContentPart[]
normalizeContent(prompt.content) // Always returns ContentPart[]
getTextContent(prompt.content) // Extracts text from any formatUsing the Registry
Access any vendor through a stable registry URL — the registry returns a 307 redirect to the vendor's server:
const client = new PLPClient("https://registry.plp.dev/my-vendor/v1", {
apiKey: "your-key"
})