ai-sdk-provider-pi has 2,567 recorded weekly downloads on npm, an increase of 1303% over the past 30 days, ranking #1802 of 3,247 tracked listings.
About ai-sdk-provider-pi
AI SDK Provider for Pi
A community provider for the Vercel AI SDK that enables using AI models through Pi (@mariozechner/pi-coding-agent). Pi is a minimal, extensible terminal coding agent with built-in tools for reading, writing, editing files, and executing shell commands.
This provider wraps Pi's coding-agent runtime as a LanguageModelV3, enabling standard AI SDK usage (generateText, streamText, generateObject) with Pi's provider/model registry, tool execution loop, and session semantics.
Version Compatibility
| Provider Version | AI SDK Version | NPM Tag | Status |
|---|---|---|---|
| 0.x | v6 | latest | Active |
npm install ai-sdk-provider-pi ai@^6.0.0
Feature Support
| Feature | Support | Notes |
|---|---|---|
| Text generation | Full | generateText(), streamText() |
| Streaming | Full | Real-time event streaming via session.subscribe() |
| Tool observation | Full | Provider-executed tools with full lifecycle streaming |
| Extended thinking | Full | reasoning-start/delta/end stream parts |
| Abort/cancellation | Full | AbortSignal wired to session.abort() |
| Session management | Full | Fresh per call or persistent via sessionId |
| Image input (base64) | Full | Uint8Array or base64 string file parts |
| Structured output (JSON) | Best-effort | Schema guidance in prompt; not provider-enforced |
| Configurable logging | Full | Verbose mode, custom logger, or silent |
| Image input (URL) | Not supported | Use binary/base64 data instead |
| Embedding models | Not supported | NoSuchModelError |
| Image generation models | Not supported | NoSuchModelError |
| topP/topK | Not supported | Warnings emitted, values ignored |
Installation
1. Configure Pi authentication
Ensure Pi auth is configured for the provider you want to use. Authenticate with Pi tooling (e.g., via @mariozechner/pi-ai login flows) and/or configure Pi model/provider settings in your Pi config.
2. Install the provider
npm install ai-sdk-provider-pi ai
Quick Start
import { generateText } from 'ai';
import { createPi } from 'ai-sdk-provider-pi';
const provider = createPi({
defaultSettings: {
cwd: process.cwd(),
tools: 'coding',
},
});
const result = await generateText({
model: provider('anthropic/claude-sonnet-4'),
prompt: 'Reply with a single sentence confirming this provider is running.',
});
console.log(result.text);
Streaming
import { streamText } from 'ai';
import { createPi } from 'ai-sdk-provider-pi';
const provider = createPi({
defaultSettings: { cwd: process.cwd(), tools: 'all' },
});
const result = streamText({
model: provider('anthropic/claude-sonnet-4'),
prompt: 'List top-level files and summarize the largest one.',
});
for await (const part of result.fullStream) {
if (part.type === 'text-delta') process.stdout.write(part.text);
if (part.type === 'tool-call') console.log(`\n[tool-call] ${part.toolName}`);
if (part.type === 'tool-result') console.log(`\n[tool-result] ${part.toolName}`);
}
Structured Output (generateObject)
Structured output is supported as a compatibility mode (best-effort), not strict provider-level schema enforcement:
supportsStructuredOutputs = false- JSON schema guidance is injected into the instruction preamble
- Compatibility warnings are emitted
- Provider metadata includes
structuredOutputValidated: false
Use generateObject when convenient, and for strict workflows keep a fallback path that validates parsed JSON locally.
See examples/generate-object-basic.ts.
Image Inputs
Image analysis is supported through AI SDK message parts by passing base64 file data with mediaType.
- Supported input payloads are base64-backed file parts (not remote image URL passthrough)
- Example:
examples/image-analysis.ts - Sample image included:
examples/bull.webp
API
createPi(options?)
Creates a provider instance.
import { createPi } from 'ai-sdk-provider-pi';
const provider = createPi({
defaultSettings: {
cwd: process.cwd(),
tools: 'coding',
},
});
pi
Default provider instance:
import { pi } from 'ai-sdk-provider-pi';
PiSettings…
Description from the npm listing.
- ai-sdk
- provider
- pi
- vercel
README badge
Show your rank in a README or on your website. The badge updates automatically.
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a linear scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (128)Similar npm AI SDKs plugins
All 20 ai-sdk-provider-pi alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/ai-sdk-provider-pi. First seen Nov 22, 2026; last successful collection Dec 6, 2026. See the methodology.