@leaflow/sdk 0.0.0-dev.429.gf6440ec → 0.0.0-dev.433.g7e48b8f

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 (88) hide show
  1. package/dist/canopy/v1/generated/models.d.ts +209 -9
  2. package/dist/canopy/v1/generated/models.js +27 -1
  3. package/dist/canopy/v1/generated/schemas.zod.d.ts +1 -1
  4. package/dist/canopy/v1/generated/schemas.zod.js +3 -1
  5. package/dist/canopy/v1/generated/validators/aPIKeyUsageListResponseBody.zod.d.ts +9 -0
  6. package/dist/canopy/v1/generated/validators/aPIKeyUsageResource.zod.d.ts +9 -0
  7. package/dist/canopy/v1/generated/validators/aPIKeyUsageResource.zod.js +5 -0
  8. package/dist/canopy/v1/generated/validators/audioCapabilities.zod.d.ts +51 -0
  9. package/dist/canopy/v1/generated/validators/audioCapabilities.zod.js +67 -0
  10. package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.d.ts +10 -1
  11. package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.d.ts +37 -0
  12. package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.js +20 -0
  13. package/dist/canopy/v1/generated/validators/imageCapabilities.zod.d.ts +52 -0
  14. package/dist/canopy/v1/generated/validators/imageCapabilities.zod.js +69 -0
  15. package/dist/canopy/v1/generated/validators/mediaUsage.zod.d.ts +52 -0
  16. package/dist/canopy/v1/generated/validators/mediaUsage.zod.js +61 -0
  17. package/dist/canopy/v1/generated/validators/model.zod.d.ts +50 -0
  18. package/dist/canopy/v1/generated/validators/modelBilling.zod.d.ts +8 -1
  19. package/dist/canopy/v1/generated/validators/modelBilling.zod.js +2 -2
  20. package/dist/canopy/v1/generated/validators/modelCapabilities.zod.d.ts +37 -0
  21. package/dist/canopy/v1/generated/validators/modelEndpoint.zod.d.ts +13 -0
  22. package/dist/canopy/v1/generated/validators/modelEndpoint.zod.js +13 -0
  23. package/dist/canopy/v1/generated/validators/modelList.zod.d.ts +50 -0
  24. package/dist/canopy/v1/generated/validators/modelListResponseBody.zod.d.ts +58 -1
  25. package/dist/canopy/v1/generated/validators/modelMeter.zod.d.ts +8 -1
  26. package/dist/canopy/v1/generated/validators/modelMeter.zod.js +21 -2
  27. package/dist/canopy/v1/generated/validators/modelParameter.zod.d.ts +58 -0
  28. package/dist/canopy/v1/generated/validators/modelParameter.zod.js +57 -0
  29. package/dist/canopy/v1/generated/validators/modelResource.zod.d.ts +58 -1
  30. package/dist/canopy/v1/generated/validators/modelUsageListResponseBody.zod.d.ts +9 -0
  31. package/dist/canopy/v1/generated/validators/modelUsageResource.zod.d.ts +9 -0
  32. package/dist/canopy/v1/generated/validators/modelUsageResource.zod.js +5 -0
  33. package/dist/canopy/v1/generated/validators/requestResource.zod.d.ts +10 -1
  34. package/dist/canopy/v1/generated/validators/requestResource.zod.js +8 -1
  35. package/dist/canopy/v1/generated/validators/totalsResource.zod.d.ts +9 -0
  36. package/dist/canopy/v1/generated/validators/totalsResource.zod.js +5 -0
  37. package/dist/canopy/v1/generated/validators/usageBucketResource.zod.d.ts +9 -0
  38. package/dist/canopy/v1/generated/validators/usageBucketResource.zod.js +5 -0
  39. package/dist/canopy/v1/generated/validators/usageTimelineResponseBody.zod.d.ts +9 -0
  40. package/dist/canopy/v1/generated/validators/videoCapabilities.zod.d.ts +51 -0
  41. package/dist/canopy/v1/generated/validators/videoCapabilities.zod.js +69 -0
  42. package/dist/eventbus/v1/generated/functions.d.ts +336 -0
  43. package/dist/eventbus/v1/generated/functions.js +214 -0
  44. package/dist/eventbus/v1/generated/models.d.ts +364 -0
  45. package/dist/eventbus/v1/generated/models.js +8 -0
  46. package/dist/eventbus/v1/generated/schemas.zod.d.ts +138 -0
  47. package/dist/eventbus/v1/generated/schemas.zod.js +163 -0
  48. package/dist/eventbus/v1/generated/validators/createEventRequest.zod.d.ts +50 -0
  49. package/dist/eventbus/v1/generated/validators/createEventRequest.zod.js +59 -0
  50. package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.d.ts +46 -0
  51. package/dist/eventbus/v1/generated/validators/createVersionRequest.zod.js +47 -0
  52. package/dist/eventbus/v1/generated/validators/cursorPagination.zod.d.ts +45 -0
  53. package/dist/eventbus/v1/generated/validators/cursorPagination.zod.js +45 -0
  54. package/dist/eventbus/v1/generated/validators/error.zod.d.ts +56 -0
  55. package/dist/eventbus/v1/generated/validators/error.zod.js +45 -0
  56. package/dist/eventbus/v1/generated/validators/errorStatus.zod.d.ts +54 -0
  57. package/dist/eventbus/v1/generated/validators/errorStatus.zod.js +69 -0
  58. package/dist/eventbus/v1/generated/validators/eventDetail.zod.d.ts +65 -0
  59. package/dist/eventbus/v1/generated/validators/eventDetail.zod.js +62 -0
  60. package/dist/eventbus/v1/generated/validators/eventList.zod.d.ts +58 -0
  61. package/dist/eventbus/v1/generated/validators/eventList.zod.js +50 -0
  62. package/dist/eventbus/v1/generated/validators/eventResource.zod.d.ts +55 -0
  63. package/dist/eventbus/v1/generated/validators/eventResource.zod.js +60 -0
  64. package/dist/eventbus/v1/generated/validators/eventStatus.zod.d.ts +45 -0
  65. package/dist/eventbus/v1/generated/validators/eventStatus.zod.js +42 -0
  66. package/dist/eventbus/v1/generated/validators/eventVersion.zod.d.ts +51 -0
  67. package/dist/eventbus/v1/generated/validators/eventVersion.zod.js +53 -0
  68. package/dist/eventbus/v1/generated/validators/fieldViolation.zod.d.ts +45 -0
  69. package/dist/eventbus/v1/generated/validators/fieldViolation.zod.js +48 -0
  70. package/dist/eventbus/v1/generated/validators/listEventsParams.zod.d.ts +55 -0
  71. package/dist/eventbus/v1/generated/validators/listEventsParams.zod.js +57 -0
  72. package/dist/eventbus/v1/generated/validators/offsetPagination.zod.d.ts +47 -0
  73. package/dist/eventbus/v1/generated/validators/offsetPagination.zod.js +47 -0
  74. package/dist/eventbus/v1/generated/validators/publishRequest.zod.d.ts +49 -0
  75. package/dist/eventbus/v1/generated/validators/publishRequest.zod.js +55 -0
  76. package/dist/eventbus/v1/generated/validators/publishResponse.zod.d.ts +47 -0
  77. package/dist/eventbus/v1/generated/validators/publishResponse.zod.js +47 -0
  78. package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.d.ts +46 -0
  79. package/dist/eventbus/v1/generated/validators/realtimeTicket.zod.js +46 -0
  80. package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.d.ts +51 -0
  81. package/dist/eventbus/v1/generated/validators/updateEventRequest.zod.js +54 -0
  82. package/dist/eventbus/v1/index.d.ts +3 -0
  83. package/dist/eventbus/v1/index.js +3 -0
  84. package/dist/index.d.ts +1 -0
  85. package/dist/index.js +1 -0
  86. package/dist/routes.d.ts +64 -0
  87. package/dist/routes.js +72 -0
  88. package/package.json +1 -1
