@paid-ai/instrument-repo
v1.0.5
Published
Instrument repository with the Paid platform
Downloads
16
Readme
@paid-ai/instrument-repo
Automatically instrument your repository with the Paid platform for AI agent tracing and analytics. 5-phase setup process that detects your codebase, sets up dependencies, and transforms your AI SDK code.
Usage
npx @paid-ai/instrument-repoGenerate your free API key at https://app.paid.ai/.
What it does
The tool follows a structured 5-phase process:
- Analysis Phase - Auto-detects language, framework, package manager, and existing setup
- Planning Phase - Asks for missing information with detected values as defaults
- Setup Phase - Installs packages, creates .env files, and sets up client utilities
- Detection Phase - Finds AI SDK method calls that need instrumentation
- Transformation Phase - Uses LLM to transform your code with Paid tracing
Supported Languague Framework Combinations
Currently supports:
- Node.js + Vercel AI SDK projects
What gets created
utils/client.ts(or similar) - Paid client initialization.envfile with your Paid API key- Transforms AI SDK calls (
streamText,generateObject,generateText) to use Paid tracing
Requirements
- Paid API Key - For platform access and tracing
- OpenAI API Key - For LLM code transformations
- Customer ID - Used in tracing calls to identify your users
Example Transformation
Before:
import { streamText } from 'ai';
const result = await streamText({
model: openai('gpt-4'),
prompt: 'Hello'
});After:
import { paidStreamText } from '@paid-ai/paid-node/vercel';
import { getClient } from '../utils/client';
const client = await getClient();
const result = await client.trace('customer-123', async () => {
return await paidStreamText({
model: openai('gpt-4'),
prompt: 'Hello'
});
});