Skip to navigation

Quickstart

The Paygent CLI is a command line interface for the Paygent API. It scans a codebase for AI provider calls that should be metered, then creates the agents, pricing, customers, and subscriptions to bill them.

Prerequisites

Install

npm install -g paygent

Or run without installing:

npx paygent scan .

Authenticate

paygent login

This opens a browser, signs you in, and stores credentials on this machine. Confirm with:

paygent whoami

Scan Your Codebase

paygent scan .
FILE LINE PROVIDER KIND FUNCTION
generator.py 340 Google Gemini LLM _generate_structured
image_gen.py 39 Google Gemini LLM generate_image
research.py 47 Google Gemini LLM research_topic
3 call(s) to instrument across 3 file(s).
Integration plan written to:
paygent_module/paygent_integration_prompt.md

Copy the plan straight to your clipboard and paste it into your coding assistant:

paygent scan . --copy

Create Your First Agent

paygent agent create --name "Research" --external-id research

Define what you meter:

paygent agent indicator add research --name "Input tokens (per 1M)" --type ACTIVITY
paygent agent indicator add research --name "Output tokens (per 1M)" --type ACTIVITY

Price it:

paygent agent pricing set research --platform-fee 99 \
--price "Input tokens (per 1M)=3.00" \
--price "Output tokens (per 1M)=15.00"

Add a customer and turn the agent on:

paygent customer create --name "Acme Corp" --external-id acme --email billing@acme.com
paygent agent enable research

An agent that is not enabled rejects usage. This is the most common reason a first event disappears.

See Usage

paygent usage agent --agent research
paygent billing overview

Common Options

paygent agent list \
--output json \
--org 68b2c1a4f0e1d2c3b4a59687 \
--timeout 60s
  • --output sets the format: table, json, yaml, or csv.
  • --org acts on a specific organization.
  • --profile selects a saved configuration profile.
  • --timeout sets the HTTP timeout.