cbilling
Multi-cloud billing CLI & SDK for Rust — query, compare, and visualize costs from AWS, GCP, Alibaba Cloud, Tencent Cloud, Volcengine, UCloud, and Cloudflare in one terminal.
Every provider API is covered: cost breakdown by product, region-level detail, month-over-month comparison, multi-account aggregation, and CSV export — all from a single binary or as a Rust library.
Install
Shell (macOS / Linux)
|
Cargo
Manual Download
VERSION=
# macOS (Apple Silicon)
|
# macOS (Intel)
|
# Linux (x86_64)
|
# Linux (aarch64)
|
Rust Library
[]
= "0.1"
# Or pick only what you need
= { = "0.1", = false, = ["aws", "gcp"] }
Supported Providers
| Provider | Feature Flag | API | Currency |
|---|---|---|---|
| Alibaba Cloud (Aliyun) | aliyun |
BSS OpenAPI | CNY |
| AWS | aws |
Cost Explorer | USD |
| Tencent Cloud | tencentcloud |
Billing API v3 | CNY |
| Volcengine | volcengine |
Billing API | CNY |
| UCloud | ucloud |
UBill API | CNY |
| Google Cloud (GCP) | gcp |
Cloud Billing + BigQuery | USD |
| Cloudflare | cloudflare |
Billing API v4 | USD |
Usage
TUI Dashboard (default)
Launches a full-screen terminal UI with:
- Provider tabs with real-time cost totals
- Horizontal bar chart showing cost distribution
- Sortable product table with MoM (month-over-month) comparison
- Region detail expansion, search/filter, mouse scroll
- Month navigation with
←/→
CLI Commands
# List configured providers
# Query a specific provider
# JSON output (for scripting & AI agents)
# Export to CSV
# Summary across all providers
All commands support --format json for machine-readable output.
Output Examples
$ cbilling providers
PROVIDER STATUS
------------------------------
aliyun ready
tencentcloud ready
aws ready
gcp ready
4 provider(s) configured
$ cbilling summary --month 2026-03
Querying 4 provider(s) for 2026-03...
PROVIDER COST CUR PRODUCTS
------------------------------------------------
aliyun 98765.43 CNY 65
tencentcloud 33618.72 CNY 12
aws 4332.39 USD 25
gcp 1287.64 USD 14
------------------------------------------------
TOTAL 132384.15 CNY
TOTAL 5620.03 USD
TUI Keyboard Shortcuts
| Key | Action |
|---|---|
j / k / ↑ / ↓ |
Navigate up/down |
Ctrl+f / Ctrl+b |
Page down/up |
g / G |
Jump to top/bottom |
Tab / h / l |
Switch provider tab |
← / → |
Previous/next month |
s / S |
Cycle sort column / toggle direction |
1–5 |
Sort by column # |
Enter |
Expand/collapse region details |
/ |
Search/filter |
Esc |
Clear filter |
r |
Refresh |
? |
Help |
q |
Quit |
Configuration
Environment Variables (single account)
| Provider | Variables |
|---|---|
| Aliyun | ALIBABA_CLOUD_ACCESS_KEY_ID ALIBABA_CLOUD_ACCESS_KEY_SECRET |
| AWS | AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY or ~/.aws/credentials |
| Tencent Cloud | TENCENTCLOUD_SECRET_ID TENCENTCLOUD_SECRET_KEY |
| Volcengine | VOLCENGINE_ACCESS_KEY_ID VOLCENGINE_SECRET_ACCESS_KEY |
| UCloud | UCLOUD_PUBLIC_KEY UCLOUD_PRIVATE_KEY UCLOUD_PROJECT_ID |
| GCP | GCP_PROJECT_ID + GCP_SERVICE_ACCOUNT_JSON |
| Cloudflare | CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN |
Multi-Account JSON (recommended)
Use <PROVIDER>_ACCOUNTS env vars for multi-account setups:
| Field | Type | Description |
|---|---|---|
id |
string | Unique account identifier |
name |
string | Display name |
access_key_id |
string? | Aliyun / AWS / Volcengine access key |
access_key_secret |
string? | Aliyun access key secret |
secret_access_key |
string? | AWS / Volcengine secret access key |
secret_id / secret_key |
string? | Tencent Cloud credentials |
public_key / private_key |
string? | UCloud credentials |
project_id |
string? | UCloud / GCP project ID |
region |
string? | Default region |
enabled |
bool | Include this account (default: true) |
SDK Usage
Unified Service (recommended)
use CloudBillingService;
async
Direct Provider Client
use AliyunBillingClient;
let client = new;
let resp = client.query_instance_bill.await?;
// Aliyun
new
.query_instance_bill
.query_account_bill
// AWS (Cost Explorer — forced us-east-1)
new
.get_cost_and_usage
// Tencent Cloud
new
.get_bill_summary
.get_bill_detail
// Volcengine
new
.list_bill_detail
// UCloud
new
.query_bill_list
// GCP
new
.list_billing_accounts
.query_billing_costs
// Cloudflare
new_with_token
.get_subscriptions
.get_all_billing_history
Data Model
BillingData
ProductCost
RegionDetail
Feature Flags
| Feature | Description |
|---|---|
aliyun |
Alibaba Cloud (default) |
tencentcloud |
Tencent Cloud (default) |
aws |
AWS Cost Explorer (default) |
volcengine |
Volcengine (default) |
ucloud |
UCloud (default) |
gcp |
Google Cloud (default) |
cloudflare |
Cloudflare (default) |
all-providers |
All of the above |
Skill (AI Integration)
Install the skill to give Claude full knowledge of all cbilling commands:
Once installed, Claude can query your cloud billing data directly:
claude> What's my total cloud spend this month?
claude> Which Aliyun services cost the most in March?
claude> Compare AWS costs between February and March
All commands output structured JSON (--format json) for AI-agent tool-calling.
Project Structure
cbilling/
src/ # Library crate
providers/ # One module per cloud provider
service.rs # Unified query API
models.rs # Shared data types
error.rs # Error types
crates/cbilling-cli/ # CLI + TUI binary
src/
views/ # TUI view components
widgets/ # Reusable TUI widgets
styles.rs # Semantic style system
scripts/ # install.sh, record-demo.sh
examples/ # Per-provider usage examples
License
Apache-2.0