createPiClient(). Methods map directly to Pi API endpoints, validate inputs with Zod before sending, and parse responses through typed contracts.
brands — Brand intelligence
brands — Brand intelligence
Extract brand DNA from a URL or images, list saved brands, retrieve a single brand, or project its identity into a structured use-case context.ImportMethodsExample
jobs — Async job lifecycle
jobs — Async job lifecycle
Retrieve a job by ID or poll until it reaches a terminal state (Example
completed, failed, or cancelled).MethodswaitForCompletion returns the parsed job envelope when the job finishes. If the timeout expires before the job completes, it returns the last-known job state.images — Image generation
images — Image generation
Generate ad images or campaign images. Both methods are async and return a Example
job_id for polling.Methodsads — Ad generation
ads — Ad generation
Generate a branded ad creative in a single async call.MethodsExample
campaigns — Campaign ads
campaigns — Campaign ads
Generate campaign ads, edit existing ads, and localize ads for different markets. All three methods are async and return a Example
job_id.Methodsavatars — AI avatars
avatars — AI avatars
Generate, save, list, and retrieve AI avatar images.MethodsExample
voice — Voice agents and sessions
voice — Voice agents and sessions
Create and manage reusable voice agents, start LiveKit sessions, and complete sessions when a call ends.MethodsExample
Voice sessions require LiveKit credentials. Pass them via
providerKeys.livekit either at client initialization or per-call in the options argument.health — Clinical intelligence
health — Clinical intelligence
Nine async methods covering the full clinical intelligence surface: triage, decision support, medication checks, clinical notes structuring, adherence analysis, patient risk prioritization, scan analysis, research assistance, and cognitive wellness.MethodsExample
neuro — Neural signal decoding
neuro — Neural signal decoding
Decode EEG or other neural signal data asynchronously.MethodsExample
surveillance — Video stream intelligence
surveillance — Video stream intelligence
Create video streams, manage detection policies, and consume real-time incident events over SSE.MethodsExample
surveillance.events() returns an AsyncIterable. Use for await…of to consume the SSE stream. The loop runs until the server closes the connection or you break out of it.robots — Agentic robotics
robots — Agentic robotics
Submit robotics runs, query robot status, issue real-time commands, manage zones and behaviors, and stream live robot events over SSE.MethodsExample
The client exposes this namespace as
pi.robots (not pi.robotics).runs — Multi-step agentic runs
runs — Multi-step agentic runs
Create and retrieve multi-step agentic runs that orchestrate multiple Pi capabilities together.MethodsExample
webhooks — Webhook management
webhooks — Webhook management
Register, list, and update webhook endpoints that Pi will call when async jobs complete.MethodsExample