@naturali/cli 0.123.0 → 0.124.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 +110 -8
  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.123.0";
17
+ var version = "0.124.0";
18
18
  //#endregion
19
19
  //#region ../sdk/src/generated/core/bodySerializer.gen.ts
20
20
  const serializeFormDataPair = (data, key, value) => {
@@ -3632,6 +3632,8 @@ var Projects = class {
3632
3632
  *
3633
3633
  * Every bucket also carries components — the amounts actually measured. The token counts describe LLM usage alone, so that is where a storage, api_request or compute_execution bucket reports its real quantity instead of zeroed token fields.
3634
3634
  *
3635
+ * The rollup can also be narrowed to one session or one end user before it is bucketed. That is the question no dimension answers: group_by splits the project's whole spend, so "what did this conversation cost, per day" and "what has this end user spent across every session" are reachable only by narrowing. The narrowings intersect, apply to the totals as well as the buckets, and are echoed back complete — null for each one not applied — because a rollup of zeros is otherwise indistinguishable from a project that spent nothing.
3636
+ *
3635
3637
  */
3636
3638
  static getProjectUsage(options) {
3637
3639
  return (options.client ?? client).get({
@@ -3815,7 +3817,7 @@ var Sessions = class {
3815
3817
  /**
3816
3818
  * Get a session
3817
3819
  *
3818
- * Returns details of a single session, including a `usage` roll-up of what its generations cost. The listing omits `usage`; for a window, or a split by day, model, agent, provider or run, read `GET /v1/projects/{project_id}/usage` instead.
3820
+ * Returns details of a single session, including a `usage` roll-up of what its generations cost. The listing omits `usage`; for a window, a split by day or model, or one end user across every session, narrow `GET /v1/projects/{project_id}/usage` with `session_id` / `actor_id` instead.
3819
3821
  */
3820
3822
  static getSession(options) {
3821
3823
  return (options.client ?? client).get({
@@ -4393,9 +4395,13 @@ var Users = class {
4393
4395
  *
4394
4396
  * Counted across the projects this account is the billing owner of, over the current UTC calendar month, from the meter itself. Archived projects are included: the runs they already made were made.
4395
4397
  *
4396
- * **Nothing is refused against this.** The allowance is published, not enforced — an account past it keeps running. What does stop a managed-model generation is a negative credit balance, which is `GET /v1/users/me/billing`.
4398
+ * **On the `free` plan the allowance is enforced.** An account that has used it is refused `403 plan_limit_reached` with `resource: "runs"` on everything that starts a generation — on its own provider credential as much as on a managed model, because a run is a run — until the billing month turns or it upgrades. On `pro` and `business` nothing is refused: runs past the allowance are billed at the overage rate those plans are sold with. A contract plan is not counted.
4399
+ *
4400
+ * The other thing that stops a managed-model generation is a negative credit balance, which is `GET /v1/users/me/billing`, and it never applies to your own credential.
4401
+ *
4402
+ * **This route counts live; the refusal reads a figure counted every few minutes.** So the two can differ by a burst: this is the more current number, and a refusal quotes the one it actually enforced.
4397
4403
  *
4398
- * This read is more expensive than the balance one: it asks the meter once per project. Poll it on the order of minutes, not seconds.
4404
+ * It is also more expensive than the balance read: it asks the meter once per project. Poll it on the order of minutes, not seconds.
4399
4405
  *
4400
4406
  */
4401
4407
  static getCurrentUserUsage(options) {
@@ -13576,13 +13582,25 @@ const routes = {
13576
13582
  "get-project-usage": {
13577
13583
  serviceClass: "Projects",
13578
13584
  operationId: "getProjectUsage",
13579
- description: "The per-project meter — the re-billing view (A11/C12/P3). Aggregates the project's usage over an optional [from, to] window, bucketed by a single dimension. Costs are the billing-grade cost_usd the runtime freezes at write time; null means nothing in the bucket was priced (never that it was free). Only managed providers are priced (on the runtime), so cost reflects managed usage; BYOK usage carries no LLM cost. Every bucket also carries components — the amounts actually measured. The token counts describe LLM usage alone, so that is where a storage, api_request or compute_execution bucket reports its real quantity instead of zeroed token fields.",
13585
+ description: "The per-project meter — the re-billing view (A11/C12/P3). Aggregates the project's usage over an optional [from, to] window, bucketed by a single dimension. Costs are the billing-grade cost_usd the runtime freezes at write time; null means nothing in the bucket was priced (never that it was free). Only managed providers are priced (on the runtime), so cost reflects managed usage; BYOK usage carries no LLM cost. Every bucket also carries components — the amounts actually measured. The token counts describe LLM usage alone, so that is where a storage, api_request or compute_execution bucket reports its real quantity instead of zeroed token fields. The rollup can also be narrowed to one session or one end user before it is bucketed. That is the question no dimension answers: group_by splits the project's whole spend, so \"what did this conversation cost, per day\" and \"what has this end user spent across every session\" are reachable only by narrowing. The narrowings intersect, apply to the totals as well as the buckets, and are echoed back complete — null for each one not applied — because a rollup of zeros is otherwise indistinguishable from a project that spent nothing.",
13580
13586
  moduleDocsUrl: "https://docs.naturali.ai/docs/modules/projects",
13581
13587
  httpMethod: "get",
13582
13588
  pathParams: ["project_id"],
13583
13589
  queryParams: [
13584
13590
  "group_by",
13585
13591
  "meter_type",
13592
+ "session_id",
13593
+ "actor_id",
13594
+ "agent_id",
13595
+ "ai_provider_id",
13596
+ "orchestration_run_id",
13597
+ "orchestration_id",
13598
+ "generation_id",
13599
+ "trace_id",
13600
+ "source",
13601
+ "trigger_id",
13602
+ "action_id",
13603
+ "include",
13586
13604
  "from",
13587
13605
  "to",
13588
13606
  "limit",
@@ -13598,7 +13616,7 @@ const routes = {
13598
13616
  },
13599
13617
  {
13600
13618
  "name": "group_by",
13601
- "description": "Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others on the matching id. `model` buckets on the model *and* the provider that served it, so one model name served by two providers is two groups (see `ai_provider_id`). `ai_provider` buckets on the provider the spend was billed against — a routed generation's serving target, or the agent's pinned provider — which is the total a per-provider reconciliation wants, without summing the model dimension by hand. `run` buckets on the orchestration run an event belongs to; work that runs no orchestration collapses into the single null bucket, so the bucket count there is not a count of runs.\n",
13619
+ "description": "Dimension to bucket by. `day` buckets on the event's UTC calendar day; the others on the matching id. `model` buckets on the model *and* the provider that served it, so one model name served by two providers is two groups (see `ai_provider_id`). `ai_provider` buckets on the provider the spend was billed against — a routed generation's serving target, or the agent's pinned provider — which is the total a per-provider reconciliation wants, without summing the model dimension by hand. `run` buckets on the orchestration run an event belongs to; work that runs no orchestration collapses into the single null bucket, so the bucket count there is not a count of runs. `session` and `actor` bucket on the conversation and the end user behind the spend — what a customer re-billing their own users charges each of them for; traffic with no end user behind it collapses into the single null bucket on both. `source` buckets on what the spend was incurred for (`eval`, `eval_judge`), which is how verification spend is told apart from the traffic serving real users; ordinary traffic carries no source and is the null bucket.\n",
13602
13620
  "required": false,
13603
13621
  "type": "string",
13604
13622
  "in": "query"
@@ -13610,6 +13628,90 @@ const routes = {
13610
13628
  "type": "string",
13611
13629
  "in": "query"
13612
13630
  },
13631
+ {
13632
+ "name": "session_id",
13633
+ "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",
13634
+ "required": false,
13635
+ "type": "string",
13636
+ "in": "query"
13637
+ },
13638
+ {
13639
+ "name": "actor_id",
13640
+ "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",
13641
+ "required": false,
13642
+ "type": "string",
13643
+ "in": "query"
13644
+ },
13645
+ {
13646
+ "name": "agent_id",
13647
+ "description": "Narrow to one agent's traffic, across every session, run and trigger that dispatched it.\n",
13648
+ "required": false,
13649
+ "type": "string",
13650
+ "in": "query"
13651
+ },
13652
+ {
13653
+ "name": "ai_provider_id",
13654
+ "description": "Narrow to the spend billed against one provider record — a routed generation's serving target, or the agent's pinned provider.\n",
13655
+ "required": false,
13656
+ "type": "string",
13657
+ "in": "query"
13658
+ },
13659
+ {
13660
+ "name": "orchestration_run_id",
13661
+ "description": "Narrow to the events one orchestration run metered.",
13662
+ "required": false,
13663
+ "type": "string",
13664
+ "in": "query"
13665
+ },
13666
+ {
13667
+ "name": "orchestration_id",
13668
+ "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",
13669
+ "required": false,
13670
+ "type": "string",
13671
+ "in": "query"
13672
+ },
13673
+ {
13674
+ "name": "generation_id",
13675
+ "description": "Narrow to one generation's events. A generation writes more than one when it meters several dimensions, such as tokens and compute.\n",
13676
+ "required": false,
13677
+ "type": "string",
13678
+ "in": "query"
13679
+ },
13680
+ {
13681
+ "name": "trace_id",
13682
+ "description": "Narrow to the events recorded under one trace.",
13683
+ "required": false,
13684
+ "type": "string",
13685
+ "in": "query"
13686
+ },
13687
+ {
13688
+ "name": "source",
13689
+ "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",
13690
+ "required": false,
13691
+ "type": "string",
13692
+ "in": "query"
13693
+ },
13694
+ {
13695
+ "name": "trigger_id",
13696
+ "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",
13697
+ "required": false,
13698
+ "type": "string",
13699
+ "in": "query"
13700
+ },
13701
+ {
13702
+ "name": "action_id",
13703
+ "description": "Narrow to one caller-supplied action label, for per-action spend. Matched as recorded, like trigger_id.\n",
13704
+ "required": false,
13705
+ "type": "string",
13706
+ "in": "query"
13707
+ },
13708
+ {
13709
+ "name": "include",
13710
+ "description": "Optional extras to compute. The only value is distinct, which adds the distinct object — one count per kind of entity the window touched. Opt-in because each counter costs the window another sort, so a caller who does not ask keeps the cheap response whatever the event table grows to. Any other value is a 400.\n",
13711
+ "required": false,
13712
+ "type": "string",
13713
+ "in": "query"
13714
+ },
13613
13715
  {
13614
13716
  "name": "from",
13615
13717
  "description": "Inclusive lower bound (ISO-8601) on event time. Omit for no lower bound.",
@@ -14122,7 +14224,7 @@ const routes = {
14122
14224
  "get-session": {
14123
14225
  serviceClass: "Sessions",
14124
14226
  operationId: "getSession",
14125
- description: "Returns details of a single session, including a `usage` roll-up of what its generations cost. The listing omits `usage`; for a window, or a split by day, model, agent, provider or run, read `GET /v1/projects/{project_id}/usage` instead.",
14227
+ description: "Returns details of a single session, including a `usage` roll-up of what its generations cost. The listing omits `usage`; for a window, a split by day or model, or one end user across every session, narrow `GET /v1/projects/{project_id}/usage` with `session_id` / `actor_id` instead.",
14126
14228
  moduleDocsUrl: "https://docs.naturali.ai/docs/modules/sessions",
14127
14229
  httpMethod: "get",
14128
14230
  pathParams: ["project_id", "session_id"],
@@ -15807,7 +15909,7 @@ const routes = {
15807
15909
  "get-current-user-usage": {
15808
15910
  serviceClass: "Users",
15809
15911
  operationId: "getCurrentUserUsage",
15810
- description: "How many runs the account has made this billing cycle, and how many its plan includes. A **run is one agent generation** — the unit every rung is priced in. Counted across the projects this account is the billing owner of, over the current UTC calendar month, from the meter itself. Archived projects are included: the runs they already made were made. **Nothing is refused against this.** The allowance is published, not enforced — an account past it keeps running. What does stop a managed-model generation is a negative credit balance, which is `GET /v1/users/me/billing`. This read is more expensive than the balance one: it asks the meter once per project. Poll it on the order of minutes, not seconds.",
15912
+ description: "How many runs the account has made this billing cycle, and how many its plan includes. A **run is one agent generation** — the unit every rung is priced in. Counted across the projects this account is the billing owner of, over the current UTC calendar month, from the meter itself. Archived projects are included: the runs they already made were made. **On the `free` plan the allowance is enforced.** An account that has used it is refused `403 plan_limit_reached` with `resource: \"runs\"` on everything that starts a generation — on its own provider credential as much as on a managed model, because a run is a run — until the billing month turns or it upgrades. On `pro` and `business` nothing is refused: runs past the allowance are billed at the overage rate those plans are sold with. A contract plan is not counted. The other thing that stops a managed-model generation is a negative credit balance, which is `GET /v1/users/me/billing`, and it never applies to your own credential. **This route counts live; the refusal reads a figure counted every few minutes.** So the two can differ by a burst: this is the more current number, and a refusal quotes the one it actually enforced. It is also more expensive than the balance read: it asks the meter once per project. Poll it on the order of minutes, not seconds.",
15811
15913
  moduleDocsUrl: "https://docs.naturali.ai/docs/modules/users",
15812
15914
  httpMethod: "get",
15813
15915
  pathParams: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturali/cli",
3
- "version": "0.123.0",
3
+ "version": "0.124.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.123.0"
33
+ "@naturali/sdk": "0.124.0"
34
34
  },
35
35
  "scripts": {
36
36
  "generate": "tsx scripts/generate.ts",