open-index/open-npm huggingface dataset:
npm package: @paid-ai/instrument-repo
Description: Instrument repository with the Paid platform
Latest version: 1.0.5

# @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

```bash
npx @paid-ai/instrument-repo
```

Generate your free API key at [https://app.paid.ai/](https://app.paid.ai/).

## What it does

The tool follows a structured 5-phase process:

1. **Analysis Phase** - Auto-detects language, framework, package manager, and existing setup
2. **Planning Phase** - Asks for missing information with detected values as defaults
3. **Setup Phase** - Installs packages, creates .env files, and sets up client utilities
4. **Detection Phase** - Finds AI SDK method calls that need instrumentation
5. **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
- `.env` file 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:**
```typescript
import { streamText } from 'ai';

const result = await streamText({
  model: openai('gpt-4'),
  prompt: 'Hello'
});
```

**After:**
```typescript
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'
  });
});
```
npm package: @paid-ai/monetize
Description: Get monetized with the Paid platform
Latest version: 2.0.0

# Run
Test against local repo example:

```bash
(cd /Users/xifong/src/experiments/next-simple-agent-demo && git restore . && git clean -fd) && ./build/test-tool.sh -d /Users/xifong/src/experiments/next-simple-agent-demo monetize --agent-id=blah --customers --payments --publishable-key=blah --framework=nextjs-app --paid-api-key=api-key-2
```

Test with pricing page:

```bash
./build/test-tool.sh -d /path/to/repo monetize --customers --payments --agent-id=your-agent-id --publishable-key=pk_12345 --framework=nextjs-app --paid-api-key=paid-api-key-123 --pricing-page-id=pricing-page-id
```

Test against remote repo by making PRs instead (set a GITHUB_TOKEN first):

```bash
./build/test-tool.sh monetize --agent-id=blah --customers --payments  --publishable-key=blah --framework=nextjs-app --paid-api-key=api-key-2 --github-url=https://github.com/paid-ai/paid-ai-vercel-ai-sdk-integration-example.git --branch=unmonetized
```