@leaflow/sdk 0.0.0-dev.447.g0c7ce00 → 0.0.0-dev.449.gb0894d4

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.
@@ -647,9 +647,16 @@ export interface RequestResource {
647
647
  * @nullable
648
648
  */
649
649
  api_key_id: string | null;
650
- /** The portion served from the upstream prefix cache, which costs an order of magnitude less than ordinary input */
651
- cache_read_tokens: number;
652
- cache_write_tokens: number;
650
+ /**
651
+ * The portion served from the upstream prefix cache, which costs an order of magnitude less than ordinary input. Null on a request billed on a non-token meter.
652
+ * @nullable
653
+ */
654
+ cache_read_tokens: number | null;
655
+ /**
656
+ * Tokens written to the provider's prompt cache. Null on a request billed on a non-token meter.
657
+ * @nullable
658
+ */
659
+ cache_write_tokens: number | null;
653
660
  /** The error code on failure. Empty on success */
654
661
  error_code: string;
655
662
  /** @nullable */
@@ -658,13 +665,25 @@ export interface RequestResource {
658
665
  first_token_at: string | null;
659
666
  /** A typed request id such as `req_01j...`. Legacy rows may still be returned as a bare UUID. */
660
667
  id: string;
661
- input_tokens: number;
668
+ /**
669
+ * Input tokens the provider billed for. Null on a request billed on a non-token meter, such as image generation, video generation or speech.
670
+ * @nullable
671
+ */
672
+ input_tokens: number | null;
662
673
  /** The model named in the request */
663
674
  model_id: string;
664
675
  /** The request operation, such as video_create or video_retrieve. Absent for historical requests where it was not recorded. */
665
676
  operation?: string;
666
- output_tokens: number;
667
- reasoning_tokens: number;
677
+ /**
678
+ * Output tokens the provider billed for. Null on a request billed on a non-token meter, such as image generation, video generation or speech.
679
+ * @nullable
680
+ */
681
+ output_tokens: number | null;
682
+ /**
683
+ * Reasoning tokens the provider reports separately. Null on a request billed on a non-token meter.
684
+ * @nullable
685
+ */
686
+ reasoning_tokens: number | null;
668
687
  retries: number;
669
688
  /**
670
689
  * 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
@@ -42,17 +42,17 @@ import * as zod from "zod";
42
42
  export declare const CursorPageRequestResource: zod.ZodObject<{
43
43
  items: zod.ZodArray<zod.ZodObject<{
44
44
  api_key_id: zod.ZodNullable<zod.ZodUUID>;
45
- cache_read_tokens: zod.ZodInt;
46
- cache_write_tokens: zod.ZodInt;
45
+ cache_read_tokens: zod.ZodNullable<zod.ZodInt>;
46
+ cache_write_tokens: zod.ZodNullable<zod.ZodInt>;
47
47
  error_code: zod.ZodString;
48
48
  finished_at: zod.ZodNullable<zod.z.ZodISODateTime>;
49
49
  first_token_at: zod.ZodNullable<zod.z.ZodISODateTime>;
50
50
  id: zod.ZodString;
51
- input_tokens: zod.ZodInt;
51
+ input_tokens: zod.ZodNullable<zod.ZodInt>;
52
52
  model_id: zod.ZodString;
53
53
  operation: zod.ZodOptional<zod.ZodString>;
54
- output_tokens: zod.ZodInt;
55
- reasoning_tokens: zod.ZodInt;
54
+ output_tokens: zod.ZodNullable<zod.ZodInt>;
55
+ reasoning_tokens: zod.ZodNullable<zod.ZodInt>;
56
56
  retries: zod.ZodInt;
57
57
  source: zod.ZodNullable<zod.ZodString>;
58
58
  started_at: zod.z.ZodISODateTime;
@@ -42,17 +42,17 @@ import * as zod from "zod";
42
42
  export declare const requestResourceSourceMax = 64;
43
43
  export declare const RequestResource: zod.ZodObject<{
44
44
  api_key_id: zod.ZodNullable<zod.ZodUUID>;
45
- cache_read_tokens: zod.ZodInt;
46
- cache_write_tokens: zod.ZodInt;
45
+ cache_read_tokens: zod.ZodNullable<zod.ZodInt>;
46
+ cache_write_tokens: zod.ZodNullable<zod.ZodInt>;
47
47
  error_code: zod.ZodString;
48
48
  finished_at: zod.ZodNullable<zod.z.ZodISODateTime>;
49
49
  first_token_at: zod.ZodNullable<zod.z.ZodISODateTime>;
50
50
  id: zod.ZodString;
51
- input_tokens: zod.ZodInt;
51
+ input_tokens: zod.ZodNullable<zod.ZodInt>;
52
52
  model_id: zod.ZodString;
53
53
  operation: zod.ZodOptional<zod.ZodString>;
54
- output_tokens: zod.ZodInt;
55
- reasoning_tokens: zod.ZodInt;
54
+ output_tokens: zod.ZodNullable<zod.ZodInt>;
55
+ reasoning_tokens: zod.ZodNullable<zod.ZodInt>;
56
56
  retries: zod.ZodInt;
57
57
  source: zod.ZodNullable<zod.ZodString>;
58
58
  started_at: zod.z.ZodISODateTime;
@@ -49,22 +49,35 @@ export const RequestResource = zod.strictObject({
49
49
  .describe("Null for a request that did not come through one of the project's API keys."),
50
50
  cache_read_tokens: zod
51
51
  .int()
52
- .describe("The portion served from the upstream prefix cache, which costs an order of magnitude less than ordinary input"),
53
- cache_write_tokens: zod.int(),
52
+ .nullable()
53
+ .describe("The portion served from the upstream prefix cache, which costs an order of magnitude less than ordinary input. Null on a request billed on a non-token meter."),
54
+ cache_write_tokens: zod
55
+ .int()
56
+ .nullable()
57
+ .describe("Tokens written to the provider's prompt cache. Null on a request billed on a non-token meter."),
54
58
  error_code: zod.string().describe("The error code on failure. Empty on success"),
55
59
  finished_at: zod.iso.datetime({ offset: true }).nullable(),
56
60
  first_token_at: zod.iso.datetime({ offset: true }).nullable(),
57
61
  id: zod
58
62
  .string()
59
63
  .describe("A typed request id such as `req_01j...`. Legacy rows may still be returned as a bare UUID."),
60
- input_tokens: zod.int(),
64
+ input_tokens: zod
65
+ .int()
66
+ .nullable()
67
+ .describe("Input tokens the provider billed for. Null on a request billed on a non-token meter, such as image generation, video generation or speech."),
61
68
  model_id: zod.string().describe("The model named in the request"),
62
69
  operation: zod
63
70
  .string()
64
71
  .optional()
65
72
  .describe("The request operation, such as video_create or video_retrieve. Absent for historical requests where it was not recorded."),
66
- output_tokens: zod.int(),
67
- reasoning_tokens: zod.int(),
73
+ output_tokens: zod
74
+ .int()
75
+ .nullable()
76
+ .describe("Output tokens the provider billed for. Null on a request billed on a non-token meter, such as image generation, video generation or speech."),
77
+ reasoning_tokens: zod
78
+ .int()
79
+ .nullable()
80
+ .describe("Reasoning tokens the provider reports separately. Null on a request billed on a non-token meter."),
68
81
  retries: zod.int(),
69
82
  source: zod
70
83
  .string()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leaflow/sdk",
3
- "version": "0.0.0-dev.447.g0c7ce00",
3
+ "version": "0.0.0-dev.449.gb0894d4",
4
4
  "description": "Leaflow 平台 API 的 TypeScript SDK",
5
5
  "license": "MIT",
6
6
  "repository": {