@@ -40,9 +40,28 @@
40
40
  */
41
41
  import * as zod from "zod";
42
42
  export const ModelMeter = zod.strictObject({
43
- token_kind: zod.enum(["input", "output", "cache_read", "cache_write", "reasoning"]),
43
+ kind: zod
44
+ .enum([
45
+ "input",
46
+ "output",
47
+ "cache_read",
48
+ "cache_write",
49
+ "reasoning",
50
+ "images",
51
+ "audio_characters",
52
+ "audio_seconds",
53
+ "video_seconds",
54
+ "rerank_units",
55
+ ])
56
+ .describe("The billable quantity this entry prices. Token kinds are `input`, `output`, `cache_read`, `cache_write` and `reasoning`; media kinds are `images`, `audio_characters`, `audio_seconds` and `video_seconds`."),
44
57
  meter_lookup_key: zod.string(),
58
+ unit: zod
59
+ .string()
60
+ .describe("The unit the meter counts in, such as token, image, character or second."),
61
+ dimension_keys: zod
62
+ .array(zod.string())
63
+ .describe("The dimension keys every rate of this kind is matched on, in the order the meter declares them."),
45
64
  dimensions: zod
46
65
  .record(zod.string(), zod.string())
47
- .describe("The dimension values the usage of this token kind carries, and the rate is matched at."),
66
+ .describe("One set of dimension values of this kind, useful as a query template. A media kind may have other values on the same keys, such as another size or resolution."),
48
67
  });
