从 Cargo 拉取运行指标、下载结果,并跨 runs、batches、spans 执行 SQL 查询。
设计与多媒体
cargo-billing
试用在 Cargo CLI 上查看工作区余额、按工作流或连接器拆分用量、订阅状态、发票和支付方式。
它能做什么
通过 `cargo-ai` 命令行拉取工作区的信用消耗、订阅信息和发票历史,并管理工作区内的付款方式。用量数据可按工作流、连接器、集成、模型或智能体过滤,按相同维度分组统计指定时间段的消费。先用单条样本记录跑一次工作流,再用 `billing usage get-metrics` 测出每条消耗,乘以记录总数即可估算整批任务的成本,再和 `subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount` 比较。付款方式支持命令行参数、标准输入或 Stripe 表单链接三种方式更新,卡号直接发往 Stripe,不经过 Cargo 接口。所有命令都需要具备管理员权限的 token,非管理员 token 会返回 `{"errorMessage":"forbidden"}`。
什么时候用它
- 查看剩余信用和当前订阅计划
- 按工作流、连接器、模型或智能体拆分用量
- 拉取发票历史并核对账单项
- 在执行大批量任务前估算成本
技能文档
Cargo CLI — Billing
Billing and credit management: pulling usage metrics, checking subscription status, viewing invoices, and managing credits.
See
references/response-shapes.mdfor full JSON response structures. Seereferences/troubleshooting.mdfor common errors and how to fix them. Seereferences/examples/usage-metrics.mdfor usage metric and subscription examples.
Bootstrap
Already signed in (cargo-ai whoami returns a workspace)? Skip to the next section.
npm install -g @cargo-ai/cli # no global install? prefix every command with `npx @cargo-ai/cli`
cargo-ai login --email you@company.com # emailed code, no browser; creates the account on first use
# alternatives: --oauth (browser) · --token (CI)
cargo-ai whoami # confirm the active workspace before any write
Every command prints JSON to stdout; failures exit non-zero with {"errorMessage": "..."}. Anything that creates a run or a batch is async — pass --wait-until-finished or poll the matching get. Admin-only: every command in this skill requires a token with admin access on the workspace. Non-admin tokens return {"errorMessage":"forbidden"}. When the full skill bundle is installed, ../cargo/references/prerequisites.md adds the CLI version pin, token scopes, and the admin-only surface.
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 --to
cargo-ai billing usage get-metrics --from --to --group-by workflow_uuid
cargo-ai billing subscription get
cargo-ai billing subscription get-invoices
cargo-ai billing subscription update-payment-method --card-number --card-exp --card-cvc
cargo-ai billing subscription create-portal-session
Estimating 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 credits
Step 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 --data '{...}'
# → poll to completion
# Check credits used for that run
cargo-ai billing usage get-metrics \
--from --to \
--workflow-uuid
# → .totalUsage = credits consumed today for this workflow
Step 3 — Project batch cost:
estimated_cost = credits_per_record × number_of_records
Compare against subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount before proceeding.
Step 4 — Monitor during the batch:
# Check running costs mid-batch
cargo-ai billing usage get-metrics \
--from --to \
--workflow-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 |
To find out which node or provider dominates a play's spend before picking a lever, follow the attribution runbook in
../cargo-diagnostics/references/play-optimize-credits.md.
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 --to
# Group by dimension
cargo-ai billing usage get-metrics --from --to --group-by workflow_uuid
cargo-ai billing usage get-metrics --from --to --group-by connector_uuid
cargo-ai billing usage get-metrics --from --to --group-by integration_slug
cargo-ai billing usage get-metrics --from --to --group-by model_uuid
cargo-ai billing usage get-metrics --from --to --group-by agent_uuid
# Filter by specific resource
cargo-ai billing usage get-metrics --from --to --workflow-uuid
cargo-ai billing usage get-metrics --from --to --agent-uuid
cargo-ai billing usage get-metrics --from --to --connector-uuid
cargo-ai billing usage get-metrics --from --to --integration-slug
# Specify unit
cargo-ai billing usage get-metrics --from --to --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 update-payment-method # add or replace the card (see below)
cargo-ai billing subscription create-portal-session # Stripe portal URL for self-service billing
Remaining credits = subscriptionAvailableCreditsCount - subscriptionCreditsUsedCount from subscription get.
Note: Invoice amounts are returned in cents. Divide by 100 for the dollar value.
The free tier
A new account starts with 100 free credits and no card on file. When subscription get shows a fresh or near-fresh balance, answer cost questions against that budget rather than as an abstract number — "you've used 12 of your 100 free credits" is the useful answer to "how am I doing?", and it is also the honest one when the user is deciding whether to keep going.
What 100 credits buys, as ballpark anchors (per-action costs in ../cargo-gtm/references/credits-cost-table.md):
| Work | Cost | 100 credits ≈ |
|---|---|---|
Source leads — salesNavigator.searchLeads | 0.02/record | ~5,000 leads |
Enrich from a LinkedIn URL + verified email — aiArk.enrichPerson | 0.1 | ~1,000 people |
Verify an email — waterfall.verifyEmail | 0.1 | ~1,000 checks |
Full contact enrichment — waterfall.enrichContact | 2 | ~50 contacts |
Find a phone — FullEnrich.findPhone | 6 | ~16 numbers |
The quickstart demo spends about 0.5. Phone lookups are the fastest way to burn a free tier, so phone is the guarded lever: the escalation tier runs 3–7 credits/record, ~10× email, and never belongs in a default chain — it enters a plan only on explicit user request, on qualified leads only. Full spend rules in ../cargo-gtm/references/cost-discipline.md.
Adding a card
A workspace holds exactly one card. update-payment-method sets it, whether or not one is already on file, and takes the details three ways.
# Card details — no browser, nothing to hand off
cargo-ai billing subscription update-payment-method \
--card-number 4242424242424242 --card-exp 12/2030 --card-cvc 123
# Same, but keeps the number out of shell history and the process list
echo '{"number":"4242424242424242","expMonth":12,"expYear":2030,"cvc":"123"}' \
| cargo-ai billing subscription update-payment-method --card-stdin
# No card details — prints a Stripe-hosted form URL and waits for the card to land
cargo-ai billing subscription update-payment-method
Prefer --card-stdin. Anything passed as a flag is visible in shell history and to any process that can read the process list. Card details go from your machine straight to Stripe in exchange for a token; they never reach the Cargo API, and no output prints them.
Never invent card details, and never reuse a number from elsewhere in the conversation. Ask the user for them, or use the no-argument form and hand them the URL.
The no-argument form is the fallback when you have no details to submit: it prints a URL that opens directly on the card form, then polls until the card changes (--timeout, --poll-interval, --no-open). Relay that URL to the user — it works over SSH and in sandboxes.
Either way the card is verified against the issuer before it becomes the default, so a card that cannot be charged fails here rather than silently at the next renewal.
| Failure | What it means | What to do |
|---|---|---|
cardDeclined + declineCode | The issuer refused the verification | Read declineCode. On a spend-limited virtual card, insufficient_funds or a limit code means the budget or merchant restrictions rule us out — ask the cardholder to raise it |
authenticationRequired | The card wants 3-D Secure, which needs the cardholder present | Re-run with no arguments and hand the user the hosted-form URL |
paymentMethodNotFound | The details did not resolve to a usable card | Re-check the number and expiry with the user |
Card updates are rate-limited to 10 per hour per workspace (shared with setup intents). Retrying a declined card burns that budget — fix the cause rather than looping.
Help
Every command supports --help:
cargo-ai billing usage get-metrics --help
cargo-ai billing subscription get --help
cargo-ai billing subscription get-invoices --help
相关技能
Guided first-run demo for Cargo — one persona question to 25 real leads with a cost receipt in under two minutes, ending by saving the pull as a recurring play. Triggers: "show me what Cargo can do", "give me a demo", "take me on a tour", "quickstart", "getting started with Cargo", "I just installed Cargo", "my workspace is empty", "does this actually work". Skip when: the user has a real job to run (build a list, enrich a CSV, find emails) — use cargo-gtm; when they want CLI reference or routing — use the cargo router skill.
在 CLI 中管理 Cargo 工作区,并向 Cargo 团队提交反馈。
Explain what a Cargo run or batch actually did, after the fact — trace one run node by node, draw the graph it executed with the failing step marked, sweep a batch or play for errors grouped by root cause, and attribute credit spend down to the node and the provider. Triggers: "why did this fail", "it succeeded but the output is wrong", "half my rows are empty", "why is this column blank", "what broke in this batch", "why did that cost so much", "which node is burning credits", "it worked yesterday", "these results look wrong", "it went down the wrong path", "this step never ran", "show me what the run did". Skip when: setting up an alert for next time — use cargo-observability; just downloading the data — use cargo-analytics.
Watch a Cargo workspace and get told when something breaks — scheduled threshold alerts over workflow telemetry (spans, runs, records), a storage model freshness or row count, or any SQL query, firing a connector, tool, or agent when a metric breaches. Triggers: "alert me when", "notify me if", "let me know when the error rate", "monitor this workflow", "tell me if the sync stops", "warn me before I run out of credits", "dead man’s switch", "is this still running", "set up monitoring", plus listing, previewing, editing, and reviewing an alert firing history. Skip when: diagnosing something that already went wrong — use cargo-diagnostics.
用一个 CLI 表面执行、构建、绘制并查询 Cargo 工作流、动作、批量与 AI 代理。