Manual Tracking
Manual tracking gives you full control when you already know the exact token counts. Use manual tracking when:
- ✓ You’re calling AI APIs directly and have access to usage data
- ✓ You want maximum control over what’s reported
- ✓ You’re tracking non-OpenAI models or custom services
- ✓ You have your own token counting logic
Example: OpenAI Integration
Python
Node.js
Go
Unified SDK Entrypoint: paygent_sdk.init(api_key) enables automatic patching for LLMs (OpenAI, Gemini, Anthropic) AND returns the paygent client object for manual tracking calls (send_usage, send_indicator, etc.).
Standalone Scripts: Paygent sends tracking events asynchronously on background threads so calling threads are never blocked. In short standalone test scripts (unlike web servers), add time.sleep(1) at the end to allow background HTTP requests to complete before the process exits.
Automate Onboarding. To simplify your workflow, call client.create_or_get_customer() before tracking usage. This ensures the customer exists in Paygent without needing manual setup in the dashboard.