@@ -0,0 +1,58 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
+ *
7
+ * Project inference is served on this host in each provider's own protocol:
8
+ *
9
+ * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
+ * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
+ * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
+ * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
+ *
14
+ * Canopy does not convert between protocols. A request is accepted only for a model whose
15
+ * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
+ * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
+ * through as written; a model's `capabilities` lists the values its upstream accepts.
18
+ *
19
+ * Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
20
+ * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
+ *
22
+ * ## Authentication
23
+ *
24
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
+ *
26
+ * Management and project inference accept the same verified IAM scoped token. The token is the
27
+ * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
+ * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
+ * accepts Canopy API keys and serves the same endpoints.
30
+ *
31
+ * ## Conventions
32
+ *
33
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
34
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
35
+ * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
37
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
38
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
39
+ * OpenAPI spec version: 1.0.0
40
+ */
41
+ import * as zod from "zod";
42
+ export declare const ModelParameter: zod.ZodObject<{
43
+ name: zod.ZodString;
44
+ description: zod.ZodString;
45
+ type: zod.ZodEnum<{
46
+ string: "string";
47
+ number: "number";
48
+ boolean: "boolean";
49
+ object: "object";
50
+ array: "array";
51
+ integer: "integer";
52
+ }>;
53
+ required: zod.ZodBoolean;
54
+ default: zod.ZodOptional<zod.ZodUnknown>;
55
+ values: zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodString>>>;
56
+ }, zod.z.core.$strict>;
57
+ export type ModelParameter = zod.input<typeof ModelParameter>;
58
+ export type ModelParameterOutput = zod.output<typeof ModelParameter>;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
+ *
7
+ * Project inference is served on this host in each provider's own protocol:
8
+ *
9
+ * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
+ * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
+ * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
+ * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
+ *
14
+ * Canopy does not convert between protocols. A request is accepted only for a model whose
15
+ * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
+ * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
+ * through as written; a model's `capabilities` lists the values its upstream accepts.
18
+ *
19
+ * Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
20
+ * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
+ *
22
+ * ## Authentication
23
+ *
24
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
+ *
26
+ * Management and project inference accept the same verified IAM scoped token. The token is the
27
+ * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
+ * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
+ * accepts Canopy API keys and serves the same endpoints.
30
+ *
31
+ * ## Conventions
32
+ *
33
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
34
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
35
+ * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
37
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
38
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
39
+ * OpenAPI spec version: 1.0.0
40
+ */
41
+ import * as zod from "zod";
42
+ export const ModelParameter = zod
43
+ .strictObject({
44
+ name: zod.string(),
45
+ description: zod.string(),
46
+ type: zod.enum(["string", "integer", "number", "boolean", "object", "array"]),
47
+ required: zod.boolean(),
48
+ default: zod
49
+ .unknown()
50
+ .optional()
51
+ .describe("The value the upstream assumes when the field is absent; null when there is none. The service never writes it into the request."),
52
+ values: zod
53
+ .array(zod.string())
54
+ .nullish()
55
+ .describe("The accepted values of an enumerated string parameter. Null when the parameter is not enumerated."),
56
+ })
57
+ .describe("A non-standard request field this endpoint accepts. OpenAI SDK callers pass it through `extra_body`, which places it at the top level of the body.");
@@ -48,14 +48,21 @@ export declare const ModelResource: zod.ZodObject<{
48
48
  billing: zod.ZodObject<{
49
49
  plan_id: zod.ZodNullable<zod.ZodUUID>;
50
50
  meters: zod.ZodArray<zod.ZodObject<{
51
- token_kind: zod.ZodEnum<{
51
+ kind: zod.ZodEnum<{
52
52
  output: "output";
53
53
  input: "input";
54
54
  reasoning: "reasoning";
55
55
  cache_read: "cache_read";
56
56
  cache_write: "cache_write";
57
+ images: "images";
58
+ audio_characters: "audio_characters";
59
+ audio_seconds: "audio_seconds";
60
+ video_seconds: "video_seconds";
61
+ rerank_units: "rerank_units";
57
62
  }>;
58
63
  meter_lookup_key: zod.ZodString;
64
+ unit: zod.ZodString;
65
+ dimension_keys: zod.ZodArray<zod.ZodString>;
59
66
  dimensions: zod.ZodRecord<zod.ZodString, zod.ZodString>;
60
67
  }, zod.z.core.$strict>>;
61
68
  }, zod.z.core.$strict>;
@@ -96,6 +103,43 @@ export declare const ModelResource: zod.ZodObject<{
96
103
  }, zod.z.core.$strict>>;
97
104
  summary: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
98
105
  }, zod.z.core.$strict>, zod.ZodNull]>;
