> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.withpaygent.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.withpaygent.com/_mcp/server.

# Quick Start

Get started with Paygent in less than 5 minutes. Choose your SDK and start tracking AI usage immediately.

## Step 1 — Get Your API Key

Sign up at [withpaygent.com](https://withpaygent.com) and get your API key from the dashboard.

---

## Step 2 — Install the SDK

#### Python

**`Terminal`**

```bash title="Terminal"
pip install paygent-sdk
```

#### Node.js

**`Terminal`**

```bash title="Terminal"
npm install @paygent_org/paygent-sdk-node
```

#### Go

**`Terminal`**

```bash title="Terminal"
go get github.com/paygent-org/paygent-sdk-go
```

---

## Step 3 — Set up Agents and Indicators

Define your AI agents and the indicators (actions) they'll track in the Paygent dashboard. For example, create a `chatbot-agent` agent and a `message-sent` indicator.

> **Info**
>
> **Common Examples:**
>
> * **Agent:** `customer-support-bot` → **Indicator:** `message-sent`
> * **Agent:** `sales-assistant` → **Indicator:** `meeting-booked`
> * **Agent:** `content-generator` → **Indicator:** `article-generated`

### Creating an Agent

**Step 1:** Go to Paygent dashboard and click on "Create Agent"

![Create Agent Button](/_fern-img/2b34885576ca50897e801c35d3a2bc56227dce5082f39d21f205aaae68885292.webp)

**Step 2:** Give agent name and external ID. External ID is important, Select other agent

![Agent Details Form](/_fern-img/0aa05b9f9ff12649d30f28f68bc2dad5656805440a03e1ef889afe5ae569c2c2.webp)

**Step 3:** Create indicators. Indicators can be activity-based or outcome-based

![Create Indicators](/_fern-img/5caccff9c10bcfa880a3cf3f1a2475281ac99a85ec7709f828fe7714ee5de2df.webp)

**Step 4:** Define your pricing. For example, in the image it's \$2 per call

![Define Pricing](/_fern-img/72acec2aff5752ff45e05d3759c2915db1fd17dc52458f8a555c3de251b1c38c.webp)

**Step 5:** Your agent is created successfully!

![Agent Created Successfully](/_fern-img/7896b57459ac8e2f7b4995da8948872708f8858461268680333a7eab02380191.webp)

### Creating a Customer

**Step 1:** Click on "Create Customer"

![Create Customer Button](/_fern-img/22aaf2cf8c25762eaf0c342099fec746251845992ecc7fb6de41f0b6aeb6fe17.webp)

**Step 2:** Define customer and external ID. *Tip: Always use your database customer ID as external ID*

![Customer Details Form](/_fern-img/1c6a5506bc62c8563d34fa0cf64c34e950254b13304267f10e6986b2fd6459b7.webp)

**Step 3:** Customer is created successfully!

![Customer Created Successfully](/_fern-img/22f560b355f522c20b0c0f81411a25543845d9ffec86d06cdaa605cd759ab7cf.webp)

---

## Step 4 — Send Your First Usage Data

#### Python

The simplest way to track AI usage in Python is by initializing Paygent at the start of your application. This automatically instruments supported LLM clients.

**`main.py`**

```python title="main.py"
import paygent_sdk
from openai import OpenAI

# 1. Initialize Paygent (Automatic Tracking)
paygent_sdk.init(api_key="your-paygent-api-key")

# 2. Use your LLM client normally
client = OpenAI(api_key="your-openai-api-key")

# 3. Add paygent_* kwargs to track usage
response = client.chat.completions.create(
    model="gpt-4o",
    messages=[{"role": "user", "content": "Hello!"}],
    
    # Paygent tracking parameters
    paygent_agent_id="chatbot-agent",
    paygent_customer_id="customer-123",
    paygent_indicator="message-sent"
)

print(response.choices[0].message.content)
```

#### Node.js

**`index.ts`**

```typescript title="index.ts"
import { PaygentClient } from '@paygent_org/paygent-sdk-node';

// Create a new client
const client = PaygentClient.newClient('your-paygent-api-key');

// Define usage data
const usageData = {
  serviceProvider: 'OpenAI',
  model: 'gpt-4o',
  promptTokens: 756,
  completionTokens: 244,
  totalTokens: 1000
};

// Send usage data
await client.sendUsage(
  'chatbot-agent',      // Agent ID
  'customer-123',       // Customer ID
  'message-sent',       // Indicator
  usageData
);

console.log('Usage tracked successfully!');
```

#### Go

**`main.go`**

```go title="main.go"
package main

import (
    "context"
    "fmt"
    paygent "github.com/paygent-org/paygent-sdk-go"
)

func main() {
    // Create client
    client := paygent.NewClient("your-paygent-api-key")
    
    // Define usage data
    usageData := paygent.UsageData{
        ServiceProvider:  "OpenAI",
        Model:            "gpt-4o",
        PromptTokens:     756,
        CompletionTokens: 244,
        TotalTokens:      1000,
    }
    
    // Send usage data
    err := client.SendUsage(
        "chatbot-agent",      // Agent ID
        "customer-123",       // Customer ID
        "message-sent",       // Indicator
        usageData,
    )
    
    if err != nil {
        fmt.Printf("Failed to send usage: %v\n", err)
        return
    }
    
    fmt.Println("Usage tracked successfully!")
}
```

---

## Step 5 — Create an Order (enable billing)

Usage tracking alone does not invoice customers. Create an **order** to start automatic billing:

1. **Orders → Create Order**
2. Select your customer and set billing day / payment terms
3. **Add line** → pick your agent (optional: select a [Plan](/documentation/introduction/plans))
4. Click **Done**, then open the order and click **Activate**

Only **active** orders generate invoices on the billing schedule.

> **Info**
>
> **Optional before billing:** [Credit currencies](/documentation/introduction/credit-currencies) for prepaid/postpaid, [Taxes](/documentation/introduction/taxes) on the order, [External costs](/documentation/introduction/external-costs) for pass-through charges.

---

## Step 6 — Monitor & Bill

View real-time usage in **Dashboard → Agent Analytics**. On each billing day, Paygent generates itemized invoices from usage, [subscription fees](/documentation/introduction/subscription-fees), external costs, and taxes.

Send the invoice PDF, generate a Stripe payment link, or mark as paid to release pending wallet credits.

> **Success**
>
> **That's it!** You've integrated Paygent end to end: SDK → usage → order → invoice.
>
> **Next steps:**
>
> * [How It Works](/documentation/introduction/how-it-works) — full integration map
> * [Plans](/documentation/introduction/plans) — tiered pricing packages
> * [Credits & Wallets](/documentation/introduction/credits-and-wallets) — prepaid credit packs
> * SDK docs for [automatic tracking](/documentation/sdks/automatic-tracking) and [error handling](/documentation/guides/error-handling)