{"id":51848043,"url":"https://github.com/oratis/cn-cloud-billing","last_synced_at":"2026-07-23T15:01:24.426Z","repository":{"id":368829869,"uuid":"1287055152","full_name":"oratis/cn-cloud-billing","owner":"oratis","description":"One typed API for Alibaba Cloud, Tencent Cloud \u0026 Volcano Engine monthly bills — normalized summary + per-resource detail. Bring your own keys.","archived":false,"fork":false,"pushed_at":"2026-07-02T10:47:45.000Z","size":38,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-02T12:26:31.290Z","etag":null,"topics":["alibaba-cloud","aliyun","billing","china","cloud-cost","cost-management","finops","tencent-cloud","typescript","volcengine"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/oratis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-07-02T10:37:32.000Z","updated_at":"2026-07-02T10:47:49.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/oratis/cn-cloud-billing","commit_stats":null,"previous_names":["oratis/cn-cloud-billing"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/oratis/cn-cloud-billing","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oratis%2Fcn-cloud-billing","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oratis%2Fcn-cloud-billing/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oratis%2Fcn-cloud-billing/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oratis%2Fcn-cloud-billing/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/oratis","download_url":"https://codeload.github.com/oratis/cn-cloud-billing/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/oratis%2Fcn-cloud-billing/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35805966,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-23T02:00:06.683Z","response_time":57,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alibaba-cloud","aliyun","billing","china","cloud-cost","cost-management","finops","tencent-cloud","typescript","volcengine"],"created_at":"2026-07-23T15:01:23.728Z","updated_at":"2026-07-23T15:01:24.418Z","avatar_url":"https://github.com/oratis.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# cn-cloud-billing\n\n[![npm version](https://img.shields.io/npm/v/cn-cloud-billing.svg)](https://www.npmjs.com/package/cn-cloud-billing)\n[![CI](https://github.com/oratis/cn-cloud-billing/actions/workflows/ci.yml/badge.svg)](https://github.com/oratis/cn-cloud-billing/actions/workflows/ci.yml)\n[![license](https://img.shields.io/npm/l/cn-cloud-billing.svg)](./LICENSE)\n\n**One typed API for Alibaba Cloud, Tencent Cloud and Volcano Engine monthly bills.**\n\nEach Chinese cloud ships its own billing API with different auth, shapes, pagination and quirks. `cn-cloud-billing` puts all three behind a single call and hands you **normalized rows** — monthly totals by product, or per-resource detail with region and resource id. Bring your own access keys; it imposes **no categorization or cost attribution** — just the numbers, normalized.\n\n```bash\nnpm i cn-cloud-billing\n```\n\n## Quick start\n\n```ts\nimport { CnBilling } from \"cn-cloud-billing\";\n\nconst billing = new CnBilling({\n  aliyun:  { accessKeyId: process.env.ALI_AK!,   accessKeySecret: process.env.ALI_SK! },\n  tencent: { secretId:    process.env.TC_ID!,    secretKey:       process.env.TC_KEY! },\n  volcano: { accessKeyId: process.env.VOLC_AK!,  secretAccessKey: process.env.VOLC_SK! },\n});\n\n// Monthly totals by product, across all three clouds:\nconst summary = await billing.getMonthlySummary(\"2026-05\");\n// → [{ provider: \"aliyun\", month: \"2026-05\", product: \"ECS\", amount: 1234.5, currency: \"CNY\" }, ...]\n\n// Per-resource detail (region + resourceId where the API exposes them):\nconst detail = await billing.getMonthlyDetail(\"2026-05\");\n// → [{ provider: \"volcano\", month: \"2026-05\", product: \"GPU_Server\",\n//      region: \"cn-beijing\", resourceId: \"i-abc…\", amount: 88.0, currency: \"CNY\" }, ...]\n```\n\nQuery one cloud in isolation:\n\n```ts\nconst rows = await billing.provider(\"tencent\").getMonthlyDetail(\"2026-05\");\n```\n\n## Normalized shape\n\nEvery row is a [`BillRow`](./src/types.ts):\n\n```ts\ninterface BillRow {\n  provider: \"aliyun\" | \"tencent\" | \"volcano\";\n  month: string;        // \"YYYY-MM\"\n  product: string;      // provider's product / business name\n  region?: string;      // detail only\n  resourceId?: string;  // detail only\n  amount: number;       // payable / real cost in `currency`\n  currency: string;     // e.g. \"CNY\"\n  raw?: unknown;        // original provider line, with { includeRaw: true }\n}\n```\n\n`amount` maps to each provider's payable cost — Aliyun `PretaxAmount`, Tencent Σ`ComponentSet.RealCost`, Volcano `PayableAmount`.\n\n## What it handles for you\n\n- **Auth \u0026 signing** — official SDKs for Aliyun/Tencent; Volcano is driven through `@volcengine/openapi`'s signer (no maintained Node billing SDK exists).\n- **Pagination** — Aliyun `NextToken`, Tencent `Offset`, Volcano `Offset` (including the case where Volcano returns `Total = -1` and you must stop on a short page).\n- **Quirks** — Volcano detail needs `GroupPeriod = 1`; Tencent detail cost is the sum of a row's `ComponentSet`.\n\n## Credentials\n\n| Provider | Fields | Needs |\n| --- | --- | --- |\n| `aliyun` | `accessKeyId`, `accessKeySecret` | BssOpenApi read access |\n| `tencent` | `secretId`, `secretKey` | `DescribeBillSummaryByProduct` / `DescribeBillDetail` |\n| `volcano` | `accessKeyId`, `secretAccessKey` | `ListBillOverviewByProd` / `ListBillDetail` |\n\nConfigure only the clouds you use — pass one, two, or all three.\n\n## Notes\n\n- Amounts are in each account's **settlement currency** (typically `CNY`); this library does no FX conversion (pair it with [`monthly-fx`](https://www.npmjs.com/package/monthly-fx) if you need USD).\n- This is an independent client and is not affiliated with Alibaba, Tencent or Volcano Engine.\n\n## License\n\n[MIT](./LICENSE) © [oratis](https://github.com/oratis)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foratis%2Fcn-cloud-billing","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foratis%2Fcn-cloud-billing","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foratis%2Fcn-cloud-billing/lists"}