106
+ image: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
107
+ sizes: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
108
+ qualities: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
109
+ response_formats: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
110
+ max_n: zod.ZodNullable<zod.ZodInt>;
111
+ supports_stream: zod.ZodNullable<zod.ZodBoolean>;
112
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
113
+ audio: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
114
+ voices: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
115
+ formats: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
116
+ response_formats: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
117
+ max_input_bytes: zod.ZodNullable<zod.ZodInt>;
118
+ supports_stream: zod.ZodNullable<zod.ZodBoolean>;
119
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
120
+ video: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
121
+ seconds: zod.ZodNullable<zod.ZodArray<zod.ZodInt>>;
122
+ sizes: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
123
+ resolutions: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
124
+ supports_input_reference: zod.ZodNullable<zod.ZodBoolean>;
125
+ supports_remix: zod.ZodNullable<zod.ZodBoolean>;
126
+ supports_characters: zod.ZodNullable<zod.ZodBoolean>;
127
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
128
+ parameters: zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodObject<{
129
+ name: zod.ZodString;
130
+ description: zod.ZodString;
131
+ type: zod.ZodEnum<{
132
+ string: "string";
133
+ number: "number";
134
+ boolean: "boolean";
135
+ object: "object";
136
+ array: "array";
137
+ integer: "integer";
138
+ }>;
139
+ required: zod.ZodBoolean;
140
+ default: zod.ZodOptional<zod.ZodUnknown>;
141
+ values: zod.ZodOptional<zod.ZodNullable<zod.ZodArray<zod.ZodString>>>;
142
+ }, zod.z.core.$strict>>>>;
99
143
  }, zod.z.core.$strict>>;
