@leaflow/sdk 0.0.0-dev.369.g4b81cd7 → 0.0.0-dev.373.gac63f82

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.
@@ -501,13 +501,13 @@ export type setProjectAssignmentResponseError = setProjectAssignmentResponseDefa
501
501
  export type setProjectAssignmentResponse = setProjectAssignmentResponseSuccess | setProjectAssignmentResponseError;
502
502
  export declare const getSetProjectAssignmentUrl: (projectId: string) => string;
503
503
  /**
504
- * Links the project to another billing account. Charges already incurred stay with the account linked when they
505
- * occurred and are invoiced to it; metered resources are settled up to the moment of the change. Amounts the
506
- * previous account owes do not prevent the change. Orders keep the account they were placed with; paid periods
507
- * are unaffected, and renewals are charged to the new account.
504
+ * Links the project to a billing account. A project without one is linked directly. Moving it to another
505
+ * account has the same requirements as unlinking: you own both accounts, the project has no metered resources,
506
+ * no subscriptions that have not ended and no orders in progress, and the current account has no unpaid
507
+ * invoices. Nothing moves with the project; charges already incurred stay with the account linked when they
508
+ * occurred.
508
509
  *
509
- * Refused once the project no longer accepts purchases because it is being deleted, and while a subscription or
510
- * an in-progress order of the project uses a currency other than the new account's.
510
+ * Refused once the project no longer accepts purchases because it is being deleted.
511
511
  * @summary Set project assignment
512
512
  */
