@leaflow/sdk 0.141.0 → 0.142.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.
- package/dist/canopy/v1/generated/functions.d.ts +66 -1
- package/dist/canopy/v1/generated/functions.js +67 -0
- package/dist/canopy/v1/generated/models.d.ts +141 -9
- package/dist/canopy/v1/generated/models.js +24 -0
- package/dist/canopy/v1/generated/schemas.zod.d.ts +27 -0
- package/dist/canopy/v1/generated/schemas.zod.js +18 -0
- package/dist/canopy/v1/generated/validators/cursorPageRequestResource.zod.d.ts +9 -0
- package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.d.ts +50 -0
- package/dist/canopy/v1/generated/validators/endpointCapabilities.zod.js +39 -0
- package/dist/canopy/v1/generated/validators/modality.zod.d.ts +43 -0
- package/dist/canopy/v1/generated/validators/modality.zod.js +34 -0
- package/dist/canopy/v1/generated/validators/model.zod.d.ts +44 -4
- package/dist/canopy/v1/generated/validators/model.zod.js +19 -4
- package/dist/canopy/v1/generated/validators/modelCapabilities.zod.d.ts +50 -0
- package/dist/canopy/v1/generated/validators/modelCapabilities.zod.js +37 -0
- package/dist/canopy/v1/generated/validators/modelEndpoint.zod.d.ts +46 -0
- package/dist/canopy/v1/generated/validators/modelEndpoint.zod.js +44 -0
- package/dist/canopy/v1/generated/validators/modelList.zod.d.ts +44 -4
- package/dist/canopy/v1/generated/validators/modelListResponseBody.zod.d.ts +44 -4
- package/dist/canopy/v1/generated/validators/modelResource.zod.d.ts +44 -4
- package/dist/canopy/v1/generated/validators/modelResource.zod.js +19 -6
- package/dist/canopy/v1/generated/validators/reasoningCapabilities.zod.d.ts +48 -0
- package/dist/canopy/v1/generated/validators/reasoningCapabilities.zod.js +51 -0
- package/dist/canopy/v1/generated/validators/reasoningDiagnostics.zod.d.ts +44 -0
- package/dist/canopy/v1/generated/validators/reasoningDiagnostics.zod.js +38 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.d.ts +9 -0
- package/dist/canopy/v1/generated/validators/requestResource.zod.js +2 -0
- package/dist/canopy/v1/generated/validators/responseCreate.zod.d.ts +48 -0
- package/dist/canopy/v1/generated/validators/responseCreate.zod.js +48 -0
- package/dist/canopy/v1/generated/validators/responseDeleted.zod.d.ts +40 -0
- package/dist/canopy/v1/generated/validators/responseDeleted.zod.js +38 -0
- package/dist/canopy/v1/generated/validators/responseResource.zod.d.ts +36 -0
- package/dist/canopy/v1/generated/validators/responseResource.zod.js +34 -0
- package/dist/routes.d.ts +24 -0
- package/dist/routes.js +27 -0
- package/package.json +1 -1
|
@@ -30,13 +30,78 @@
|
|
|
30
30
|
* - **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 stated in each model's `pricing`.
|
|
31
31
|
* OpenAPI spec version: 1.0.0
|
|
32
32
|
*/
|
|
33
|
-
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, Quote, RequestResource, ServiceResource, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
|
|
33
|
+
import type { APIKeyResource, APIKeyUsageListResponseBody, ChatCompletion, ChatCompletionRequest, ConflictResponse, CreateAPIKeyRequestBody, CreateServiceRequestBody, CreateServiceResponseBody, CursorPageRequestResource, EmbeddingRequest, EmbeddingResponse, Error, GetUsageSummaryParams, GetUsageTimelineParams, InferenceError, IssuedAPIKeyResource, LengthAwarePageAPIKeyResource, ListApiKeysParams, ListRequestsParams, ListUsageByApiKeyParams, ListUsageByModelParams, Model, ModelList, ModelListResponseBody, ModelResource, ModelUsageListResponseBody, Quote, RequestResource, ResponseCreate, ResponseDeleted, ResponseResource, ServiceResource, TotalsResource, UpdateAPIKeyRequestBody, UsageTimelineResponseBody } from "./models.js";
|
|
34
34
|
export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
|
|
35
35
|
export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
|
|
36
36
|
export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
|
|
37
37
|
export type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;
|
|
38
38
|
export type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
39
39
|
export type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;
|
|
40
|
+
export type createResponseResponse200ApplicationJson = {
|
|
41
|
+
data: ResponseResource;
|
|
42
|
+
status: 200;
|
|
43
|
+
};
|
|
44
|
+
export type createResponseResponse200TextEventStream = {
|
|
45
|
+
data: Blob;
|
|
46
|
+
status: 200;
|
|
47
|
+
};
|
|
48
|
+
export type createResponseResponseDefault = {
|
|
49
|
+
data: InferenceError;
|
|
50
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
51
|
+
};
|
|
52
|
+
export type createResponseResponseSuccess = (createResponseResponse200ApplicationJson | createResponseResponse200TextEventStream) & {
|
|
53
|
+
headers: Headers;
|
|
54
|
+
};
|
|
55
|
+
export type createResponseResponseError = createResponseResponseDefault & {
|
|
56
|
+
headers: Headers;
|
|
57
|
+
};
|
|
58
|
+
export type createResponseResponse = createResponseResponseSuccess | createResponseResponseError;
|
|
59
|
+
export declare const getCreateResponseUrl: () => string;
|
|
60
|
+
/**
|
|
61
|
+
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
62
|
+
* @summary Create a model response
|
|
63
|
+
*/
|
|
64
|
+
export declare const createResponse: (responseCreate: ResponseCreate, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<createResponseResponse>;
|
|
65
|
+
export type getResponseResponse200 = {
|
|
66
|
+
data: ResponseResource;
|
|
67
|
+
status: 200;
|
|
68
|
+
};
|
|
69
|
+
export type getResponseResponseDefault = {
|
|
70
|
+
data: InferenceError;
|
|
71
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
72
|
+
};
|
|
73
|
+
export type getResponseResponseSuccess = getResponseResponse200 & {
|
|
74
|
+
headers: Headers;
|
|
75
|
+
};
|
|
76
|
+
export type getResponseResponseError = getResponseResponseDefault & {
|
|
77
|
+
headers: Headers;
|
|
78
|
+
};
|
|
79
|
+
export type getResponseResponse = getResponseResponseSuccess | getResponseResponseError;
|
|
80
|
+
export declare const getGetResponseUrl: (response: string) => string;
|
|
81
|
+
/**
|
|
82
|
+
* @summary Get a stored response
|
|
83
|
+
*/
|
|
84
|
+
export declare const getResponse: (response: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<getResponseResponse>;
|
|
85
|
+
export type deleteResponseResponse200 = {
|
|
86
|
+
data: ResponseDeleted;
|
|
87
|
+
status: 200;
|
|
88
|
+
};
|
|
89
|
+
export type deleteResponseResponseDefault = {
|
|
90
|
+
data: InferenceError;
|
|
91
|
+
status: Exclude<HTTPStatusCodes, 200>;
|
|
92
|
+
};
|
|
93
|
+
export type deleteResponseResponseSuccess = deleteResponseResponse200 & {
|
|
94
|
+
headers: Headers;
|
|
95
|
+
};
|
|
96
|
+
export type deleteResponseResponseError = deleteResponseResponseDefault & {
|
|
97
|
+
headers: Headers;
|
|
98
|
+
};
|
|
99
|
+
export type deleteResponseResponse = deleteResponseResponseSuccess | deleteResponseResponseError;
|
|
100
|
+
export declare const getDeleteResponseUrl: (response: string) => string;
|
|
101
|
+
/**
|
|
102
|
+
* @summary Delete a stored response
|
|
103
|
+
*/
|
|
104
|
+
export declare const deleteResponse: (response: string, options?: RequestInit, fetchFn?: typeof globalThis.fetch) => Promise<deleteResponseResponse>;
|
|
40
105
|
export type createChatCompletionResponse200ApplicationJson = {
|
|
41
106
|
data: ChatCompletion;
|
|
42
107
|
status: 200;
|
|
@@ -1,3 +1,70 @@
|
|
|
1
|
+
export const getCreateResponseUrl = () => {
|
|
2
|
+
return `https://canopy.leaflow.cloud/v1/responses`;
|
|
3
|
+
};
|
|
4
|
+
/**
|
|
5
|
+
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
6
|
+
* @summary Create a model response
|
|
7
|
+
*/
|
|
8
|
+
export const createResponse = async (responseCreate, options, fetchFn) => {
|
|
9
|
+
const getHeaders = (h) => {
|
|
10
|
+
if (!h)
|
|
11
|
+
return {};
|
|
12
|
+
if (h instanceof Headers)
|
|
13
|
+
return Object.fromEntries(h.entries());
|
|
14
|
+
if (Symbol.iterator in h) {
|
|
15
|
+
return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
16
|
+
}
|
|
17
|
+
const headers = {};
|
|
18
|
+
for (const [name, value] of Object.entries(h)) {
|
|
19
|
+
if (value !== undefined)
|
|
20
|
+
headers[name] = value;
|
|
21
|
+
}
|
|
22
|
+
return headers;
|
|
23
|
+
};
|
|
24
|
+
const res = await (fetchFn ?? fetch)(getCreateResponseUrl(), {
|
|
25
|
+
...options,
|
|
26
|
+
method: "POST",
|
|
27
|
+
headers: { "Content-Type": "application/json", ...getHeaders(options?.headers) },
|
|
28
|
+
body: JSON.stringify(responseCreate),
|
|
29
|
+
});
|
|
30
|
+
const body = [204, 205, 304].includes(res.status)
|
|
31
|
+
? null
|
|
32
|
+
: res.headers.get("content-type")?.includes("application/json")
|
|
33
|
+
? JSON.parse(await res.text())
|
|
34
|
+
: await res.blob();
|
|
35
|
+
const data = body;
|
|
36
|
+
return { data, status: res.status, headers: res.headers };
|
|
37
|
+
};
|
|
38
|
+
export const getGetResponseUrl = (response) => {
|
|
39
|
+
return `https://canopy.leaflow.cloud/v1/responses/${encodeURIComponent(String(response))}`;
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* @summary Get a stored response
|
|
43
|
+
*/
|
|
44
|
+
export const getResponse = async (response, options, fetchFn) => {
|
|
45
|
+
const res = await (fetchFn ?? fetch)(getGetResponseUrl(response), {
|
|
46
|
+
...options,
|
|
47
|
+
method: "GET",
|
|
48
|
+
});
|
|
49
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
50
|
+
const data = body ? JSON.parse(body) : {};
|
|
51
|
+
return { data, status: res.status, headers: res.headers };
|
|
52
|
+
};
|
|
53
|
+
export const getDeleteResponseUrl = (response) => {
|
|
54
|
+
return `https://canopy.leaflow.cloud/v1/responses/${encodeURIComponent(String(response))}`;
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* @summary Delete a stored response
|
|
58
|
+
*/
|
|
59
|
+
export const deleteResponse = async (response, options, fetchFn) => {
|
|
60
|
+
const res = await (fetchFn ?? fetch)(getDeleteResponseUrl(response), {
|
|
61
|
+
...options,
|
|
62
|
+
method: "DELETE",
|
|
63
|
+
});
|
|
64
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text();
|
|
65
|
+
const data = body ? JSON.parse(body) : {};
|
|
66
|
+
return { data, status: res.status, headers: res.headers };
|
|
67
|
+
};
|
|
1
68
|
export const getCreateChatCompletionUrl = () => {
|
|
2
69
|
return `https://canopy.leaflow.cloud/v1/chat/completions`;
|
|
3
70
|
};
|
|
@@ -30,6 +30,23 @@
|
|
|
30
30
|
* - **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 stated in each model's `pricing`.
|
|
31
31
|
* OpenAPI spec version: 1.0.0
|
|
32
32
|
*/
|
|
33
|
+
export type ReasoningDiagnosticsRequested = {
|
|
34
|
+
[key: string]: unknown;
|
|
35
|
+
};
|
|
36
|
+
export type ReasoningDiagnosticsEffective = {
|
|
37
|
+
[key: string]: unknown;
|
|
38
|
+
};
|
|
39
|
+
export type ReasoningDiagnosticsTranslation = (typeof ReasoningDiagnosticsTranslation)[keyof typeof ReasoningDiagnosticsTranslation];
|
|
40
|
+
export declare const ReasoningDiagnosticsTranslation: {
|
|
41
|
+
readonly translate: "translate";
|
|
42
|
+
readonly passthrough: "passthrough";
|
|
43
|
+
readonly strip: "strip";
|
|
44
|
+
};
|
|
45
|
+
export interface ReasoningDiagnostics {
|
|
46
|
+
requested: ReasoningDiagnosticsRequested;
|
|
47
|
+
effective?: ReasoningDiagnosticsEffective;
|
|
48
|
+
translation?: ReasoningDiagnosticsTranslation;
|
|
49
|
+
}
|
|
33
50
|
export type ChatCompletionRequestMessagesItem = {
|
|
34
51
|
[key: string]: unknown;
|
|
35
52
|
};
|
|
@@ -68,6 +85,65 @@ export interface EmbeddingRequest {
|
|
|
68
85
|
export interface EmbeddingResponse {
|
|
69
86
|
[key: string]: unknown;
|
|
70
87
|
}
|
|
88
|
+
export type Modality = (typeof Modality)[keyof typeof Modality];
|
|
89
|
+
export declare const Modality: {
|
|
90
|
+
readonly text: "text";
|
|
91
|
+
readonly image: "image";
|
|
92
|
+
readonly audio: "audio";
|
|
93
|
+
readonly video: "video";
|
|
94
|
+
readonly file: "file";
|
|
95
|
+
readonly embedding: "embedding";
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* @nullable
|
|
99
|
+
*/
|
|
100
|
+
export type ReasoningCapabilitiesBudgetTokens = {
|
|
101
|
+
/** @minimum 0 */
|
|
102
|
+
min: number;
|
|
103
|
+
/** @minimum 0 */
|
|
104
|
+
max: number;
|
|
105
|
+
} | null;
|
|
106
|
+
export interface ReasoningCapabilities {
|
|
107
|
+
supported: boolean;
|
|
108
|
+
/**
|
|
109
|
+
* Null means unknown; an empty array means effort is not configurable.
|
|
110
|
+
* @nullable
|
|
111
|
+
*/
|
|
112
|
+
effort_levels: string[] | null;
|
|
113
|
+
/** @nullable */
|
|
114
|
+
default_effort: string | null;
|
|
115
|
+
/** @nullable */
|
|
116
|
+
modes: string[] | null;
|
|
117
|
+
/** @nullable */
|
|
118
|
+
budget_tokens: ReasoningCapabilitiesBudgetTokens;
|
|
119
|
+
/** @nullable */
|
|
120
|
+
summary: string[] | null;
|
|
121
|
+
}
|
|
122
|
+
export interface EndpointCapabilities {
|
|
123
|
+
/** @nullable */
|
|
124
|
+
function_calling: boolean | null;
|
|
125
|
+
/** @nullable */
|
|
126
|
+
structured_output: boolean | null;
|
|
127
|
+
reasoning: ReasoningCapabilities | null;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Verified capabilities keyed by API endpoint, for example /v1/chat/completions or /v1/responses. Missing keys and null values mean unknown. Current route availability is separate.
|
|
131
|
+
*/
|
|
132
|
+
export interface ModelCapabilities {
|
|
133
|
+
[key: string]: EndpointCapabilities;
|
|
134
|
+
}
|
|
135
|
+
export type ModelEndpoint = (typeof ModelEndpoint)[keyof typeof ModelEndpoint];
|
|
136
|
+
export declare const ModelEndpoint: {
|
|
137
|
+
readonly "/v1/chat/completions": "/v1/chat/completions";
|
|
138
|
+
readonly "/v1/responses": "/v1/responses";
|
|
139
|
+
readonly "/v1/embeddings": "/v1/embeddings";
|
|
140
|
+
readonly "/v1/images/generations": "/v1/images/generations";
|
|
141
|
+
readonly "/v1/images/edits": "/v1/images/edits";
|
|
142
|
+
readonly "/v1/audio/transcriptions": "/v1/audio/transcriptions";
|
|
143
|
+
readonly "/v1/audio/translations": "/v1/audio/translations";
|
|
144
|
+
readonly "/v1/audio/speech": "/v1/audio/speech";
|
|
145
|
+
readonly "/v1/realtime": "/v1/realtime";
|
|
146
|
+
};
|
|
71
147
|
export interface Model {
|
|
72
148
|
id: string;
|
|
73
149
|
object: "model";
|
|
@@ -76,10 +152,22 @@ export interface Model {
|
|
|
76
152
|
display_name: string;
|
|
77
153
|
context_length: number;
|
|
78
154
|
max_output_tokens: number;
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
155
|
+
/** The model developer; not the upstream provider or model family. */
|
|
156
|
+
developer: string;
|
|
157
|
+
description: string;
|
|
158
|
+
/**
|
|
159
|
+
* Accepted input modalities. Null means unknown.
|
|
160
|
+
* @nullable
|
|
161
|
+
*/
|
|
162
|
+
input_modalities: Modality[] | null;
|
|
163
|
+
/**
|
|
164
|
+
* Produced output modalities. Image input does not imply image generation.
|
|
165
|
+
* @nullable
|
|
166
|
+
*/
|
|
167
|
+
output_modalities: Modality[] | null;
|
|
168
|
+
capabilities: ModelCapabilities;
|
|
169
|
+
/** Explicitly supported API endpoints. Requests to any other endpoint are rejected before upstream admission. */
|
|
170
|
+
supported_endpoints: ModelEndpoint[];
|
|
83
171
|
}
|
|
84
172
|
export interface ModelList {
|
|
85
173
|
object: "list";
|
|
@@ -290,12 +378,23 @@ export interface ModelResource {
|
|
|
290
378
|
max_output_tokens: number;
|
|
291
379
|
/** What requests to this model cost. Null when the project has no billing account. */
|
|
292
380
|
pricing: ModelPricing | null;
|
|
293
|
-
/** The values accepted for `reasoning_effort`. Empty means it is not supported */
|
|
294
|
-
reasoning_tiers: string[];
|
|
295
381
|
status: ModelResourceStatus;
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
382
|
+
/** The model developer; not the upstream provider or model family. */
|
|
383
|
+
developer: string;
|
|
384
|
+
description: string;
|
|
385
|
+
/**
|
|
386
|
+
* Accepted input modalities. Null means unknown.
|
|
387
|
+
* @nullable
|
|
388
|
+
*/
|
|
389
|
+
input_modalities: Modality[] | null;
|
|
390
|
+
/**
|
|
391
|
+
* Produced output modalities. Image input does not imply image generation.
|
|
392
|
+
* @nullable
|
|
393
|
+
*/
|
|
394
|
+
output_modalities: Modality[] | null;
|
|
395
|
+
capabilities: ModelCapabilities;
|
|
396
|
+
/** Explicitly supported API endpoints. Requests to any other endpoint are rejected before upstream admission. */
|
|
397
|
+
supported_endpoints: ModelEndpoint[];
|
|
299
398
|
}
|
|
300
399
|
export interface ModelListResponseBody {
|
|
301
400
|
items: ModelResource[];
|
|
@@ -348,6 +447,7 @@ export interface RequestResource {
|
|
|
348
447
|
upstream_status: number;
|
|
349
448
|
/** upstream means the figures were reported by the provider; estimated means they were derived from the character classes of the payload */
|
|
350
449
|
usage_source: RequestResourceUsageSource;
|
|
450
|
+
reasoning: ReasoningDiagnostics | null;
|
|
351
451
|
}
|
|
352
452
|
export interface CursorPageRequestResource {
|
|
353
453
|
/** The items in this page */
|
|
@@ -659,6 +759,38 @@ export interface Quote {
|
|
|
659
759
|
*/
|
|
660
760
|
refundable_amount: Money | null;
|
|
661
761
|
}
|
|
762
|
+
export type ResponseCreateReasoning = {
|
|
763
|
+
[key: string]: unknown;
|
|
764
|
+
};
|
|
765
|
+
export type ResponseCreateToolsItem = {
|
|
766
|
+
[key: string]: unknown;
|
|
767
|
+
};
|
|
768
|
+
/**
|
|
769
|
+
* Native Responses request. model may be omitted when continuing a project-owned stored response. store defaults to false. Only caller-executed function and custom tools are supported. background, conversation and WebSocket-only fields are rejected over HTTP.
|
|
770
|
+
*/
|
|
771
|
+
export interface ResponseCreate {
|
|
772
|
+
model?: string;
|
|
773
|
+
input?: unknown;
|
|
774
|
+
/** @nullable */
|
|
775
|
+
instructions?: string | null;
|
|
776
|
+
store?: boolean;
|
|
777
|
+
stream?: boolean;
|
|
778
|
+
/** @nullable */
|
|
779
|
+
previous_response_id?: string | null;
|
|
780
|
+
reasoning?: ResponseCreateReasoning;
|
|
781
|
+
tools?: ResponseCreateToolsItem[];
|
|
782
|
+
/** @minimum 1 */
|
|
783
|
+
max_output_tokens?: number;
|
|
784
|
+
[key: string]: unknown;
|
|
785
|
+
}
|
|
786
|
+
export interface ResponseResource {
|
|
787
|
+
[key: string]: unknown;
|
|
788
|
+
}
|
|
789
|
+
export interface ResponseDeleted {
|
|
790
|
+
id: string;
|
|
791
|
+
object: string;
|
|
792
|
+
deleted: boolean;
|
|
793
|
+
}
|
|
662
794
|
/**
|
|
663
795
|
* Pagination metadata for stable numbered pages. total_count is returned only when the operation can determine it without an unbounded scan.
|
|
664
796
|
*/
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
+
export const ReasoningDiagnosticsTranslation = {
|
|
2
|
+
translate: "translate",
|
|
3
|
+
passthrough: "passthrough",
|
|
4
|
+
strip: "strip",
|
|
5
|
+
};
|
|
1
6
|
export const EmbeddingRequestEncodingFormat = {
|
|
2
7
|
float: "float",
|
|
3
8
|
base64: "base64",
|
|
4
9
|
};
|
|
10
|
+
export const Modality = {
|
|
11
|
+
text: "text",
|
|
12
|
+
image: "image",
|
|
13
|
+
audio: "audio",
|
|
14
|
+
video: "video",
|
|
15
|
+
file: "file",
|
|
16
|
+
embedding: "embedding",
|
|
17
|
+
};
|
|
18
|
+
export const ModelEndpoint = {
|
|
19
|
+
"/v1/chat/completions": "/v1/chat/completions",
|
|
20
|
+
"/v1/responses": "/v1/responses",
|
|
21
|
+
"/v1/embeddings": "/v1/embeddings",
|
|
22
|
+
"/v1/images/generations": "/v1/images/generations",
|
|
23
|
+
"/v1/images/edits": "/v1/images/edits",
|
|
24
|
+
"/v1/audio/transcriptions": "/v1/audio/transcriptions",
|
|
25
|
+
"/v1/audio/translations": "/v1/audio/translations",
|
|
26
|
+
"/v1/audio/speech": "/v1/audio/speech",
|
|
27
|
+
"/v1/realtime": "/v1/realtime",
|
|
28
|
+
};
|
|
5
29
|
export const APIKeyResourceStatus = {
|
|
6
30
|
active: "active",
|
|
7
31
|
disabled: "disabled",
|
|
@@ -31,6 +31,33 @@
|
|
|
31
31
|
* OpenAPI spec version: 1.0.0
|
|
32
32
|
*/
|
|
33
33
|
import * as zod from "zod";
|
|
34
|
+
/**
|
|
35
|
+
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
36
|
+
* @summary Create a model response
|
|
37
|
+
*/
|
|
38
|
+
export declare const CreateResponseBody: zod.ZodObject<{
|
|
39
|
+
model: zod.ZodOptional<zod.ZodString>;
|
|
40
|
+
input: zod.ZodOptional<zod.ZodUnknown>;
|
|
41
|
+
instructions: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
42
|
+
store: zod.ZodDefault<zod.ZodBoolean>;
|
|
43
|
+
stream: zod.ZodDefault<zod.ZodBoolean>;
|
|
44
|
+
previous_response_id: zod.ZodOptional<zod.ZodNullable<zod.ZodString>>;
|
|
45
|
+
reasoning: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
|
|
46
|
+
tools: zod.ZodOptional<zod.ZodArray<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>>;
|
|
47
|
+
max_output_tokens: zod.ZodOptional<zod.ZodInt>;
|
|
48
|
+
}, zod.z.core.$strict>;
|
|
49
|
+
/**
|
|
50
|
+
* @summary Get a stored response
|
|
51
|
+
*/
|
|
52
|
+
export declare const GetResponseParams: zod.ZodObject<{
|
|
53
|
+
response: zod.ZodString;
|
|
54
|
+
}, zod.z.core.$strict>;
|
|
55
|
+
/**
|
|
56
|
+
* @summary Delete a stored response
|
|
57
|
+
*/
|
|
58
|
+
export declare const DeleteResponseParams: zod.ZodObject<{
|
|
59
|
+
response: zod.ZodString;
|
|
60
|
+
}, zod.z.core.$strict>;
|
|
34
61
|
/**
|
|
35
62
|
* Authenticated project inference. Billing ownership comes only from the verified project token; no Canopy API key or project header is required.
|
|
36
63
|
* @summary Create a chat completion
|
|
@@ -35,7 +35,25 @@ import { ChatCompletionRequest } from "./validators/chatCompletionRequest.zod.js
|
|
|
35
35
|
import { CreateAPIKeyRequestBody } from "./validators/createAPIKeyRequestBody.zod.js";
|
|
36
36
|
import { CreateServiceRequestBody } from "./validators/createServiceRequestBody.zod.js";
|
|
37
37
|
import { EmbeddingRequest } from "./validators/embeddingRequest.zod.js";
|
|
38
|
+
import { ResponseCreate } from "./validators/responseCreate.zod.js";
|
|
38
39
|
import { UpdateAPIKeyRequestBody } from "./validators/updateAPIKeyRequestBody.zod.js";
|
|
40
|
+
/**
|
|
41
|
+
* Supports JSON, SSE and native upstream response storage. Stored continuation is restricted to the current project and original provider credential. WebSocket clients connect with GET /v1/responses and send response.create events; one response may be active on a connection at a time. The connection stays on its initial model and provider credential.
|
|
42
|
+
* @summary Create a model response
|
|
43
|
+
*/
|
|
44
|
+
export const CreateResponseBody = ResponseCreate;
|
|
45
|
+
/**
|
|
46
|
+
* @summary Get a stored response
|
|
47
|
+
*/
|
|
48
|
+
export const GetResponseParams = zod.strictObject({
|
|
49
|
+
response: zod.string(),
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* @summary Delete a stored response
|
|
53
|
+
*/
|
|
54
|
+
export const DeleteResponseParams = zod.strictObject({
|
|
55
|
+
response: zod.string(),
|
|
56
|
+
});
|
|
39
57
|
/**
|
|
40
58
|
* Authenticated project inference. Billing ownership comes only from the verified project token; no Canopy API key or project header is required.
|
|
41
59
|
* @summary Create a chat completion
|
|
@@ -61,6 +61,15 @@ export declare const CursorPageRequestResource: zod.ZodObject<{
|
|
|
61
61
|
upstream: "upstream";
|
|
62
62
|
estimated: "estimated";
|
|
63
63
|
}>;
|
|
64
|
+
reasoning: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
65
|
+
requested: zod.ZodRecord<zod.ZodString, zod.ZodUnknown>;
|
|
66
|
+
effective: zod.ZodOptional<zod.ZodRecord<zod.ZodString, zod.ZodUnknown>>;
|
|
67
|
+
translation: zod.ZodOptional<zod.ZodEnum<{
|
|
68
|
+
translate: "translate";
|
|
69
|
+
passthrough: "passthrough";
|
|
70
|
+
strip: "strip";
|
|
71
|
+
}>>;
|
|
72
|
+
}, zod.z.core.$strict>, zod.ZodNull]>;
|
|
64
73
|
}, zod.z.core.$strict>>;
|
|
65
74
|
next_cursor: zod.ZodString;
|
|
66
75
|
}, zod.z.core.$strict>;
|
|
@@ -0,0 +1,50 @@
|
|
|
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
|
+
* OpenAI-compatible project inference is served on this host at `/v1/chat/completions`,
|
|
8
|
+
* `/v1/embeddings`, `/v1/models` and `/v1/models/{model}`. Use `https://canopy.leaflow.cloud/v1`
|
|
9
|
+
* as the OpenAI SDK base URL. Chat completions support `stream=true` SSE.
|
|
10
|
+
*
|
|
11
|
+
* Management operations use `/api/v1`. The management model catalogue includes pricing;
|
|
12
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
13
|
+
*
|
|
14
|
+
* ## Authentication
|
|
15
|
+
*
|
|
16
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
17
|
+
*
|
|
18
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
19
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
20
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
21
|
+
* accepts Canopy API keys and supports OpenAI, Anthropic and Gemini request formats.
|
|
22
|
+
*
|
|
23
|
+
* ## Conventions
|
|
24
|
+
*
|
|
25
|
+
* - **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.
|
|
26
|
+
* - **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.
|
|
27
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
28
|
+
* - **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.
|
|
29
|
+
* - **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.
|
|
30
|
+
* - **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 stated in each model's `pricing`.
|
|
31
|
+
* OpenAPI spec version: 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
import * as zod from "zod";
|
|
34
|
+
export declare const EndpointCapabilities: zod.ZodObject<{
|
|
35
|
+
function_calling: zod.ZodNullable<zod.ZodBoolean>;
|
|
36
|
+
structured_output: zod.ZodNullable<zod.ZodBoolean>;
|
|
37
|
+
reasoning: zod.ZodUnion<readonly [zod.ZodObject<{
|
|
38
|
+
supported: zod.ZodBoolean;
|
|
39
|
+
effort_levels: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
|
|
40
|
+
default_effort: zod.ZodNullable<zod.ZodString>;
|
|
41
|
+
modes: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
|
|
42
|
+
budget_tokens: zod.ZodNullable<zod.ZodObject<{
|
|
43
|
+
min: zod.ZodInt;
|
|
44
|
+
max: zod.ZodInt;
|
|
45
|
+
}, zod.z.core.$strict>>;
|
|
46
|
+
summary: zod.ZodNullable<zod.ZodArray<zod.ZodString>>;
|
|
47
|
+
}, zod.z.core.$strict>, zod.ZodNull]>;
|
|
48
|
+
}, zod.z.core.$strict>;
|
|
49
|
+
export type EndpointCapabilities = zod.input<typeof EndpointCapabilities>;
|
|
50
|
+
export type EndpointCapabilitiesOutput = zod.output<typeof EndpointCapabilities>;
|
|
@@ -0,0 +1,39 @@
|
|
|
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
|
+
* OpenAI-compatible project inference is served on this host at `/v1/chat/completions`,
|
|
8
|
+
* `/v1/embeddings`, `/v1/models` and `/v1/models/{model}`. Use `https://canopy.leaflow.cloud/v1`
|
|
9
|
+
* as the OpenAI SDK base URL. Chat completions support `stream=true` SSE.
|
|
10
|
+
*
|
|
11
|
+
* Management operations use `/api/v1`. The management model catalogue includes pricing;
|
|
12
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
13
|
+
*
|
|
14
|
+
* ## Authentication
|
|
15
|
+
*
|
|
16
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
17
|
+
*
|
|
18
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
19
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
20
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
21
|
+
* accepts Canopy API keys and supports OpenAI, Anthropic and Gemini request formats.
|
|
22
|
+
*
|
|
23
|
+
* ## Conventions
|
|
24
|
+
*
|
|
25
|
+
* - **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.
|
|
26
|
+
* - **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.
|
|
27
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
28
|
+
* - **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.
|
|
29
|
+
* - **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.
|
|
30
|
+
* - **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 stated in each model's `pricing`.
|
|
31
|
+
* OpenAPI spec version: 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
import * as zod from "zod";
|
|
34
|
+
import { ReasoningCapabilities } from "./reasoningCapabilities.zod.js";
|
|
35
|
+
export const EndpointCapabilities = zod.strictObject({
|
|
36
|
+
function_calling: zod.boolean().nullable(),
|
|
37
|
+
structured_output: zod.boolean().nullable(),
|
|
38
|
+
reasoning: zod.union([ReasoningCapabilities, zod.null()]),
|
|
39
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
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
|
+
* OpenAI-compatible project inference is served on this host at `/v1/chat/completions`,
|
|
8
|
+
* `/v1/embeddings`, `/v1/models` and `/v1/models/{model}`. Use `https://canopy.leaflow.cloud/v1`
|
|
9
|
+
* as the OpenAI SDK base URL. Chat completions support `stream=true` SSE.
|
|
10
|
+
*
|
|
11
|
+
* Management operations use `/api/v1`. The management model catalogue includes pricing;
|
|
12
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
13
|
+
*
|
|
14
|
+
* ## Authentication
|
|
15
|
+
*
|
|
16
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
17
|
+
*
|
|
18
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
19
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
20
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
21
|
+
* accepts Canopy API keys and supports OpenAI, Anthropic and Gemini request formats.
|
|
22
|
+
*
|
|
23
|
+
* ## Conventions
|
|
24
|
+
*
|
|
25
|
+
* - **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.
|
|
26
|
+
* - **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.
|
|
27
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
28
|
+
* - **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.
|
|
29
|
+
* - **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.
|
|
30
|
+
* - **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 stated in each model's `pricing`.
|
|
31
|
+
* OpenAPI spec version: 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
import * as zod from "zod";
|
|
34
|
+
export declare const Modality: zod.ZodEnum<{
|
|
35
|
+
file: "file";
|
|
36
|
+
text: "text";
|
|
37
|
+
image: "image";
|
|
38
|
+
audio: "audio";
|
|
39
|
+
video: "video";
|
|
40
|
+
embedding: "embedding";
|
|
41
|
+
}>;
|
|
42
|
+
export type Modality = zod.input<typeof Modality>;
|
|
43
|
+
export type ModalityOutput = zod.output<typeof Modality>;
|
|
@@ -0,0 +1,34 @@
|
|
|
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
|
+
* OpenAI-compatible project inference is served on this host at `/v1/chat/completions`,
|
|
8
|
+
* `/v1/embeddings`, `/v1/models` and `/v1/models/{model}`. Use `https://canopy.leaflow.cloud/v1`
|
|
9
|
+
* as the OpenAI SDK base URL. Chat completions support `stream=true` SSE.
|
|
10
|
+
*
|
|
11
|
+
* Management operations use `/api/v1`. The management model catalogue includes pricing;
|
|
12
|
+
* `/v1/models` returns the OpenAI model format with Canopy capabilities and parameter limits.
|
|
13
|
+
*
|
|
14
|
+
* ## Authentication
|
|
15
|
+
*
|
|
16
|
+
* Every request carries a scoped token; see the `bearerAuth` security scheme.
|
|
17
|
+
*
|
|
18
|
+
* Management and project inference accept the same verified IAM scoped token. The token is the
|
|
19
|
+
* sole billing project authority; `OpenAI-Project` and historical identity headers cannot
|
|
20
|
+
* override it. These endpoints do not accept a Canopy API key. The separate API-key gateway
|
|
21
|
+
* accepts Canopy API keys and supports OpenAI, Anthropic and Gemini request formats.
|
|
22
|
+
*
|
|
23
|
+
* ## Conventions
|
|
24
|
+
*
|
|
25
|
+
* - **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.
|
|
26
|
+
* - **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.
|
|
27
|
+
* - **A usage query must carry a time range**, spanning no more than 31 days. `from` and `to` carry a timezone offset, which the server does not infer.
|
|
28
|
+
* - **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.
|
|
29
|
+
* - **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.
|
|
30
|
+
* - **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 stated in each model's `pricing`.
|
|
31
|
+
* OpenAPI spec version: 1.0.0
|
|
32
|
+
*/
|
|
33
|
+
import * as zod from "zod";
|
|
34
|
+
export const Modality = zod.enum(["text", "image", "audio", "video", "file", "embedding"]);
|