100
144
  supported_endpoints: zod.ZodArray<zod.ZodEnum<{
101
145
  "/v1/chat/completions": "/v1/chat/completions";
@@ -109,6 +153,19 @@ export declare const ModelResource: zod.ZodObject<{
109
153
  "/v1/audio/translations": "/v1/audio/translations";
110
154
  "/v1/audio/speech": "/v1/audio/speech";
111
155
  "/v1/realtime": "/v1/realtime";
156
+ "/v1/completions": "/v1/completions";
157
+ "/v1/rerank": "/v1/rerank";
158
+ "/v1/moderations": "/v1/moderations";
159
+ "/v1/images/variations": "/v1/images/variations";
160
+ "/v1/files": "/v1/files";
161
+ "/v1/uploads": "/v1/uploads";
162
+ "/v1/batches": "/v1/batches";
163
+ "/v1/fine_tuning/jobs": "/v1/fine_tuning/jobs";
164
+ "/v1/assistants": "/v1/assistants";
165
+ "/v1/threads": "/v1/threads";
166
+ "/v1/vector_stores": "/v1/vector_stores";
167
+ "/v1/containers": "/v1/containers";
168
+ "/v1/videos": "/v1/videos";
112
169
  }>>;
113
170
  }, zod.z.core.$strict>;
114
171
  export type ModelResource = zod.input<typeof ModelResource>;
@@ -47,6 +47,15 @@ export declare const ModelUsageListResponseBody: zod.ZodObject<{
47
47
  model_id: zod.ZodString;
48
48
  output_tokens: zod.ZodInt;
49
49
  reasoning_tokens: zod.ZodInt;
50
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
51
+ images: zod.ZodInt;
52
+ audio_characters: zod.ZodInt;
53
+ audio_seconds: zod.ZodInt;
54
+ video_seconds: zod.ZodInt;
55
+ size: zod.ZodNullable<zod.ZodString>;
56
+ quality: zod.ZodNullable<zod.ZodString>;
57
+ resolution: zod.ZodNullable<zod.ZodString>;
58
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
50
59
  requests: zod.ZodInt;
51
60
  }, zod.z.core.$strict>>;
52
61
  }, zod.z.core.$strict>;
@@ -46,6 +46,15 @@ export declare const ModelUsageResource: zod.ZodObject<{
46
46
  model_id: zod.ZodString;
47
47
  output_tokens: zod.ZodInt;
48
48
  reasoning_tokens: zod.ZodInt;
49
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
50
+ images: zod.ZodInt;
51
+ audio_characters: zod.ZodInt;
52
+ audio_seconds: zod.ZodInt;
53
+ video_seconds: zod.ZodInt;
54
+ size: zod.ZodNullable<zod.ZodString>;
55
+ quality: zod.ZodNullable<zod.ZodString>;
56
+ resolution: zod.ZodNullable<zod.ZodString>;
57
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
49
58
  requests: zod.ZodInt;
50
59
  }, zod.z.core.$strict>;
51
60
  export type ModelUsageResource = zod.input<typeof ModelUsageResource>;
@@ -39,6 +39,7 @@
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
41
  import * as zod from "zod";