513
513
  export declare const setProjectAssignment: (projectId: string, setProjectAssignmentRequest: SetProjectAssignmentRequest, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<setProjectAssignmentResponse>;
@@ -528,7 +528,7 @@ export type unlinkProjectBillingAccountResponseError = unlinkProjectBillingAccou
528
528
  export type unlinkProjectBillingAccountResponse = unlinkProjectBillingAccountResponseSuccess | unlinkProjectBillingAccountResponseError;
529
529
  export declare const getUnlinkProjectBillingAccountUrl: (projectId: string) => string;
530
530
  /**
531
- * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes; orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual; amounts it owes do not prevent unlinking. The project cannot make purchases until a billing account is linked again.
531
+ * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes, and the billing account has no unpaid invoices; invoices of orders awaiting payment do not count. Orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual. The project cannot make purchases until a billing account is linked again.
532
532
  * @summary Unlink project billing account
533
533
  */
534
534
  export declare const unlinkProjectBillingAccount: (projectId: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<unlinkProjectBillingAccountResponse>;
@@ -529,13 +529,13 @@ export const getSetProjectAssignmentUrl = (projectId) => {
529
529
  return `https://billing.leaflow.cloud/api/v1/assignments/${encodeURIComponent(String(projectId))}`;
530
530
  };
531
531
  /**
532
- * Links the project to another billing account. Charges already incurred stay with the account linked when they
533
- * occurred and are invoiced to it; metered resources are settled up to the moment of the change. Amounts the
534
- * previous account owes do not prevent the change. Orders keep the account they were placed with; paid periods
535
- * are unaffected, and renewals are charged to the new account.
532
+ * Links the project to a billing account. A project without one is linked directly. Moving it to another
533
+ * account has the same requirements as unlinking: you own both accounts, the project has no metered resources,
534
+ * no subscriptions that have not ended and no orders in progress, and the current account has no unpaid
535
+ * invoices. Nothing moves with the project; charges already incurred stay with the account linked when they
536
+ * occurred.
536
537
  *
537
- * Refused once the project no longer accepts purchases because it is being deleted, and while a subscription or
538
- * an in-progress order of the project uses a currency other than the new account's.
538
+ * Refused once the project no longer accepts purchases because it is being deleted.
539
539
  * @summary Set project assignment
540
540
  */
541
541
  export const setProjectAssignment = async (projectId, setProjectAssignmentRequest, options, fetchFn) => {
@@ -568,7 +568,7 @@ export const getUnlinkProjectBillingAccountUrl = (projectId) => {
568
568
  return `https://billing.leaflow.cloud/api/v1/assignments/${encodeURIComponent(String(projectId))}`;
569
569
  };
570
570
  /**
571
- * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes; orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual; amounts it owes do not prevent unlinking. The project cannot make purchases until a billing account is linked again.
571
+ * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes, and the billing account has no unpaid invoices; invoices of orders awaiting payment do not count. Orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual. The project cannot make purchases until a billing account is linked again.
572
572
  * @summary Unlink project billing account
573
573
  */
574
574
  export const unlinkProjectBillingAccount = async (projectId, options, fetchFn) => {
@@ -242,13 +242,13 @@ export declare const GetProjectAssignmentParams: zod.ZodObject<{
242
242
  projectId: zod.ZodUUID;
243
243
  }, zod.z.core.$strict>;
244
244
  /**
245
- * Links the project to another billing account. Charges already incurred stay with the account linked when they
246
- * occurred and are invoiced to it; metered resources are settled up to the moment of the change. Amounts the
247
- * previous account owes do not prevent the change. Orders keep the account they were placed with; paid periods
248
- * are unaffected, and renewals are charged to the new account.
245
+ * Links the project to a billing account. A project without one is linked directly. Moving it to another
246
+ * account has the same requirements as unlinking: you own both accounts, the project has no metered resources,
247
+ * no subscriptions that have not ended and no orders in progress, and the current account has no unpaid
248
+ * invoices. Nothing moves with the project; charges already incurred stay with the account linked when they
249
+ * occurred.
249
250
  *
250
- * Refused once the project no longer accepts purchases because it is being deleted, and while a subscription or
251
- * an in-progress order of the project uses a currency other than the new account's.
251
+ * Refused once the project no longer accepts purchases because it is being deleted.
252
252
  * @summary Set project assignment
253
253
  */
254
254
  export declare const SetProjectAssignmentParams: zod.ZodObject<{
@@ -258,7 +258,7 @@ export declare const SetProjectAssignmentBody: zod.ZodObject<{
258
258
  billing_account_id: zod.ZodInt;
259
259
  }, zod.z.core.$strict>;
260
260
  /**
261
- * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes; orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual; amounts it owes do not prevent unlinking. The project cannot make purchases until a billing account is linked again.
261
+ * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes, and the billing account has no unpaid invoices; invoices of orders awaiting payment do not count. Orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual. The project cannot make purchases until a billing account is linked again.
262
262
  * @summary Unlink project billing account
263
263
  */
264
264
  export declare const UnlinkProjectBillingAccountParams: zod.ZodObject<{
@@ -293,13 +293,13 @@ export const GetProjectAssignmentParams = zod.strictObject({
293
293
  projectId: zod.uuid(),
294
294
  });
295
295
  /**
296
- * Links the project to another billing account. Charges already incurred stay with the account linked when they
297
- * occurred and are invoiced to it; metered resources are settled up to the moment of the change. Amounts the
298
- * previous account owes do not prevent the change. Orders keep the account they were placed with; paid periods
299
- * are unaffected, and renewals are charged to the new account.
296
+ * Links the project to a billing account. A project without one is linked directly. Moving it to another
297
+ * account has the same requirements as unlinking: you own both accounts, the project has no metered resources,
298
+ * no subscriptions that have not ended and no orders in progress, and the current account has no unpaid
299
+ * invoices. Nothing moves with the project; charges already incurred stay with the account linked when they
300
+ * occurred.
300
301
  *
301
- * Refused once the project no longer accepts purchases because it is being deleted, and while a subscription or
302
- * an in-progress order of the project uses a currency other than the new account's.
302
+ * Refused once the project no longer accepts purchases because it is being deleted.
303
303
  * @summary Set project assignment
304
304
  */
305
305
  export const SetProjectAssignmentParams = zod.strictObject({
@@ -307,7 +307,7 @@ export const SetProjectAssignmentParams = zod.strictObject({
307
307
  });
308
308
  export const SetProjectAssignmentBody = SetProjectAssignmentRequest;
309
309
  /**
310
- * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes; orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual; amounts it owes do not prevent unlinking. The project cannot make purchases until a billing account is linked again.
310
+ * Ends the project's current assignment; the assignment history is kept. Allowed only when the project has no metered resources, no subscriptions that have not ended and no orders in progress, including period-end changes, and the billing account has no unpaid invoices; invoices of orders awaiting payment do not count. Orders are not modified, so wait for them to complete. Charges already incurred stay with the billing account and are invoiced as usual. The project cannot make purchases until a billing account is linked again.
311
311
  * @summary Unlink project billing account
312
312
  */
313
313
  export const UnlinkProjectBillingAccountParams = zod.strictObject({
@@ -417,7 +417,7 @@ export declare const RequestResourceUsageSource: {
417
417
  };
418
418
  export interface RequestResource {
419
419
  /**
420
- * Null for a request made by an internal service directly for the project.
420
+ * Null for a request that did not come through one of the project's API keys.
421
421
  * @nullable
422
422
  */
423
423
  api_key_id: string | null;
@@ -437,6 +437,12 @@ export interface RequestResource {
437
437
  output_tokens: number;
438
438
  reasoning_tokens: number;
439
439
  retries: number;
440
+ /**
441
+ * Who made the request. `api_key` means one of the project's API keys and `project_token` a project access token on the OpenAI-compatible endpoints; any other value names the Leaflow service that made it on the project's behalf, such as `assistant`, and more services may appear. Null for requests recorded before sources were tracked
442
+ * @maxLength 64
443
+ * @nullable
444
+ */
445
+ source: string | null;
440
446
  started_at: string;
441
447
  status: RequestResourceStatus;
442
448
  stream: boolean;
@@ -3631,6 +3637,12 @@ export type ListRequestsParams = {
3631
3637
  * Restricts the result to the specified status
3632
3638
  */
3633
3639
  status?: ListRequestsStatus;
3640
+ /**
3641
+ * Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded
3642
+ * @minLength 1
3643
+ * @maxLength 64
3644
+ */
3645
+ source?: string;
3634
3646
  /**
3635
3647
  * Items returned in this page. Defaults to 50; at most 200.
3636
3648
  * @minimum 1
@@ -3705,6 +3717,12 @@ export type ListUsageByModelParams = {
3705
3717
  * Restricts the result to the specified status
3706
3718
  */
3707
3719
  status?: ListUsageByModelStatus;
3720
+ /**
3721
+ * Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded
3722
+ * @minLength 1
3723
+ * @maxLength 64
3724
+ */
3725
+ source?: string;
3708
3726
  };
3709
3727
  export type ListUsageByModelStatus = (typeof ListUsageByModelStatus)[keyof typeof ListUsageByModelStatus];
3710
3728
  export declare const ListUsageByModelStatus: {
@@ -3736,6 +3754,12 @@ export type GetUsageSummaryParams = {
3736
3754
  * Restricts the result to the specified status
3737
3755
  */
3738
3756
  status?: GetUsageSummaryStatus;
3757
+ /**
3758
+ * Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded
3759
+ * @minLength 1
3760
+ * @maxLength 64
3761
+ */
3762
+ source?: string;
3739
3763
  };
3740
3764
  export type GetUsageSummaryStatus = (typeof GetUsageSummaryStatus)[keyof typeof GetUsageSummaryStatus];
3741
3765
  export declare const GetUsageSummaryStatus: {
@@ -3767,6 +3791,12 @@ export type GetUsageTimelineParams = {
3767
3791
  * Restricts the result to the specified status
3768
3792
  */
3769
3793
  status?: GetUsageTimelineStatus;
3794
+ /**
3795
+ * Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded
3796
+ * @minLength 1
3797
+ * @maxLength 64
3798
+ */
3799
+ source?: string;
3770
3800
  /**
3771
3801
  * The length of each bucket, written as a duration such as 1h or 24h. The number of buckets is limited to 100
3772
3802
  * @maxLength 16
@@ -221,6 +221,7 @@ export declare const GetModelParams: zod.ZodObject<{
221
221
  * @summary List request records
222
222
  */
223
223
  export declare const listRequestsQueryModelIdMax = 128;
224
+ export declare const listRequestsQuerySourceMax = 64;
224
225
  export declare const listRequestsQueryLimitDefault = 50;
225
226
  export declare const listRequestsQueryLimitMax = 200;
226
227
  export declare const listRequestsQueryCursorMax = 1024;
@@ -236,6 +237,7 @@ export declare const ListRequestsQueryParams: zod.ZodObject<{
236
237
  upstream_failed: "upstream_failed";
237
238
  client_aborted: "client_aborted";
238
239
  }>>;
240
+ source: zod.ZodOptional<zod.ZodString>;
239
241
  limit: zod.ZodDefault<zod.ZodInt>;
240
242
  cursor: zod.ZodOptional<zod.ZodString>;
241
243
  }, zod.z.core.$strict>;
@@ -282,6 +284,7 @@ export declare const ListUsageByApiKeyQueryParams: zod.ZodObject<{
282
284
  * @summary Get usage by model
283
285
  */
284
286
  export declare const listUsageByModelQueryModelIdMax = 128;
287
+ export declare const listUsageByModelQuerySourceMax = 64;
285
288
  export declare const ListUsageByModelQueryParams: zod.ZodObject<{
286
289
  from: zod.z.ZodISODateTime;
287
290
  to: zod.z.ZodISODateTime;
@@ -294,6 +297,7 @@ export declare const ListUsageByModelQueryParams: zod.ZodObject<{
294
297
  upstream_failed: "upstream_failed";
295
298
  client_aborted: "client_aborted";
296
299
  }>>;
300
+ source: zod.ZodOptional<zod.ZodString>;
297
301
  }, zod.z.core.$strict>;
298
302
  /**
299
303
  * `from` and `to` are required and may span no more than 31 days. Both carry a timezone offset, so `2026-08-01T00:00:00+08:00` starts at that instant in UTC+8.
@@ -302,6 +306,7 @@ export declare const ListUsageByModelQueryParams: zod.ZodObject<{
302
306
  * @summary Get total usage
303
307
  */
304
308
  export declare const getUsageSummaryQueryModelIdMax = 128;
309
+ export declare const getUsageSummaryQuerySourceMax = 64;
305
310
  export declare const GetUsageSummaryQueryParams: zod.ZodObject<{
306
311
  from: zod.z.ZodISODateTime;
307
312
  to: zod.z.ZodISODateTime;
@@ -314,6 +319,7 @@ export declare const GetUsageSummaryQueryParams: zod.ZodObject<{
314
319
  upstream_failed: "upstream_failed";
315
320
  client_aborted: "client_aborted";
316
321
  }>>;
322
+ source: zod.ZodOptional<zod.ZodString>;
317
323
  }, zod.z.core.$strict>;
318
324
  /**
319
325
  * Divided into buckets of `bucket`, starting at `from`. The final bucket may be partial, and the number of buckets is limited to 100.
@@ -322,6 +328,7 @@ export declare const GetUsageSummaryQueryParams: zod.ZodObject<{
322
328
  * @summary Get a usage series
323
329
  */
324
330
  export declare const getUsageTimelineQueryModelIdMax = 128;
331
+ export declare const getUsageTimelineQuerySourceMax = 64;
325
332
  export declare const getUsageTimelineQueryBucketDefault = "1h";
326
333
  export declare const getUsageTimelineQueryBucketMax = 16;
327
334
  export declare const GetUsageTimelineQueryParams: zod.ZodObject<{
@@ -336,5 +343,6 @@ export declare const GetUsageTimelineQueryParams: zod.ZodObject<{
336
343
  upstream_failed: "upstream_failed";
337
344
  client_aborted: "client_aborted";
338
345
  }>>;
346
+ source: zod.ZodOptional<zod.ZodString>;
339
347
  bucket: zod.ZodDefault<zod.ZodString>;
340
348
  }, zod.z.core.$strict>;
@@ -198,6 +198,7 @@ export const GetModelParams = zod.strictObject({
198
198
  * @summary List request records
199
199
  */
200
200
  export const listRequestsQueryModelIdMax = 128;
201
+ export const listRequestsQuerySourceMax = 64;
201
202
  export const listRequestsQueryLimitDefault = 50;
202
203
  export const listRequestsQueryLimitMax = 200;
203
204
  export const listRequestsQueryCursorMax = 1024;
@@ -218,6 +219,12 @@ export const ListRequestsQueryParams = zod.strictObject({
218
219
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
219
220
  .optional()
220
221
  .describe("Restricts the result to the specified status"),
222
+ source: zod
223
+ .string()
224
+ .min(1)
225
+ .max(listRequestsQuerySourceMax)
226
+ .optional()
227
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
221
228
  limit: zod
222
229
  .int()
223
230
  .min(1)
@@ -271,6 +278,7 @@ export const ListUsageByApiKeyQueryParams = zod.strictObject({
271
278
  * @summary Get usage by model
272
279
  */
273
280
  export const listUsageByModelQueryModelIdMax = 128;
281
+ export const listUsageByModelQuerySourceMax = 64;
274
282
  export const ListUsageByModelQueryParams = zod.strictObject({
275
283
  from: zod.iso
276
284
  .datetime({ offset: true })
@@ -288,6 +296,12 @@ export const ListUsageByModelQueryParams = zod.strictObject({
288
296
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
289
297
  .optional()
290
298
  .describe("Restricts the result to the specified status"),
299
+ source: zod
300
+ .string()
301
+ .min(1)
302
+ .max(listUsageByModelQuerySourceMax)
303
+ .optional()
304
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
291
305
  });
292
306
  /**
293
307
  * `from` and `to` are required and may span no more than 31 days. Both carry a timezone offset, so `2026-08-01T00:00:00+08:00` starts at that instant in UTC+8.
@@ -296,6 +310,7 @@ export const ListUsageByModelQueryParams = zod.strictObject({
296
310
  * @summary Get total usage
297
311
  */
298
312
  export const getUsageSummaryQueryModelIdMax = 128;
313
+ export const getUsageSummaryQuerySourceMax = 64;
299
314
  export const GetUsageSummaryQueryParams = zod.strictObject({
300
315
  from: zod.iso
301
316
  .datetime({ offset: true })
@@ -313,6 +328,12 @@ export const GetUsageSummaryQueryParams = zod.strictObject({
313
328
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
314
329
  .optional()
315
330
  .describe("Restricts the result to the specified status"),
331
+ source: zod
332
+ .string()
333
+ .min(1)
334
+ .max(getUsageSummaryQuerySourceMax)
335
+ .optional()
336
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
316
337
  });
317
338
  /**
318
339
  * Divided into buckets of `bucket`, starting at `from`. The final bucket may be partial, and the number of buckets is limited to 100.
@@ -321,6 +342,7 @@ export const GetUsageSummaryQueryParams = zod.strictObject({
321
342
  * @summary Get a usage series
322
343
  */
323
344
  export const getUsageTimelineQueryModelIdMax = 128;
345
+ export const getUsageTimelineQuerySourceMax = 64;
324
346
  export const getUsageTimelineQueryBucketDefault = `1h`;
325
347
  export const getUsageTimelineQueryBucketMax = 16;
326
348
  export const GetUsageTimelineQueryParams = zod.strictObject({
@@ -340,6 +362,12 @@ export const GetUsageTimelineQueryParams = zod.strictObject({
340
362
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
341
363
  .optional()
342
364
  .describe("Restricts the result to the specified status"),
365
+ source: zod
366
+ .string()
367
+ .min(1)
368
+ .max(getUsageTimelineQuerySourceMax)
369
+ .optional()
370
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
343
371
  bucket: zod
344
372
  .string()
345
373
  .max(getUsageTimelineQueryBucketMax)
@@ -53,6 +53,7 @@ export declare const CursorPageRequestResource: zod.ZodObject<{
53
53
  output_tokens: zod.ZodInt;
54
54
  reasoning_tokens: zod.ZodInt;
55
55
  retries: zod.ZodInt;
56
+ source: zod.ZodNullable<zod.ZodString>;
56
57
  started_at: zod.z.ZodISODateTime;
57
58
  status: zod.ZodEnum<{
58
59
  succeeded: "succeeded";
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export declare const getUsageSummaryParamsModelIdMax = 128;
43
+ export declare const getUsageSummaryParamsSourceMax = 64;
43
44
  export declare const GetUsageSummaryParams: zod.ZodObject<{
44
45
  from: zod.z.ZodISODateTime;
45
46
  to: zod.z.ZodISODateTime;
@@ -52,6 +53,7 @@ export declare const GetUsageSummaryParams: zod.ZodObject<{
52
53
  upstream_failed: "upstream_failed";
53
54
  client_aborted: "client_aborted";
54
55
  }>>;
56
+ source: zod.ZodOptional<zod.ZodString>;
55
57
  }, zod.z.core.$strict>;
56
58
  export type GetUsageSummaryParams = zod.input<typeof GetUsageSummaryParams>;
57
59
  export type GetUsageSummaryParamsOutput = zod.output<typeof GetUsageSummaryParams>;
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export const getUsageSummaryParamsModelIdMax = 128;
43
+ export const getUsageSummaryParamsSourceMax = 64;
43
44
  export const GetUsageSummaryParams = zod.strictObject({
44
45
  from: zod.iso
45
46
  .datetime({ offset: true })
@@ -57,4 +58,10 @@ export const GetUsageSummaryParams = zod.strictObject({
57
58
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
58
59
  .optional()
59
60
  .describe("Restricts the result to the specified status"),
61
+ source: zod
62
+ .string()
63
+ .min(1)
64
+ .max(getUsageSummaryParamsSourceMax)
65
+ .optional()
66
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
60
67
  });
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export declare const getUsageTimelineParamsModelIdMax = 128;
43
+ export declare const getUsageTimelineParamsSourceMax = 64;
43
44
  export declare const getUsageTimelineParamsBucketDefault = "1h";
44
45
  export declare const getUsageTimelineParamsBucketMax = 16;
45
46
  export declare const GetUsageTimelineParams: zod.ZodObject<{
@@ -54,6 +55,7 @@ export declare const GetUsageTimelineParams: zod.ZodObject<{
54
55
  upstream_failed: "upstream_failed";
55
56
  client_aborted: "client_aborted";
56
57
  }>>;
58
+ source: zod.ZodOptional<zod.ZodString>;
57
59
  bucket: zod.ZodDefault<zod.ZodString>;
58
60
  }, zod.z.core.$strict>;
59
61
  export type GetUsageTimelineParams = zod.input<typeof GetUsageTimelineParams>;
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export const getUsageTimelineParamsModelIdMax = 128;
43
+ export const getUsageTimelineParamsSourceMax = 64;
43
44
  export const getUsageTimelineParamsBucketDefault = `1h`;
44
45
  export const getUsageTimelineParamsBucketMax = 16;
45
46
  export const GetUsageTimelineParams = zod.strictObject({
@@ -59,6 +60,12 @@ export const GetUsageTimelineParams = zod.strictObject({
59
60
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
60
61
  .optional()
61
62
  .describe("Restricts the result to the specified status"),
63
+ source: zod
64
+ .string()
65
+ .min(1)
66
+ .max(getUsageTimelineParamsSourceMax)
67
+ .optional()
68
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
62
69
  bucket: zod
63
70
  .string()
64
71
  .max(getUsageTimelineParamsBucketMax)
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export declare const listRequestsParamsModelIdMax = 128;
43
+ export declare const listRequestsParamsSourceMax = 64;
43
44
  export declare const listRequestsParamsLimitDefault = 50;
44
45
  export declare const listRequestsParamsLimitMax = 200;
45
46
  export declare const listRequestsParamsCursorMax = 1024;
@@ -55,6 +56,7 @@ export declare const ListRequestsParams: zod.ZodObject<{
55
56
  upstream_failed: "upstream_failed";
56
57
  client_aborted: "client_aborted";
57
58
  }>>;
59
+ source: zod.ZodOptional<zod.ZodString>;
58
60
  limit: zod.ZodDefault<zod.ZodInt>;
59
61
  cursor: zod.ZodOptional<zod.ZodString>;
60
62
  }, zod.z.core.$strict>;
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export const listRequestsParamsModelIdMax = 128;
43
+ export const listRequestsParamsSourceMax = 64;
43
44
  export const listRequestsParamsLimitDefault = 50;
44
45
  export const listRequestsParamsLimitMax = 200;
45
46
  export const listRequestsParamsCursorMax = 1024;
@@ -60,6 +61,12 @@ export const ListRequestsParams = zod.strictObject({
60
61
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
61
62
  .optional()
62
63
  .describe("Restricts the result to the specified status"),
64
+ source: zod
65
+ .string()
66
+ .min(1)
67
+ .max(listRequestsParamsSourceMax)
68
+ .optional()
69
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
63
70
  limit: zod.int().min(1).max(listRequestsParamsLimitMax).default(listRequestsParamsLimitDefault),
64
71
  cursor: zod.string().min(1).max(listRequestsParamsCursorMax).optional(),
65
72
  });
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export declare const listUsageByModelParamsModelIdMax = 128;
43
+ export declare const listUsageByModelParamsSourceMax = 64;
43
44
  export declare const ListUsageByModelParams: zod.ZodObject<{
44
45
  from: zod.z.ZodISODateTime;
45
46
  to: zod.z.ZodISODateTime;
@@ -52,6 +53,7 @@ export declare const ListUsageByModelParams: zod.ZodObject<{
52
53
  upstream_failed: "upstream_failed";
53
54
  client_aborted: "client_aborted";
54
55
  }>>;
56
+ source: zod.ZodOptional<zod.ZodString>;
55
57
  }, zod.z.core.$strict>;
56
58
  export type ListUsageByModelParams = zod.input<typeof ListUsageByModelParams>;
57
59
  export type ListUsageByModelParamsOutput = zod.output<typeof ListUsageByModelParams>;
@@ -40,6 +40,7 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export const listUsageByModelParamsModelIdMax = 128;
43
+ export const listUsageByModelParamsSourceMax = 64;
43
44
  export const ListUsageByModelParams = zod.strictObject({
44
45
  from: zod.iso
45
46
  .datetime({ offset: true })
@@ -57,4 +58,10 @@ export const ListUsageByModelParams = zod.strictObject({
57
58
  .enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"])
58
59
  .optional()
59
60
  .describe("Restricts the result to the specified status"),
61
+ source: zod
62
+ .string()
63
+ .min(1)
64
+ .max(listUsageByModelParamsSourceMax)
65
+ .optional()
66
+ .describe("Restricts the result to requests from the specified source, as reported in a request's `source`. Requests recorded before sources were tracked have none and are excluded"),
60
67
  });
@@ -39,6 +39,7 @@
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
41
  import * as zod from "zod";
42
+ export declare const requestResourceSourceMax = 64;
42
43
  export declare const RequestResource: zod.ZodObject<{
43
44
  api_key_id: zod.ZodNullable<zod.ZodUUID>;
44
45
  cache_read_tokens: zod.ZodInt;
@@ -52,6 +53,7 @@ export declare const RequestResource: zod.ZodObject<{
52
53
  output_tokens: zod.ZodInt;
53
54
  reasoning_tokens: zod.ZodInt;
54
55
  retries: zod.ZodInt;
56
+ source: zod.ZodNullable<zod.ZodString>;
55
57
  started_at: zod.z.ZodISODateTime;
56
58
  status: zod.ZodEnum<{
57
59
  succeeded: "succeeded";
@@ -40,11 +40,12 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  import { ReasoningDiagnostics } from "./reasoningDiagnostics.zod.js";
43
+ export const requestResourceSourceMax = 64;
43
44
  export const RequestResource = zod.strictObject({
44
45
  api_key_id: zod
45
46
  .uuid()
46
47
  .nullable()
47
- .describe("Null for a request made by an internal service directly for the project."),
48
+ .describe("Null for a request that did not come through one of the project's API keys."),
48
49
  cache_read_tokens: zod
49
50
  .int()
50
51
  .describe("The portion served from the upstream prefix cache, which costs an order of magnitude less than ordinary input"),
@@ -58,6 +59,11 @@ export const RequestResource = zod.strictObject({
58
59
  output_tokens: zod.int(),
59
60
  reasoning_tokens: zod.int(),
60
61
  retries: zod.int(),
62
+ source: zod
63
+ .string()
64
+ .max(requestResourceSourceMax)
65
+ .nullable()
66
+ .describe("Who made the request. `api_key` means one of the project's API keys and `project_token` a project access token on the OpenAI-compatible endpoints; any other value names the Leaflow service that made it on the project's behalf, such as `assistant`, and more services may appear. Null for requests recorded before sources were tracked"),
61
67
  started_at: zod.iso.datetime({ offset: true }),
62
68
  status: zod.enum(["in_flight", "succeeded", "refused", "upstream_failed", "client_aborted"]),
63
69
  stream: zod.boolean(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.369.g4b81cd7",
3
+ "version": "0.0.0-dev.373.gac63f82",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {