
Cargo Billing
- 3.4k installs
- 15 repo stars
- Updated August 3, 2026
- getcargohq/cargo-skills
cargo-billing is an agent skill from getcargohq/cargo-skills that helps developers integrate Cargo billing and subscription payment flows into backend services and agent-driven product workflows.
About
Reports billing analytics, credit usage, subscription details, and invoice history for a Cargo workspace. A developer uses it when checking usage costs or managing credits.
- Usage reports and credit management
- Subscription status and invoice history
Cargo Billing by the numbers
- 3,359 all-time installs (skills.sh)
- +535 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #45 of 1,106 Finance & Trading skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/getcargohq/cargo-skills --skill cargo-billingAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 3.4k |
|---|---|
| repo stars | ★ 15 |
| Last updated | August 3, 2026 |
| Repository | getcargohq/cargo-skills ↗ |
How do you integrate Cargo billing into an API?
Pull usage metrics, check subscription status, view invoices, and manage credits for a Cargo workspace via the CLI.
Who is it for?
Backend developers adding Cargo-powered subscription billing to APIs or agent-built SaaS products.
Skip if: Projects using Stripe, Paddle, or another billing provider, or apps with no payment or subscription requirements.
When should I use this skill?
The user asks to add Cargo billing, subscriptions, payment flows, or plan management to a backend service.
What you get
Cargo billing integration code, subscription plan hooks, and payment event handlers.
- billing integration code
- subscription webhook handlers
Files
Cargo CLI — Billing
Billing and credit management: pulling usage metrics, checking subscription status, viewing invoices, and managing credits.
See references/response-shapes.md for full JSON response structures.See references/troubleshooting.md for common errors and how to fix them.See references/examples/usage-metrics.md for usage metric and subscription examples.Prerequisites
See `../cargo/references/prerequisites.md` for install, login (--oauth / --token), JSON output conventions, and error shapes. Verify the session with cargo-ai whoami before running any of the commands below.
Admin-only: every command in this skill requires a token with admin access on the workspace. Non-admin tokens return {"errorMessage":"forbidden"}.
Discover resources first
Usage metrics can be filtered and grouped by resource UUID. Discover them before querying.
cargo-ai orchestration play list # all plays (name, workflowUuid)
cargo-ai orchestration tool list # all tools (name, workflowUuid)
cargo-ai ai agent list # all agents (uuid, name)
cargo-ai connection connector list # all connectors (uuid, name, integrationSlug)
cargo-ai storage model list # all models (uuid, name, slug)Quick reference
cargo-ai billing usage get-metrics --from <YYYY-MM-DD> --to <YYYY-MM-DD>
cargo-ai billing usage get-metrics --from <YYYY-MM-DD> --to <YYYY-MM-DD> --group-by workflow_uuid
cargo-ai billing subscription get
cargo-ai billing subscription get-invoices
cargo-ai billing subscription create-portal-sessionEstimating cost before running a batch
Before triggering a large batch, estimate credit consumption to avoid unexpected charges.
Step 1 — Check current credit balance:
cargo-ai billing subscription get
# → subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount = remaining creditsStep 2 — Estimate cost from a sample run:
Run the workflow on a single record first and measure credits consumed:
# Run on one record
cargo-ai orchestration run create --workflow-uuid <uuid> --data '{...}'
# → poll to completion
# Check credits used for that run
cargo-ai billing usage get-metrics \
--from <today> --to <today> \
--workflow-uuid <uuid>
# → .totalUsage = credits consumed today for this workflowStep 3 — Project batch cost:
estimated_cost = credits_per_record × number_of_recordsCompare against subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount before proceeding.
Step 4 — Monitor during the batch:
# Check running costs mid-batch
cargo-ai billing usage get-metrics \
--from <start-date> --to <today> \
--workflow-uuid <uuid>Cost levers:
| Action | Effect |
|---|---|
Use a cheaper model (e.g. gpt-4o-mini vs gpt-4o) | Significant reduction for AI nodes |
Add filter nodes early in the graph | Skip ineligible records before expensive connector calls |
Set fallbackOnFailure: false | Stop the run early on failures instead of continuing to downstream nodes |
Reduce maxSteps on agent nodes | Limit how many tool calls an agent can make per record |
Usage metrics
Pull credit and usage data for any time range, optionally filtered and grouped.
# Basic usage for a period
cargo-ai billing usage get-metrics --from <start-date> --to <end-date>
# Group by dimension
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --group-by workflow_uuid
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --group-by connector_uuid
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --group-by integration_slug
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --group-by model_uuid
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --group-by agent_uuid
# Filter by specific resource
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --workflow-uuid <uuid>
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --agent-uuid <uuid>
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --connector-uuid <uuid>
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --integration-slug <slug>
# Specify unit
cargo-ai billing usage get-metrics --from <start-date> --to <end-date> --unit credits--group-by values: workflow_uuid, connector_uuid, model_uuid, integration_slug, agent_uuid.
Available filters: --workflow-uuid, --model-uuid, --connector-uuid, --integration-slug, --slug, --agent-uuid. Combine with --group-by and --unit.
Subscription and credits
cargo-ai billing subscription get # current plan, credits used/available, period dates
cargo-ai billing subscription get-invoices # invoice history (amounts in cents)
cargo-ai billing subscription get-credit-card # card on file
cargo-ai billing subscription create-portal-session # Stripe portal URL for self-service billingRemaining credits = subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount from subscription get.
Note: Invoice amounts are returned in cents. Divide by 100 for the dollar value.
Help
Every command supports --help:
cargo-ai billing usage get-metrics --help
cargo-ai billing subscription get --help
cargo-ai billing subscription get-invoices --helpUsage metrics examples
Get overall usage for a time range
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31Response:
{
"metrics": [
{
"date": "2025-01-15T00:00:00Z",
"items": [
{ "slug": "enrichment", "count": 150, "groupBy": null },
{ "slug": "ai_message", "count": 42, "groupBy": null }
]
}
]
}Each item has a slug (usage type) and count. When --group-by is used, groupBy contains the resource UUID/slug.
Group by workflow
See which workflows consume the most credits.
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by workflow_uuid
# → Each item has groupBy = workflow UUID
# → Cross-reference with: cargo-ai orchestration workflow listGroup by connector
See which connectors (e.g. Salesforce, HubSpot) are used most.
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by connector_uuid
# → Cross-reference with: cargo-ai connection connector listGroup by integration
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by integration_slugGroup by model
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by model_uuid
# → Cross-reference with: cargo-ai storage model listGroup by agent
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by agent_uuid
# → Cross-reference with: cargo-ai ai agent listFilter usage to a specific workflow
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--workflow-uuid <uuid>Filter usage to a specific agent
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--agent-uuid <uuid>Filter usage to a specific connector
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--connector-uuid <uuid>Filter usage to a specific integration
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--integration-slug <slug>Specify unit (credits)
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--unit creditsCombine group-by with filter
Usage for a specific workflow, grouped by connector.
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--workflow-uuid <uuid> \
--group-by connector_uuidCheck subscription and remaining credits
cargo-ai billing subscription getResponse:
{
"subscription": {
"plan": "self-serve",
"subscriptionStatus": "active",
"subscriptionAvailableCreditsCount": 10000,
"subscriptionCreditsUsedCount": 3200,
"startAt": "2025-01-01T00:00:00Z",
"resetAt": "2025-02-01T00:00:00Z"
}
}Remaining credits = subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount.
# Invoice history (amounts in cents — divide by 100 for dollars)
cargo-ai billing subscription get-invoices
# Card on file
cargo-ai billing subscription get-credit-card
# Open Stripe portal for self-service billing
cargo-ai billing subscription create-portal-sessionCompare usage across two periods
# This month
cargo-ai billing usage get-metrics \
--from 2025-02-01 --to 2025-02-28
# Last month
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31
# → Compare metrics[].items[].count values to spot trendsMonthly usage report (full flow)
# 1. Overall usage
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31
# 2. Break down by workflow
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by workflow_uuid
# 3. Break down by connector
cargo-ai billing usage get-metrics \
--from 2025-01-01 --to 2025-01-31 \
--group-by connector_uuid
# 4. Check remaining credits
cargo-ai billing subscription getResponse shapes
JSON response structures returned by Cargo CLI commands used in the cargo-billing skill.
cargo-ai billing usage get-metrics
{
"metrics": [
{
"date": "2025-01-15T00:00:00Z",
"items": [
{ "slug": "enrichment", "count": 150, "groupBy": null },
{ "slug": "ai_message", "count": 42, "groupBy": null }
]
},
{
"date": "2025-01-16T00:00:00Z",
"items": [
{ "slug": "enrichment", "count": 200, "groupBy": null }
]
}
]
}When --group-by is specified, groupBy contains the resource identifier:
{
"metrics": [
{
"date": "2025-01-15T00:00:00Z",
"items": [
{ "slug": "enrichment", "count": 100, "groupBy": "workflow-uuid-1" },
{ "slug": "enrichment", "count": 50, "groupBy": "workflow-uuid-2" }
]
}
]
}Key fields: metrics[].date, metrics[].items[].slug (usage type), metrics[].items[].count, metrics[].items[].groupBy.
cargo-ai billing subscription get
{
"subscription": {
"uuid": "...",
"workspaceUuid": "...",
"plan": "self-serve",
"cadence": "monthly",
"subscriptionStatus": "active",
"subscriptionAvailableCreditsCount": 10000,
"subscriptionCreditsUsedCount": 3200,
"additionalAvailableCreditsCount": 0,
"fixedPrice": 9900,
"conversionRate": 1,
"hasCredits": true,
"startAt": "2025-01-01T00:00:00Z",
"resetAt": "2025-02-01T00:00:00Z",
"endAt": null,
"topup": null,
"createdAt": "2025-01-01T00:00:00Z",
"updatedAt": "2025-01-15T00:00:00Z"
}
}Key fields: plan (self-serve or enterprise), subscriptionStatus, subscriptionAvailableCreditsCount, subscriptionCreditsUsedCount, startAt, resetAt.
Remaining credits = subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount.
cargo-ai billing subscription get-invoices
{
"invoices": [
{
"id": "inv_...",
"isPaid": true,
"amount": 9900,
"currency": "usd",
"dueDate": "2025-02-01T00:00:00Z",
"url": "https://..."
}
]
}Key fields: id, isPaid (boolean), amount (in cents — divide by 100 for dollars, e.g. 9900 = $99.00), url (link to the invoice).
cargo-ai billing subscription create-portal-session
{
"portalSession": {
"url": "https://billing.stripe.com/session/..."
}
}Open portalSession.url in a browser to access the Stripe self-service billing portal.
Troubleshooting
Common errors and recovery steps for cargo-billing commands.
General
| Symptom | Cause | Fix |
|---|---|---|
{"errorMessage": "..."} with non-zero exit | Any CLI error | Read the errorMessage — it usually says exactly what's wrong |
command not found: cargo-ai | CLI not installed or not in PATH | Run npm install -g @cargo-ai/cli or prefix with npx @cargo-ai/cli |
Unauthorized or Forbidden | Bad or expired credentials | Re-run cargo-ai login --oauth (browser sign-in) or cargo-ai login --token <token>; verify with cargo-ai whoami |
Usage metrics
| Symptom | Cause | Fix |
|---|---|---|
| Empty metrics (no items) | Date range has no activity, or wrong format | Verify dates are YYYY-MM-DD; try a wider range; confirm the workspace had activity in that period |
--group-by returns items with null groupBy | Some usage isn't attributable to that dimension | This is expected — unattributed usage shows groupBy: null |
| Metrics don't match expectations | Filtering by wrong resource UUID | Re-discover UUIDs with play list, tool list, connector list, or agent list |
Subscription and billing
| Symptom | Cause | Fix |
|---|---|---|
subscription get returns Forbidden | Token lacks billing permissions | Use a token with admin access; check workspace settings under Settings > API |
| Invoice amounts look wrong | Amounts are in cents, not dollars | Divide amount by 100 for the dollar value |
create-portal-session returns an error | Subscription not active or no Stripe setup | Verify the workspace has an active paid subscription |
Related skills
How it compares
Use cargo-billing when the payment stack is Cargo; use Stripe or Paddle integration skills for other billing providers.
FAQ
What does cargo-billing help implement?
cargo-billing is a getcargohq agent skill for integrating Cargo billing into backend services. It guides subscription setup, payment event handling, and plan management for APIs and agent-built SaaS products.
When should I use cargo-billing?
Use cargo-billing when a product uses the Cargo billing platform and needs subscription or payment logic wired into backend code. The skill fits active integration work during SaaS feature development.