42
+ import { MediaUsage } from "./mediaUsage.zod.js";
42
43
  export const ModelUsageResource = zod.strictObject({
43
44
  cache_read_tokens: zod.int(),
44
45
  cache_write_tokens: zod.int(),
@@ -46,5 +47,9 @@ export const ModelUsageResource = zod.strictObject({
46
47
  model_id: zod.string(),
47
48
  output_tokens: zod.int(),
48
49
  reasoning_tokens: zod.int(),
50
+ media: zod
51
+ .union([MediaUsage, zod.null()])
52
+ .optional()
53
+ .describe("Media quantities and their rate dimensions. Null when this range has no media usage."),
49
54
  requests: zod.int(),
50
55
  });
@@ -47,7 +47,7 @@ export declare const RequestResource: zod.ZodObject<{
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
- id: zod.ZodUUID;
50
+ id: zod.ZodString;
51
51
  input_tokens: zod.ZodInt;
52
52
  model_id: zod.ZodString;
53
53
  output_tokens: zod.ZodInt;
@@ -73,6 +73,15 @@ export declare const RequestResource: zod.ZodObject<{
73
73
  reasoning: zod.ZodUnion<readonly [zod.ZodObject<{
74
74
  requested: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
75
75
  }, zod.z.core.$strict>, zod.ZodNull]>;
76
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
77
+ images: zod.ZodInt;
78
+ audio_characters: zod.ZodInt;
79
+ audio_seconds: zod.ZodInt;
80
+ video_seconds: zod.ZodInt;
81
+ size: zod.ZodNullable<zod.ZodString>;
82
+ quality: zod.ZodNullable<zod.ZodString>;
83
+ resolution: zod.ZodNullable<zod.ZodString>;
84
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
76
85
  }, zod.z.core.$strict>;
77
86
  export type RequestResource = zod.input<typeof RequestResource>;
78
87
  export type RequestResourceOutput = zod.output<typeof RequestResource>;
@@ -39,6 +39,7 @@
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
41
  import * as zod from "zod";
42
+ import { MediaUsage } from "./mediaUsage.zod.js";
42
43
  import { ReasoningDiagnostics } from "./reasoningDiagnostics.zod.js";
43
44
  export const requestResourceSourceMax = 64;
44
45
  export const RequestResource = zod.strictObject({
@@ -53,7 +54,9 @@ export const RequestResource = zod.strictObject({
53
54
  error_code: zod.string().describe("The error code on failure. Empty on success"),
54
55
  finished_at: zod.iso.datetime({ offset: true }).nullable(),
55
56
  first_token_at: zod.iso.datetime({ offset: true }).nullable(),
56
- id: zod.uuid(),
57
+ id: zod
58
+ .string()
59
+ .describe("A typed request id such as `req_01j...`. Legacy rows may still be returned as a bare UUID."),
57
60
  input_tokens: zod.int(),
58
61
  model_id: zod.string().describe("The model named in the request"),
59
62
  output_tokens: zod.int(),
@@ -77,4 +80,8 @@ export const RequestResource = zod.strictObject({
77
80
  .enum(["none", "upstream", "estimated"])
78
81
  .describe("upstream means the figures were reported by the provider; estimated means they were derived from the character classes of the payload"),
79
82
  reasoning: zod.union([ReasoningDiagnostics, zod.null()]),
83
+ media: zod
84
+ .union([MediaUsage, zod.null()])
85
+ .optional()
86
+ .describe("Media quantities and their rate dimensions. Null for a token-only request."),
80
87
  });
@@ -45,6 +45,15 @@ export declare const TotalsResource: zod.ZodObject<{
45
45
  input_tokens: zod.ZodInt;
46
46
  output_tokens: zod.ZodInt;
47
47
  reasoning_tokens: zod.ZodInt;
48
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
49
+ images: zod.ZodInt;
50
+ audio_characters: zod.ZodInt;
51
+ audio_seconds: zod.ZodInt;
52
+ video_seconds: zod.ZodInt;
53
+ size: zod.ZodNullable<zod.ZodString>;
54
+ quality: zod.ZodNullable<zod.ZodString>;
55
+ resolution: zod.ZodNullable<zod.ZodString>;
56
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
48
57
  requests: zod.ZodInt;
49
58
  }, zod.z.core.$strict>;
50
59
  export type TotalsResource = zod.input<typeof TotalsResource>;
@@ -39,11 +39,16 @@
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
41
  import * as zod from "zod";
42
+ import { MediaUsage } from "./mediaUsage.zod.js";
42
43
  export const TotalsResource = zod.strictObject({
43
44
  cache_read_tokens: zod.int(),
44
45
  cache_write_tokens: zod.int(),
45
46
  input_tokens: zod.int(),
46
47
  output_tokens: zod.int(),
47
48
  reasoning_tokens: zod.int(),
49
+ media: zod
50
+ .union([MediaUsage, zod.null()])
51
+ .optional()
52
+ .describe("Media quantities and their rate dimensions. Null when this range has no media usage."),
48
53
  requests: zod.int(),
49
54
  });
@@ -46,6 +46,15 @@ export declare const UsageBucketResource: zod.ZodObject<{
46
46
  input_tokens: zod.ZodInt;
47
47
  output_tokens: zod.ZodInt;
48
48
  reasoning_tokens: zod.ZodInt;
49
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
50
+ images: zod.ZodInt;
51
+ audio_characters: zod.ZodInt;
52
+ audio_seconds: zod.ZodInt;
53
+ video_seconds: zod.ZodInt;
54
+ size: zod.ZodNullable<zod.ZodString>;
55
+ quality: zod.ZodNullable<zod.ZodString>;
56
+ resolution: zod.ZodNullable<zod.ZodString>;
57
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
49
58
  requests: zod.ZodInt;
50
59
  to: zod.z.ZodISODateTime;
51
60
  }, zod.z.core.$strict>;
@@ -39,6 +39,7 @@
39
39
  * OpenAPI spec version: 1.0.0
40
40
  */
41
41
  import * as zod from "zod";
42
+ import { MediaUsage } from "./mediaUsage.zod.js";
42
43
  export const UsageBucketResource = zod.strictObject({
43
44
  cache_read_tokens: zod.int(),
44
45
  cache_write_tokens: zod.int(),
@@ -46,6 +47,10 @@ export const UsageBucketResource = zod.strictObject({
46
47
  input_tokens: zod.int(),
47
48
  output_tokens: zod.int(),
48
49
  reasoning_tokens: zod.int(),
50
+ media: zod
51
+ .union([MediaUsage, zod.null()])
52
+ .optional()
53
+ .describe("Media quantities and their rate dimensions. Null when this range has no media usage."),
49
54
  requests: zod.int(),
50
55
  to: zod.iso.datetime({ offset: true }).describe("End of the bucket, exclusive"),
51
56
  });
@@ -47,6 +47,15 @@ export declare const UsageTimelineResponseBody: zod.ZodObject<{
47
47
  input_tokens: zod.ZodInt;
48
48
  output_tokens: zod.ZodInt;
49
49
  reasoning_tokens: zod.ZodInt;
50
+ media: zod.ZodOptional<zod.ZodUnion<readonly [zod.ZodObject<{
51
+ images: zod.ZodInt;
52
+ audio_characters: zod.ZodInt;
53
+ audio_seconds: zod.ZodInt;
54
+ video_seconds: zod.ZodInt;
55
+ size: zod.ZodNullable<zod.ZodString>;
56
+ quality: zod.ZodNullable<zod.ZodString>;
57
+ resolution: zod.ZodNullable<zod.ZodString>;
58
+ }, zod.z.core.$strict>, zod.ZodNull]>>;
50
59
  requests: zod.ZodInt;
51
60
  to: zod.z.ZodISODateTime;
52
61
  }, zod.z.core.$strict>>;
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
+ *
7
+ * Project inference is served on this host in each provider's own protocol:
8
+ *
9
+ * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
+ * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
+ * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
+ * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
+ *
14
+ * Canopy does not convert between protocols. A request is accepted only for a model whose
15
+ * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
+ * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
+ * through as written; a model's `capabilities` lists the values its upstream accepts.
18
+ *
19
+ * Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
20
+ * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
+ *
22
+ * ## Authentication
23
+ *
24
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
+ *
26
+ * Management and project inference accept the same verified IAM scoped token. The token is the
27
+ * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
+ * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
+ * accepts Canopy API keys and serves the same endpoints.
30
+ *
31
+ * ## Conventions
32
+ *
33
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
34
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
35
+ * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
37
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
38
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
39
+ * OpenAPI spec version: 1.0.0
40
+ */
41
+ import * as zod from "zod";
42
+ export declare const VideoCapabilities: zod.ZodObject<{
43
+ seconds: zod.ZodNullable<zod.ZodArray<zod.ZodInt>>;
44
+ sizes: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
45
+ resolutions: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
46
+ supports_input_reference: zod.ZodNullable<zod.ZodBoolean>;
47
+ supports_remix: zod.ZodNullable<zod.ZodBoolean>;
48
+ supports_characters: zod.ZodNullable<zod.ZodBoolean>;
49
+ }, zod.z.core.$strict>;
50
+ export type VideoCapabilities = zod.input<typeof VideoCapabilities>;
51
+ export type VideoCapabilitiesOutput = zod.output<typeof VideoCapabilities>;
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Generated by orval 🍺
3
+ * Do not edit manually.
4
+ * Leaflow Canopy API
5
+ * Canopy model inference, API keys, model catalogue, service enablement and recorded usage.
6
+ *
7
+ * Project inference is served on this host in each provider's own protocol:
8
+ *
9
+ * - OpenAI: `/v1/chat/completions`, `/v1/responses` and `/v1/embeddings`; use
10
+ * `https://canopy.leaflow.cloud/v1` as the OpenAI SDK base URL.
11
+ * - Anthropic: `/v1/messages`; use `https://canopy.leaflow.cloud` as the Anthropic SDK base URL.
12
+ * - Gemini: `/v1beta/models/{model}:generateContent` and `:streamGenerateContent`.
13
+ *
14
+ * Canopy does not convert between protocols. A request is accepted only for a model whose
15
+ * `supported_endpoints` lists the endpoint it was sent to, and it is forwarded unchanged except for
16
+ * the model name and the credentials. Reasoning settings such as `reasoning_effort` are passed
17
+ * through as written; a model's `capabilities` lists the values its upstream accepts.
18
+ *
19
+ * Management operations use `/api/v1`. The management model catalogue names how each model is billed in Billing;
20
+ * `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
21
+ *
22
+ * ## Authentication
23
+ *
24
+ * Every request carries a scoped token; see the `bearerAuth` security scheme.
25
+ *
26
+ * Management and project inference accept the same verified IAM scoped token. The token is the
27
+ * sole billing project authority; `OpenAI-Project` and historical identity headers cannot
28
+ * override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
29
+ * accepts Canopy API keys and serves the same endpoints.
30
+ *
31
+ * ## Conventions
32
+ *
33
+ * - **The plaintext of an API key is returned once.** The `secret` appears in the response that issues it and is returned by no other endpoint. A key that has been lost has to be revoked and reissued.
34
+ * - **Disabling and revoking are distinct.** A disabled key may be enabled again at any time, while a revocation is irreversible and is intended for a key that has been exposed. Neither removes the record, and the usage the key accrued remains readable.
35
+ * - **A usage query must carry a time range**, spanning no more than 31 days, or 400 days for the usage timeline. `from` and `to` carry a timezone offset, which the server does not infer.
36
+ * - **The request and response bodies do not appear in the ledger.** They are not recorded. Quote the `upstream_request_id` from the response when reporting a problem.
37
+ * - **Usage may be estimated.** The upstream provider does not report usage on every request. Where it does not, `usage_source` is `estimated` and the figures are derived from the character classes of the payload, to within roughly fifteen per cent.
38
+ * - **The service is enabled before use.** A project enables the model platform once, through `create-service`; the forwarding endpoints refuse its requests until the service is `active`. Requests are then billed under the service's subscription by the tokens they use, at the rates Billing holds for each model's `billing`.
39
+ * OpenAPI spec version: 1.0.0
40
+ */
41
+ import * as zod from "zod";
42
+ export const VideoCapabilities = zod
43
+ .strictObject({
44
+ seconds: zod
45
+ .array(zod.int().min(1))
46
+ .nullable()
47
+ .describe("Durations the upstream accepts, in seconds. Null means unknown."),
48
+ sizes: zod
49
+ .array(zod.string())
50
+ .nullable()
51
+ .describe("Output sizes the upstream accepts, such as 1280x720. Null means unknown."),
52
+ resolutions: zod
53
+ .array(zod.string())
54
+ .nullable()
55
+ .describe("Resolution tiers the upstream accepts, such as 720p or 1080p. Null means unknown."),
56
+ supports_input_reference: zod
57
+ .boolean()
58
+ .nullable()
59
+ .describe("Whether a request may carry a reference image. Null means unknown."),
60
+ supports_remix: zod
61
+ .boolean()
62
+ .nullable()
63
+ .describe("Whether a generated video can be remixed into another task. Null means unknown."),
64
+ supports_characters: zod
65
+ .boolean()
66
+ .nullable()
67
+ .describe("Whether the upstream accepts reusable characters. Null means unknown."),
68
+ })
69
+ .describe("The video parameters this endpoint accepts. Video is asynchronous on every endpoint that supports it. Create returns a task, and the task is polled separately.");