@naturali/cli 0.125.0 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.mjs +192 -1
  2. package/package.json +2 -2
package/dist/index.mjs CHANGED
@@ -14,7 +14,7 @@ var __exportAll = (all, no_symbols) => {
14
14
  };
15
15
  //#endregion
16
16
  //#region package.json
17
- var version = "0.125.0";
17
+ var version = "0.126.0";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const serializeFormDataPair = (data, key, value) => {
@@ -3665,6 +3665,34 @@ var Projects = class {
3665
3665
  ...options
3666
3666
  });
3667
3667
  }
3668
+ /**
3669
+ * List project usage events
3670
+ *
3671
+ * The rows a rollup summed — one per metered occurrence, most recent first. Takes the same narrowings [the meter](/docs/api/projects/get-project-usage) does, so a query that produced a bucket answers here unchanged and reads back what went into it. This is the audit and reconciliation view: what was measured, when, against which agent, session, actor and provider, and what each component was priced at.
3672
+ *
3673
+ * An id naming nothing in this project yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.
3674
+ *
3675
+ */
3676
+ static listProjectUsageEvents(options) {
3677
+ return (options.client ?? client).get({
3678
+ url: "/v1/projects/{project_id}/usage/events",
3679
+ ...options
3680
+ });
3681
+ }
3682
+ /**
3683
+ * Get a generation or orchestration-run billing receipt
3684
+ *
3685
+ * What one occurrence was billed, line by line: per-event line items with their measured components and unit prices, a per-meter-type split, and the totals. Pass generation_id for one generation, or orchestration_run_id for a receipt summed across every event the run metered. Exactly one of the two is required.
3686
+ *
3687
+ * This is the itemisation behind a single number — where [the meter](/docs/api/projects/get-project-usage) says a window cost $12.40, a receipt says which components of which call made up one occurrence of it. On an orchestration-run receipt every line carries node_id, so grouping by it gives the per-node cost the total hides; a retried node contributes one line per attempt, which is the intended reading for spend.
3688
+ *
3689
+ */
3690
+ static getProjectUsageReceipt(options) {
3691
+ return (options.client ?? client).get({
3692
+ url: "/v1/projects/{project_id}/usage/receipt",
3693
+ ...options
3694
+ });
3695
+ }
3668
3696
  };
3669
3697
  var Quotas = class {
3670
3698
  /**
@@ -13771,6 +13799,169 @@ const routes = {
13771
13799
  }
13772
13800
  ]
13773
13801
  },
13802
+ "list-project-usage-events": {
13803
+ serviceClass: "Projects",
13804
+ operationId: "listProjectUsageEvents",
13805
+ description: "The rows a rollup summed — one per metered occurrence, most recent first. Takes the same narrowings [the meter](/docs/api/projects/get-project-usage) does, so a query that produced a bucket answers here unchanged and reads back what went into it. This is the audit and reconciliation view: what was measured, when, against which agent, session, actor and provider, and what each component was priced at. An id naming nothing in this project yields an empty page rather than dropping the filter, so a mistyped narrowing can never widen the list past what was asked for.",
13806
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
13807
+ httpMethod: "get",
13808
+ pathParams: ["project_id"],
13809
+ queryParams: [
13810
+ "meter_type",
13811
+ "session_id",
13812
+ "actor_id",
13813
+ "agent_id",
13814
+ "ai_provider_id",
13815
+ "orchestration_run_id",
13816
+ "orchestration_id",
13817
+ "generation_id",
13818
+ "trace_id",
13819
+ "source",
13820
+ "trigger_id",
13821
+ "action_id",
13822
+ "limit",
13823
+ "offset"
13824
+ ],
13825
+ flags: [
13826
+ {
13827
+ "name": "project_id",
13828
+ "description": "Project public ID (proj_ prefix).",
13829
+ "required": true,
13830
+ "type": "string",
13831
+ "in": "path"
13832
+ },
13833
+ {
13834
+ "name": "meter_type",
13835
+ "description": "Narrow the rollup to one meter type (llm_tokens, compute_execution, api_request, storage). Omit to include every meter. Useful with group_by=model, whose dimension otherwise mixes model ids with platform SKUs. An unrecognized value yields an empty rollup, not an error.\n",
13836
+ "required": false,
13837
+ "type": "string",
13838
+ "in": "query"
13839
+ },
13840
+ {
13841
+ "name": "session_id",
13842
+ "description": "Narrow the whole rollup — every bucket and the top-level totals alike — to one session's traffic. Combines with group_by: group_by=day&session_id=... is one conversation's spend per day, group_by=model the same spend split by model. This is the figure behind the usage roll-up a single session read carries, broken down. An id naming no session in this project yields an empty rollup, never the project total.\n",
13843
+ "required": false,
13844
+ "type": "string",
13845
+ "in": "query"
13846
+ },
13847
+ {
13848
+ "name": "actor_id",
13849
+ "description": "The same narrowing, for one end user across every session they appear in — what a customer re-billing their own users charges each of them for. An id naming no actor in this project yields an empty rollup, never the project total.\n",
13850
+ "required": false,
13851
+ "type": "string",
13852
+ "in": "query"
13853
+ },
13854
+ {
13855
+ "name": "agent_id",
13856
+ "description": "Narrow to one agent's traffic, across every session, run and trigger that dispatched it.\n",
13857
+ "required": false,
13858
+ "type": "string",
13859
+ "in": "query"
13860
+ },
13861
+ {
13862
+ "name": "ai_provider_id",
13863
+ "description": "Narrow to the spend billed against one provider record — a routed generation's serving target, or the agent's pinned provider.\n",
13864
+ "required": false,
13865
+ "type": "string",
13866
+ "in": "query"
13867
+ },
13868
+ {
13869
+ "name": "orchestration_run_id",
13870
+ "description": "Narrow to the events one orchestration run metered.",
13871
+ "required": false,
13872
+ "type": "string",
13873
+ "in": "query"
13874
+ },
13875
+ {
13876
+ "name": "orchestration_id",
13877
+ "description": "Narrow to the runs of one orchestration — the ones it started itself, never the subtree a loop or sub-orchestration node started under it, which is metered against the child orchestration where it was incurred. Additive: summed across a project's orchestrations the figures reach the project total exactly once.\n",
13878
+ "required": false,
13879
+ "type": "string",
13880
+ "in": "query"
13881
+ },
13882
+ {
13883
+ "name": "generation_id",
13884
+ "description": "Narrow to one generation's events. A generation writes more than one when it meters several dimensions, such as tokens and compute.\n",
13885
+ "required": false,
13886
+ "type": "string",
13887
+ "in": "query"
13888
+ },
13889
+ {
13890
+ "name": "trace_id",
13891
+ "description": "Narrow to the events recorded under one trace.",
13892
+ "required": false,
13893
+ "type": "string",
13894
+ "in": "query"
13895
+ },
13896
+ {
13897
+ "name": "source",
13898
+ "description": "Narrow by what the spend was incurred for — eval and eval_judge are verification spend. Ordinary traffic carries no source, so it cannot be selected by this filter; omit the filter for everything.\n",
13899
+ "required": false,
13900
+ "type": "string",
13901
+ "in": "query"
13902
+ },
13903
+ {
13904
+ "name": "trigger_id",
13905
+ "description": "Narrow to the spend one trigger initiated. Matched as recorded rather than resolved, so it still selects the spend of a trigger that has since been deleted.\n",
13906
+ "required": false,
13907
+ "type": "string",
13908
+ "in": "query"
13909
+ },
13910
+ {
13911
+ "name": "action_id",
13912
+ "description": "Narrow to one caller-supplied action label, for per-action spend. Matched as recorded, like trigger_id.\n",
13913
+ "required": false,
13914
+ "type": "string",
13915
+ "in": "query"
13916
+ },
13917
+ {
13918
+ "name": "limit",
13919
+ "description": "Maximum number of events to return. A value above 100 is refused rather than clamped, so a caller paging by their own stride never silently skips a row.\n",
13920
+ "required": false,
13921
+ "type": "integer",
13922
+ "in": "query"
13923
+ },
13924
+ {
13925
+ "name": "offset",
13926
+ "description": "Number of events to skip.",
13927
+ "required": false,
13928
+ "type": "integer",
13929
+ "in": "query"
13930
+ }
13931
+ ]
13932
+ },
13933
+ "get-project-usage-receipt": {
13934
+ serviceClass: "Projects",
13935
+ operationId: "getProjectUsageReceipt",
13936
+ description: "What one occurrence was billed, line by line: per-event line items with their measured components and unit prices, a per-meter-type split, and the totals. Pass generation_id for one generation, or orchestration_run_id for a receipt summed across every event the run metered. Exactly one of the two is required. This is the itemisation behind a single number — where [the meter](/docs/api/projects/get-project-usage) says a window cost $12.40, a receipt says which components of which call made up one occurrence of it. On an orchestration-run receipt every line carries node_id, so grouping by it gives the per-node cost the total hides; a retried node contributes one line per attempt, which is the intended reading for spend.",
13937
+ moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
13938
+ httpMethod: "get",
13939
+ pathParams: ["project_id"],
13940
+ queryParams: ["generation_id", "orchestration_run_id"],
13941
+ flags: [
13942
+ {
13943
+ "name": "project_id",
13944
+ "description": "Project public ID (proj_ prefix).",
13945
+ "required": true,
13946
+ "type": "string",
13947
+ "in": "path"
13948
+ },
13949
+ {
13950
+ "name": "generation_id",
13951
+ "description": "Generation public ID. Mutually exclusive with orchestration_run_id.\n",
13952
+ "required": false,
13953
+ "type": "string",
13954
+ "in": "query"
13955
+ },
13956
+ {
13957
+ "name": "orchestration_run_id",
13958
+ "description": "Orchestration run public ID. Returns the receipt summed across every generation the run metered. Mutually exclusive with generation_id.\n",
13959
+ "required": false,
13960
+ "type": "string",
13961
+ "in": "query"
13962
+ }
13963
+ ]
13964
+ },
13774
13965
  "list-quotas": {
13775
13966
  serviceClass: "Quotas",
13776
13967
  operationId: "listQuotas",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.125.0",
3
+ "version": "0.126.0",
4
4
  "description": "Command-line interface for the naturali.ai API, generated from its OpenAPI specs",
5
5
  "type": "module",
6
6
  "bin": {
@@ -30,7 +30,7 @@
30
30
  "tsx": "^4.23.1",
31
31
  "typescript": "~6.0.3",
32
32
  "vitest": "^4.1.10",
33
- "@naturali/sdk": "0.125.0"
33
+ "@naturali/sdk": "0.126.0"
34
34
  },
35
35
  "scripts": {
36
36
  "generate": "tsx scripts/generate.ts",