@astrale-domains/ai-gateway 0.2.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/README.md +37 -0
- package/dist/schema/application/index.d.ts +321 -0
- package/dist/schema/application/index.js +9 -0
- package/dist/schema/index.d.ts +3 -0
- package/dist/schema/index.js +2 -0
- package/dist/schema/model/class.d.ts +307 -0
- package/dist/schema/model/class.js +70 -0
- package/dist/schema/model/index.d.ts +1 -0
- package/dist/schema/model/index.js +1 -0
- package/package.json +75 -0
package/README.md
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# AI Gateway
|
|
2
|
+
|
|
3
|
+
`ai-gateway.astrale.ai` exposes configured language models as permissioned Astrale graph nodes.
|
|
4
|
+
Each `AIModel` pins its upstream Provider and model id. Holding authority on that node is required
|
|
5
|
+
before inference crosses the Cloudflare AI Gateway boundary.
|
|
6
|
+
|
|
7
|
+
## Current Application model
|
|
8
|
+
|
|
9
|
+
- `AIModel.register` is a static authorized Action that creates one model node.
|
|
10
|
+
- `AIModel.list` is a static authenticated Action backed by a graph Query.
|
|
11
|
+
- `AIModel.invoke` performs provider-native passthrough with caller credentials removed.
|
|
12
|
+
- the OpenAI, Anthropic, and Vercel format Methods adapt a caller protocol while retaining the
|
|
13
|
+
model and Provider selected by the node.
|
|
14
|
+
- `model-gateway` is the sole provider-neutral Integration; its invocation is explicitly unsafe to
|
|
15
|
+
replay because inference may bill or create provider-side effects.
|
|
16
|
+
|
|
17
|
+
The current SDK does not expose an executable migration or post-install seed API. A fresh install
|
|
18
|
+
therefore registers catalog nodes explicitly through `AIModel.register`; this migration does not
|
|
19
|
+
pretend the legacy Core seed still runs. Existing nodes at the same origin/class remain compatible.
|
|
20
|
+
|
|
21
|
+
Current binary Function results contain admitted bytes and media type, not a live `Response` body.
|
|
22
|
+
Upstream streaming requests are consequently buffered; Anthropic streaming is rejected explicitly
|
|
23
|
+
instead of being mislabeled as replay-safe streaming.
|
|
24
|
+
|
|
25
|
+
## Development
|
|
26
|
+
|
|
27
|
+
Copy `.env.example` to `.env.dev`, configure Cloudflare and any optional Google/Azure credentials,
|
|
28
|
+
then run:
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
pnpm typecheck
|
|
32
|
+
pnpm test
|
|
33
|
+
pnpm lint
|
|
34
|
+
pnpm frontend:build
|
|
35
|
+
pnpm build
|
|
36
|
+
pnpm package
|
|
37
|
+
```
|
|
@@ -0,0 +1,321 @@
|
|
|
1
|
+
import type { schema as language } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { KernelSchema } from '@astrale-os/sdk/schema';
|
|
3
|
+
export declare const schema: import("@astrale-os/sdk/schema").DefinedSchema<"ai-gateway.astrale.ai", import("@astrale-os/sdk/schema").ResolvedDomainOfInput<"ai-gateway.astrale.ai", {
|
|
4
|
+
readonly dependencies: {
|
|
5
|
+
kernel: KernelSchema;
|
|
6
|
+
};
|
|
7
|
+
readonly classes: {
|
|
8
|
+
readonly AIModel: import("@astrale-os/sdk/schema").NodeClass<{
|
|
9
|
+
readonly depth: 1;
|
|
10
|
+
readonly abstract: false;
|
|
11
|
+
readonly extends: readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
12
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Named"> & {
|
|
13
|
+
readonly origin: "kernel.astrale.ai";
|
|
14
|
+
};
|
|
15
|
+
readonly kind: 'node';
|
|
16
|
+
readonly abstract: true;
|
|
17
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Named"> & {
|
|
18
|
+
readonly origin: "kernel.astrale.ai";
|
|
19
|
+
}, "kernel.astrale.ai:class.Named", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
20
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
21
|
+
readonly origin: "kernel.astrale.ai";
|
|
22
|
+
};
|
|
23
|
+
readonly kind: 'node';
|
|
24
|
+
readonly abstract: true;
|
|
25
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
26
|
+
readonly origin: "kernel.astrale.ai";
|
|
27
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "name", "kernel.astrale.ai:class.Named.property.name">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "name", "kernel.astrale.ai:class.Named.property.name">, never, never>, import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
28
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Descriptable"> & {
|
|
29
|
+
readonly origin: "kernel.astrale.ai";
|
|
30
|
+
};
|
|
31
|
+
readonly kind: 'node';
|
|
32
|
+
readonly abstract: true;
|
|
33
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Descriptable"> & {
|
|
34
|
+
readonly origin: "kernel.astrale.ai";
|
|
35
|
+
}, "kernel.astrale.ai:class.Descriptable", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
36
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
37
|
+
readonly origin: "kernel.astrale.ai";
|
|
38
|
+
};
|
|
39
|
+
readonly kind: 'node';
|
|
40
|
+
readonly abstract: true;
|
|
41
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
42
|
+
readonly origin: "kernel.astrale.ai";
|
|
43
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, false, "description", "kernel.astrale.ai:class.Descriptable.property.description">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, false, "description", "kernel.astrale.ai:class.Descriptable.property.description">, never, never>, import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
44
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Timestamped"> & {
|
|
45
|
+
readonly origin: "kernel.astrale.ai";
|
|
46
|
+
};
|
|
47
|
+
readonly kind: 'node';
|
|
48
|
+
readonly abstract: true;
|
|
49
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Timestamped"> & {
|
|
50
|
+
readonly origin: "kernel.astrale.ai";
|
|
51
|
+
}, "kernel.astrale.ai:class.Timestamped", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
52
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
53
|
+
readonly origin: "kernel.astrale.ai";
|
|
54
|
+
};
|
|
55
|
+
readonly kind: 'node';
|
|
56
|
+
readonly abstract: true;
|
|
57
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
58
|
+
readonly origin: "kernel.astrale.ai";
|
|
59
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt"> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt"> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt">, never, never>];
|
|
60
|
+
readonly properties: {
|
|
61
|
+
readonly modelId: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "modelId", "self">;
|
|
62
|
+
readonly provider: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"azure" | "google" | "workers-ai", "azure" | "google" | "workers-ai", true, "provider", "self">;
|
|
63
|
+
readonly contextWindow: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "contextWindow", "self">;
|
|
64
|
+
readonly maxOutputTokens: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "maxOutputTokens", "self">;
|
|
65
|
+
readonly modality: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
66
|
+
input: string[];
|
|
67
|
+
output: string[];
|
|
68
|
+
}, {
|
|
69
|
+
input: string[];
|
|
70
|
+
output: string[];
|
|
71
|
+
}, true, "modality", "self">;
|
|
72
|
+
readonly capabilities: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
73
|
+
toolUse: boolean;
|
|
74
|
+
vision: boolean;
|
|
75
|
+
reasoning: boolean;
|
|
76
|
+
fileInput: boolean;
|
|
77
|
+
structuredOutput: boolean;
|
|
78
|
+
streaming: boolean;
|
|
79
|
+
caching: boolean;
|
|
80
|
+
}, {
|
|
81
|
+
toolUse: boolean;
|
|
82
|
+
vision: boolean;
|
|
83
|
+
reasoning: boolean;
|
|
84
|
+
fileInput: boolean;
|
|
85
|
+
structuredOutput: boolean;
|
|
86
|
+
streaming: boolean;
|
|
87
|
+
caching: boolean;
|
|
88
|
+
}, true, "capabilities", "self">;
|
|
89
|
+
readonly pricing: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<Record<string, string>, Record<string, string>, true, "pricing", "self">;
|
|
90
|
+
};
|
|
91
|
+
readonly methods: {
|
|
92
|
+
readonly register: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
93
|
+
name: string;
|
|
94
|
+
description?: string | undefined;
|
|
95
|
+
modelId: string;
|
|
96
|
+
provider: "azure" | "google" | "workers-ai";
|
|
97
|
+
contextWindow: number;
|
|
98
|
+
maxOutputTokens: number;
|
|
99
|
+
modality: {
|
|
100
|
+
input: string[];
|
|
101
|
+
output: string[];
|
|
102
|
+
};
|
|
103
|
+
capabilities: {
|
|
104
|
+
toolUse: boolean;
|
|
105
|
+
vision: boolean;
|
|
106
|
+
reasoning: boolean;
|
|
107
|
+
fileInput: boolean;
|
|
108
|
+
structuredOutput: boolean;
|
|
109
|
+
streaming: boolean;
|
|
110
|
+
caching: boolean;
|
|
111
|
+
};
|
|
112
|
+
pricing: Record<string, string>;
|
|
113
|
+
}, {
|
|
114
|
+
readonly mode: 'value';
|
|
115
|
+
readonly value: {
|
|
116
|
+
name: string;
|
|
117
|
+
modelId: string;
|
|
118
|
+
provider: "azure" | "google" | "workers-ai";
|
|
119
|
+
contextWindow: number;
|
|
120
|
+
maxOutputTokens: number;
|
|
121
|
+
modality: {
|
|
122
|
+
input: string[];
|
|
123
|
+
output: string[];
|
|
124
|
+
};
|
|
125
|
+
capabilities: {
|
|
126
|
+
toolUse: boolean;
|
|
127
|
+
vision: boolean;
|
|
128
|
+
reasoning: boolean;
|
|
129
|
+
fileInput: boolean;
|
|
130
|
+
structuredOutput: boolean;
|
|
131
|
+
streaming: boolean;
|
|
132
|
+
caching: boolean;
|
|
133
|
+
};
|
|
134
|
+
pricing: Record<string, string>;
|
|
135
|
+
id: string;
|
|
136
|
+
description: string;
|
|
137
|
+
};
|
|
138
|
+
}, "authorized", true, "default">>;
|
|
139
|
+
readonly list: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
140
|
+
readonly mode: 'value';
|
|
141
|
+
readonly value: {
|
|
142
|
+
name: string;
|
|
143
|
+
modelId: string;
|
|
144
|
+
provider: "azure" | "google" | "workers-ai";
|
|
145
|
+
contextWindow: number;
|
|
146
|
+
maxOutputTokens: number;
|
|
147
|
+
modality: {
|
|
148
|
+
input: string[];
|
|
149
|
+
output: string[];
|
|
150
|
+
};
|
|
151
|
+
capabilities: {
|
|
152
|
+
toolUse: boolean;
|
|
153
|
+
vision: boolean;
|
|
154
|
+
reasoning: boolean;
|
|
155
|
+
fileInput: boolean;
|
|
156
|
+
structuredOutput: boolean;
|
|
157
|
+
streaming: boolean;
|
|
158
|
+
caching: boolean;
|
|
159
|
+
};
|
|
160
|
+
pricing: Record<string, string>;
|
|
161
|
+
id: string;
|
|
162
|
+
description: string;
|
|
163
|
+
}[];
|
|
164
|
+
}, "authenticated", true, "default">>;
|
|
165
|
+
readonly invoke: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
166
|
+
path: string;
|
|
167
|
+
body: string;
|
|
168
|
+
headers?: Record<string, string> | undefined;
|
|
169
|
+
}, {
|
|
170
|
+
readonly mode: 'binary';
|
|
171
|
+
}, "authorized", false, "default">>;
|
|
172
|
+
readonly invokeOpenaiFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
173
|
+
body: string;
|
|
174
|
+
}, {
|
|
175
|
+
readonly mode: 'binary';
|
|
176
|
+
}, "authorized", false, "default">>;
|
|
177
|
+
readonly invokeAnthropicFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
178
|
+
body: string;
|
|
179
|
+
}, {
|
|
180
|
+
readonly mode: 'binary';
|
|
181
|
+
}, "authorized", false, "default">>;
|
|
182
|
+
readonly invokeVercelFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
183
|
+
body: string;
|
|
184
|
+
}, {
|
|
185
|
+
readonly mode: 'binary';
|
|
186
|
+
}, "authorized", false, "default">>;
|
|
187
|
+
};
|
|
188
|
+
readonly effectiveProperties: (import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
189
|
+
toolUse: boolean;
|
|
190
|
+
vision: boolean;
|
|
191
|
+
reasoning: boolean;
|
|
192
|
+
fileInput: boolean;
|
|
193
|
+
structuredOutput: boolean;
|
|
194
|
+
streaming: boolean;
|
|
195
|
+
caching: boolean;
|
|
196
|
+
}, {
|
|
197
|
+
toolUse: boolean;
|
|
198
|
+
vision: boolean;
|
|
199
|
+
reasoning: boolean;
|
|
200
|
+
fileInput: boolean;
|
|
201
|
+
structuredOutput: boolean;
|
|
202
|
+
streaming: boolean;
|
|
203
|
+
caching: boolean;
|
|
204
|
+
}, true, "capabilities", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "contextWindow", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "maxOutputTokens", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
205
|
+
input: string[];
|
|
206
|
+
output: string[];
|
|
207
|
+
}, {
|
|
208
|
+
input: string[];
|
|
209
|
+
output: string[];
|
|
210
|
+
}, true, "modality", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "modelId", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<Record<string, string>, Record<string, string>, true, "pricing", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"azure" | "google" | "workers-ai", "azure" | "google" | "workers-ai", true, "provider", "self">) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, false> & {
|
|
211
|
+
readonly name: "description";
|
|
212
|
+
readonly key: "kernel.astrale.ai:class.Descriptable.property.description";
|
|
213
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
214
|
+
readonly name: "createdAt";
|
|
215
|
+
readonly key: "kernel.astrale.ai:class.Timestamped.property.createdAt";
|
|
216
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
217
|
+
readonly name: "name";
|
|
218
|
+
readonly key: "kernel.astrale.ai:class.Named.property.name";
|
|
219
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
220
|
+
readonly name: "updatedAt";
|
|
221
|
+
readonly key: "kernel.astrale.ai:class.Timestamped.property.updatedAt";
|
|
222
|
+
});
|
|
223
|
+
readonly effectiveInstanceMethods: import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
224
|
+
path: string;
|
|
225
|
+
body: string;
|
|
226
|
+
headers?: Record<string, string> | undefined;
|
|
227
|
+
}, {
|
|
228
|
+
readonly mode: 'binary';
|
|
229
|
+
}, "authorized", false, "default">>, "invoke", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
230
|
+
body: string;
|
|
231
|
+
}, {
|
|
232
|
+
readonly mode: 'binary';
|
|
233
|
+
}, "authorized", false, "default">>, "invokeOpenaiFormat", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
234
|
+
body: string;
|
|
235
|
+
}, {
|
|
236
|
+
readonly mode: 'binary';
|
|
237
|
+
}, "authorized", false, "default">>, "invokeAnthropicFormat", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
238
|
+
body: string;
|
|
239
|
+
}, {
|
|
240
|
+
readonly mode: 'binary';
|
|
241
|
+
}, "authorized", false, "default">>, "invokeVercelFormat", "self">;
|
|
242
|
+
readonly effectiveStaticMethods: import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
243
|
+
readonly mode: 'value';
|
|
244
|
+
readonly value: {
|
|
245
|
+
name: string;
|
|
246
|
+
modelId: string;
|
|
247
|
+
provider: "azure" | "google" | "workers-ai";
|
|
248
|
+
contextWindow: number;
|
|
249
|
+
maxOutputTokens: number;
|
|
250
|
+
modality: {
|
|
251
|
+
input: string[];
|
|
252
|
+
output: string[];
|
|
253
|
+
};
|
|
254
|
+
capabilities: {
|
|
255
|
+
toolUse: boolean;
|
|
256
|
+
vision: boolean;
|
|
257
|
+
reasoning: boolean;
|
|
258
|
+
fileInput: boolean;
|
|
259
|
+
structuredOutput: boolean;
|
|
260
|
+
streaming: boolean;
|
|
261
|
+
caching: boolean;
|
|
262
|
+
};
|
|
263
|
+
pricing: Record<string, string>;
|
|
264
|
+
id: string;
|
|
265
|
+
description: string;
|
|
266
|
+
}[];
|
|
267
|
+
}, "authenticated", true, "default">>, "list", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
268
|
+
name: string;
|
|
269
|
+
description?: string | undefined;
|
|
270
|
+
modelId: string;
|
|
271
|
+
provider: "azure" | "google" | "workers-ai";
|
|
272
|
+
contextWindow: number;
|
|
273
|
+
maxOutputTokens: number;
|
|
274
|
+
modality: {
|
|
275
|
+
input: string[];
|
|
276
|
+
output: string[];
|
|
277
|
+
};
|
|
278
|
+
capabilities: {
|
|
279
|
+
toolUse: boolean;
|
|
280
|
+
vision: boolean;
|
|
281
|
+
reasoning: boolean;
|
|
282
|
+
fileInput: boolean;
|
|
283
|
+
structuredOutput: boolean;
|
|
284
|
+
streaming: boolean;
|
|
285
|
+
caching: boolean;
|
|
286
|
+
};
|
|
287
|
+
pricing: Record<string, string>;
|
|
288
|
+
}, {
|
|
289
|
+
readonly mode: 'value';
|
|
290
|
+
readonly value: {
|
|
291
|
+
name: string;
|
|
292
|
+
modelId: string;
|
|
293
|
+
provider: "azure" | "google" | "workers-ai";
|
|
294
|
+
contextWindow: number;
|
|
295
|
+
maxOutputTokens: number;
|
|
296
|
+
modality: {
|
|
297
|
+
input: string[];
|
|
298
|
+
output: string[];
|
|
299
|
+
};
|
|
300
|
+
capabilities: {
|
|
301
|
+
toolUse: boolean;
|
|
302
|
+
vision: boolean;
|
|
303
|
+
reasoning: boolean;
|
|
304
|
+
fileInput: boolean;
|
|
305
|
+
structuredOutput: boolean;
|
|
306
|
+
streaming: boolean;
|
|
307
|
+
caching: boolean;
|
|
308
|
+
};
|
|
309
|
+
pricing: Record<string, string>;
|
|
310
|
+
id: string;
|
|
311
|
+
description: string;
|
|
312
|
+
};
|
|
313
|
+
}, "authorized", true, "default">>, "register", "self">;
|
|
314
|
+
}>;
|
|
315
|
+
};
|
|
316
|
+
readonly views: {
|
|
317
|
+
application: import("@astrale-os/sdk/schema").View;
|
|
318
|
+
};
|
|
319
|
+
}>>;
|
|
320
|
+
export type AIGatewaySchema = typeof schema;
|
|
321
|
+
export type AIGatewayDomain = language.DomainOf<typeof schema>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { KernelSchema, defineSchema, view } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { AIModel } from '#schema/model';
|
|
3
|
+
export const schema = defineSchema('ai-gateway.astrale.ai', {
|
|
4
|
+
dependencies: { kernel: KernelSchema },
|
|
5
|
+
classes: { AIModel },
|
|
6
|
+
views: {
|
|
7
|
+
application: view({}),
|
|
8
|
+
},
|
|
9
|
+
});
|
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
export declare const AIModel: import("@astrale-os/sdk/schema").NodeClass<{
|
|
2
|
+
readonly depth: 1;
|
|
3
|
+
readonly abstract: false;
|
|
4
|
+
readonly extends: readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
5
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Named"> & {
|
|
6
|
+
readonly origin: "kernel.astrale.ai";
|
|
7
|
+
};
|
|
8
|
+
readonly kind: 'node';
|
|
9
|
+
readonly abstract: true;
|
|
10
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Named"> & {
|
|
11
|
+
readonly origin: "kernel.astrale.ai";
|
|
12
|
+
}, "kernel.astrale.ai:class.Named", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
13
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
14
|
+
readonly origin: "kernel.astrale.ai";
|
|
15
|
+
};
|
|
16
|
+
readonly kind: 'node';
|
|
17
|
+
readonly abstract: true;
|
|
18
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
19
|
+
readonly origin: "kernel.astrale.ai";
|
|
20
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "name", "kernel.astrale.ai:class.Named.property.name">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "name", "kernel.astrale.ai:class.Named.property.name">, never, never>, import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
21
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Descriptable"> & {
|
|
22
|
+
readonly origin: "kernel.astrale.ai";
|
|
23
|
+
};
|
|
24
|
+
readonly kind: 'node';
|
|
25
|
+
readonly abstract: true;
|
|
26
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Descriptable"> & {
|
|
27
|
+
readonly origin: "kernel.astrale.ai";
|
|
28
|
+
}, "kernel.astrale.ai:class.Descriptable", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
29
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
30
|
+
readonly origin: "kernel.astrale.ai";
|
|
31
|
+
};
|
|
32
|
+
readonly kind: 'node';
|
|
33
|
+
readonly abstract: true;
|
|
34
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
35
|
+
readonly origin: "kernel.astrale.ai";
|
|
36
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, false, "description", "kernel.astrale.ai:class.Descriptable.property.description">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, false, "description", "kernel.astrale.ai:class.Descriptable.property.description">, never, never>, import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
37
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Timestamped"> & {
|
|
38
|
+
readonly origin: "kernel.astrale.ai";
|
|
39
|
+
};
|
|
40
|
+
readonly kind: 'node';
|
|
41
|
+
readonly abstract: true;
|
|
42
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Timestamped"> & {
|
|
43
|
+
readonly origin: "kernel.astrale.ai";
|
|
44
|
+
}, "kernel.astrale.ai:class.Timestamped", readonly [import("@astrale-os/sdk/schema").ClassProjection<"node", import("@astrale-os/sdk/schema").NodeClassDefinition & {
|
|
45
|
+
readonly ref: import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
46
|
+
readonly origin: "kernel.astrale.ai";
|
|
47
|
+
};
|
|
48
|
+
readonly kind: 'node';
|
|
49
|
+
readonly abstract: true;
|
|
50
|
+
}, import("@astrale-os/sdk/schema").ClassRef & import("@astrale-os/sdk/schema").ClassRef<"Node"> & {
|
|
51
|
+
readonly origin: "kernel.astrale.ai";
|
|
52
|
+
}, "kernel.astrale.ai:class.Node", readonly import("@astrale-os/sdk/schema").AnyResolvedClass[], never, never, never, never, never, never>, ...never[]], import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt"> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt">, never, never, import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "createdAt", "kernel.astrale.ai:class.Timestamped.property.createdAt"> | import("@astrale-os/sdk/schema").PropertyProjection<string | number | boolean | import("@astrale-os/sdk/schema").Array | import("@astrale-os/sdk/schema").Object | null, true, "updatedAt", "kernel.astrale.ai:class.Timestamped.property.updatedAt">, never, never>];
|
|
53
|
+
readonly properties: {
|
|
54
|
+
readonly modelId: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "modelId", "self">;
|
|
55
|
+
readonly provider: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"azure" | "google" | "workers-ai", "azure" | "google" | "workers-ai", true, "provider", "self">;
|
|
56
|
+
readonly contextWindow: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "contextWindow", "self">;
|
|
57
|
+
readonly maxOutputTokens: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "maxOutputTokens", "self">;
|
|
58
|
+
readonly modality: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
59
|
+
input: string[];
|
|
60
|
+
output: string[];
|
|
61
|
+
}, {
|
|
62
|
+
input: string[];
|
|
63
|
+
output: string[];
|
|
64
|
+
}, true, "modality", "self">;
|
|
65
|
+
readonly capabilities: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
66
|
+
toolUse: boolean;
|
|
67
|
+
vision: boolean;
|
|
68
|
+
reasoning: boolean;
|
|
69
|
+
fileInput: boolean;
|
|
70
|
+
structuredOutput: boolean;
|
|
71
|
+
streaming: boolean;
|
|
72
|
+
caching: boolean;
|
|
73
|
+
}, {
|
|
74
|
+
toolUse: boolean;
|
|
75
|
+
vision: boolean;
|
|
76
|
+
reasoning: boolean;
|
|
77
|
+
fileInput: boolean;
|
|
78
|
+
structuredOutput: boolean;
|
|
79
|
+
streaming: boolean;
|
|
80
|
+
caching: boolean;
|
|
81
|
+
}, true, "capabilities", "self">;
|
|
82
|
+
readonly pricing: import("@astrale-os/sdk/schema").AuthoredPropertyProjection<Record<string, string>, Record<string, string>, true, "pricing", "self">;
|
|
83
|
+
};
|
|
84
|
+
readonly methods: {
|
|
85
|
+
readonly register: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
86
|
+
name: string;
|
|
87
|
+
description?: string | undefined;
|
|
88
|
+
modelId: string;
|
|
89
|
+
provider: "azure" | "google" | "workers-ai";
|
|
90
|
+
contextWindow: number;
|
|
91
|
+
maxOutputTokens: number;
|
|
92
|
+
modality: {
|
|
93
|
+
input: string[];
|
|
94
|
+
output: string[];
|
|
95
|
+
};
|
|
96
|
+
capabilities: {
|
|
97
|
+
toolUse: boolean;
|
|
98
|
+
vision: boolean;
|
|
99
|
+
reasoning: boolean;
|
|
100
|
+
fileInput: boolean;
|
|
101
|
+
structuredOutput: boolean;
|
|
102
|
+
streaming: boolean;
|
|
103
|
+
caching: boolean;
|
|
104
|
+
};
|
|
105
|
+
pricing: Record<string, string>;
|
|
106
|
+
}, {
|
|
107
|
+
readonly mode: 'value';
|
|
108
|
+
readonly value: {
|
|
109
|
+
name: string;
|
|
110
|
+
modelId: string;
|
|
111
|
+
provider: "azure" | "google" | "workers-ai";
|
|
112
|
+
contextWindow: number;
|
|
113
|
+
maxOutputTokens: number;
|
|
114
|
+
modality: {
|
|
115
|
+
input: string[];
|
|
116
|
+
output: string[];
|
|
117
|
+
};
|
|
118
|
+
capabilities: {
|
|
119
|
+
toolUse: boolean;
|
|
120
|
+
vision: boolean;
|
|
121
|
+
reasoning: boolean;
|
|
122
|
+
fileInput: boolean;
|
|
123
|
+
structuredOutput: boolean;
|
|
124
|
+
streaming: boolean;
|
|
125
|
+
caching: boolean;
|
|
126
|
+
};
|
|
127
|
+
pricing: Record<string, string>;
|
|
128
|
+
id: string;
|
|
129
|
+
description: string;
|
|
130
|
+
};
|
|
131
|
+
}, "authorized", true, "default">>;
|
|
132
|
+
readonly list: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
133
|
+
readonly mode: 'value';
|
|
134
|
+
readonly value: {
|
|
135
|
+
name: string;
|
|
136
|
+
modelId: string;
|
|
137
|
+
provider: "azure" | "google" | "workers-ai";
|
|
138
|
+
contextWindow: number;
|
|
139
|
+
maxOutputTokens: number;
|
|
140
|
+
modality: {
|
|
141
|
+
input: string[];
|
|
142
|
+
output: string[];
|
|
143
|
+
};
|
|
144
|
+
capabilities: {
|
|
145
|
+
toolUse: boolean;
|
|
146
|
+
vision: boolean;
|
|
147
|
+
reasoning: boolean;
|
|
148
|
+
fileInput: boolean;
|
|
149
|
+
structuredOutput: boolean;
|
|
150
|
+
streaming: boolean;
|
|
151
|
+
caching: boolean;
|
|
152
|
+
};
|
|
153
|
+
pricing: Record<string, string>;
|
|
154
|
+
id: string;
|
|
155
|
+
description: string;
|
|
156
|
+
}[];
|
|
157
|
+
}, "authenticated", true, "default">>;
|
|
158
|
+
readonly invoke: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
159
|
+
path: string;
|
|
160
|
+
body: string;
|
|
161
|
+
headers?: Record<string, string> | undefined;
|
|
162
|
+
}, {
|
|
163
|
+
readonly mode: 'binary';
|
|
164
|
+
}, "authorized", false, "default">>;
|
|
165
|
+
readonly invokeOpenaiFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
166
|
+
body: string;
|
|
167
|
+
}, {
|
|
168
|
+
readonly mode: 'binary';
|
|
169
|
+
}, "authorized", false, "default">>;
|
|
170
|
+
readonly invokeAnthropicFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
171
|
+
body: string;
|
|
172
|
+
}, {
|
|
173
|
+
readonly mode: 'binary';
|
|
174
|
+
}, "authorized", false, "default">>;
|
|
175
|
+
readonly invokeVercelFormat: import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
176
|
+
body: string;
|
|
177
|
+
}, {
|
|
178
|
+
readonly mode: 'binary';
|
|
179
|
+
}, "authorized", false, "default">>;
|
|
180
|
+
};
|
|
181
|
+
readonly effectiveProperties: (import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
182
|
+
toolUse: boolean;
|
|
183
|
+
vision: boolean;
|
|
184
|
+
reasoning: boolean;
|
|
185
|
+
fileInput: boolean;
|
|
186
|
+
structuredOutput: boolean;
|
|
187
|
+
streaming: boolean;
|
|
188
|
+
caching: boolean;
|
|
189
|
+
}, {
|
|
190
|
+
toolUse: boolean;
|
|
191
|
+
vision: boolean;
|
|
192
|
+
reasoning: boolean;
|
|
193
|
+
fileInput: boolean;
|
|
194
|
+
structuredOutput: boolean;
|
|
195
|
+
streaming: boolean;
|
|
196
|
+
caching: boolean;
|
|
197
|
+
}, true, "capabilities", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "contextWindow", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<number, number, true, "maxOutputTokens", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<{
|
|
198
|
+
input: string[];
|
|
199
|
+
output: string[];
|
|
200
|
+
}, {
|
|
201
|
+
input: string[];
|
|
202
|
+
output: string[];
|
|
203
|
+
}, true, "modality", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<string, string, true, "modelId", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<Record<string, string>, Record<string, string>, true, "pricing", "self"> | import("@astrale-os/sdk/schema").AuthoredPropertyProjection<"azure" | "google" | "workers-ai", "azure" | "google" | "workers-ai", true, "provider", "self">) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, false> & {
|
|
204
|
+
readonly name: "description";
|
|
205
|
+
readonly key: "kernel.astrale.ai:class.Descriptable.property.description";
|
|
206
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
207
|
+
readonly name: "name";
|
|
208
|
+
readonly key: "kernel.astrale.ai:class.Named.property.name";
|
|
209
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
210
|
+
readonly name: "createdAt";
|
|
211
|
+
readonly key: "kernel.astrale.ai:class.Timestamped.property.createdAt";
|
|
212
|
+
}) | (import("@astrale-os/sdk/schema").ResolvedProperty<import("@astrale-os/sdk/schema").Value, true> & {
|
|
213
|
+
readonly name: "updatedAt";
|
|
214
|
+
readonly key: "kernel.astrale.ai:class.Timestamped.property.updatedAt";
|
|
215
|
+
});
|
|
216
|
+
readonly effectiveInstanceMethods: import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
217
|
+
path: string;
|
|
218
|
+
body: string;
|
|
219
|
+
headers?: Record<string, string> | undefined;
|
|
220
|
+
}, {
|
|
221
|
+
readonly mode: 'binary';
|
|
222
|
+
}, "authorized", false, "default">>, "invoke", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
223
|
+
body: string;
|
|
224
|
+
}, {
|
|
225
|
+
readonly mode: 'binary';
|
|
226
|
+
}, "authorized", false, "default">>, "invokeOpenaiFormat", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
227
|
+
body: string;
|
|
228
|
+
}, {
|
|
229
|
+
readonly mode: 'binary';
|
|
230
|
+
}, "authorized", false, "default">>, "invokeAnthropicFormat", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
231
|
+
body: string;
|
|
232
|
+
}, {
|
|
233
|
+
readonly mode: 'binary';
|
|
234
|
+
}, "authorized", false, "default">>, "invokeVercelFormat", "self">;
|
|
235
|
+
readonly effectiveStaticMethods: import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<Record<string, never>, {
|
|
236
|
+
readonly mode: 'value';
|
|
237
|
+
readonly value: {
|
|
238
|
+
name: string;
|
|
239
|
+
modelId: string;
|
|
240
|
+
provider: "azure" | "google" | "workers-ai";
|
|
241
|
+
contextWindow: number;
|
|
242
|
+
maxOutputTokens: number;
|
|
243
|
+
modality: {
|
|
244
|
+
input: string[];
|
|
245
|
+
output: string[];
|
|
246
|
+
};
|
|
247
|
+
capabilities: {
|
|
248
|
+
toolUse: boolean;
|
|
249
|
+
vision: boolean;
|
|
250
|
+
reasoning: boolean;
|
|
251
|
+
fileInput: boolean;
|
|
252
|
+
structuredOutput: boolean;
|
|
253
|
+
streaming: boolean;
|
|
254
|
+
caching: boolean;
|
|
255
|
+
};
|
|
256
|
+
pricing: Record<string, string>;
|
|
257
|
+
id: string;
|
|
258
|
+
description: string;
|
|
259
|
+
}[];
|
|
260
|
+
}, "authenticated", true, "default">>, "list", "self"> | import("@astrale-os/sdk/schema").AuthoredMethodProjection<import("@astrale-os/sdk/schema").Method<import("@astrale-os/sdk/schema").CallableProjection<{
|
|
261
|
+
name: string;
|
|
262
|
+
description?: string | undefined;
|
|
263
|
+
modelId: string;
|
|
264
|
+
provider: "azure" | "google" | "workers-ai";
|
|
265
|
+
contextWindow: number;
|
|
266
|
+
maxOutputTokens: number;
|
|
267
|
+
modality: {
|
|
268
|
+
input: string[];
|
|
269
|
+
output: string[];
|
|
270
|
+
};
|
|
271
|
+
capabilities: {
|
|
272
|
+
toolUse: boolean;
|
|
273
|
+
vision: boolean;
|
|
274
|
+
reasoning: boolean;
|
|
275
|
+
fileInput: boolean;
|
|
276
|
+
structuredOutput: boolean;
|
|
277
|
+
streaming: boolean;
|
|
278
|
+
caching: boolean;
|
|
279
|
+
};
|
|
280
|
+
pricing: Record<string, string>;
|
|
281
|
+
}, {
|
|
282
|
+
readonly mode: 'value';
|
|
283
|
+
readonly value: {
|
|
284
|
+
name: string;
|
|
285
|
+
modelId: string;
|
|
286
|
+
provider: "azure" | "google" | "workers-ai";
|
|
287
|
+
contextWindow: number;
|
|
288
|
+
maxOutputTokens: number;
|
|
289
|
+
modality: {
|
|
290
|
+
input: string[];
|
|
291
|
+
output: string[];
|
|
292
|
+
};
|
|
293
|
+
capabilities: {
|
|
294
|
+
toolUse: boolean;
|
|
295
|
+
vision: boolean;
|
|
296
|
+
reasoning: boolean;
|
|
297
|
+
fileInput: boolean;
|
|
298
|
+
structuredOutput: boolean;
|
|
299
|
+
streaming: boolean;
|
|
300
|
+
caching: boolean;
|
|
301
|
+
};
|
|
302
|
+
pricing: Record<string, string>;
|
|
303
|
+
id: string;
|
|
304
|
+
description: string;
|
|
305
|
+
};
|
|
306
|
+
}, "authorized", true, "default">>, "register", "self">;
|
|
307
|
+
}>;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { K, method, nodeClass, output } from '@astrale-os/sdk/schema';
|
|
2
|
+
import { z } from 'zod';
|
|
3
|
+
const modality = z.strictObject({ input: z.array(z.string()), output: z.array(z.string()) });
|
|
4
|
+
const capabilities = z.strictObject({
|
|
5
|
+
toolUse: z.boolean(),
|
|
6
|
+
vision: z.boolean(),
|
|
7
|
+
reasoning: z.boolean(),
|
|
8
|
+
fileInput: z.boolean(),
|
|
9
|
+
structuredOutput: z.boolean(),
|
|
10
|
+
streaming: z.boolean(),
|
|
11
|
+
caching: z.boolean(),
|
|
12
|
+
});
|
|
13
|
+
const modelInput = z.strictObject({
|
|
14
|
+
name: z.string().min(1).max(160),
|
|
15
|
+
description: z.string().max(5_000).optional(),
|
|
16
|
+
modelId: z.string().min(1).max(512),
|
|
17
|
+
provider: z.enum(['workers-ai', 'google', 'azure']),
|
|
18
|
+
contextWindow: z.number().int().positive(),
|
|
19
|
+
maxOutputTokens: z.number().int().positive(),
|
|
20
|
+
modality,
|
|
21
|
+
capabilities,
|
|
22
|
+
pricing: z.record(z.string(), z.string()),
|
|
23
|
+
});
|
|
24
|
+
const modelOutput = modelInput.extend({ id: z.string(), description: z.string() });
|
|
25
|
+
export const AIModel = nodeClass({
|
|
26
|
+
description: 'One permissioned upstream model exposed through Cloudflare AI Gateway.',
|
|
27
|
+
extends: [K.classes.Named, K.classes.Descriptable, K.classes.Timestamped],
|
|
28
|
+
properties: {
|
|
29
|
+
modelId: z.string().min(1).max(512),
|
|
30
|
+
provider: z.enum(['workers-ai', 'google', 'azure']),
|
|
31
|
+
contextWindow: z.number().int().positive(),
|
|
32
|
+
maxOutputTokens: z.number().int().positive(),
|
|
33
|
+
modality,
|
|
34
|
+
capabilities,
|
|
35
|
+
pricing: z.record(z.string(), z.string()),
|
|
36
|
+
},
|
|
37
|
+
methods: {
|
|
38
|
+
register: method({ auth: 'authorized', static: true, input: modelInput, output: modelOutput }),
|
|
39
|
+
list: method({
|
|
40
|
+
auth: 'authenticated',
|
|
41
|
+
static: true,
|
|
42
|
+
input: z.strictObject({}),
|
|
43
|
+
output: z.array(modelOutput),
|
|
44
|
+
}),
|
|
45
|
+
invoke: method({
|
|
46
|
+
auth: 'authorized',
|
|
47
|
+
input: z.strictObject({
|
|
48
|
+
path: z.string().min(1).max(1_024),
|
|
49
|
+
body: z.string().max(10 * 1024 * 1024),
|
|
50
|
+
headers: z.record(z.string(), z.string()).default({}),
|
|
51
|
+
}),
|
|
52
|
+
output: output.binary(),
|
|
53
|
+
}),
|
|
54
|
+
invokeOpenaiFormat: method({
|
|
55
|
+
auth: 'authorized',
|
|
56
|
+
input: z.strictObject({ body: z.string().max(10 * 1024 * 1024) }),
|
|
57
|
+
output: output.binary(),
|
|
58
|
+
}),
|
|
59
|
+
invokeAnthropicFormat: method({
|
|
60
|
+
auth: 'authorized',
|
|
61
|
+
input: z.strictObject({ body: z.string().max(10 * 1024 * 1024) }),
|
|
62
|
+
output: output.binary(),
|
|
63
|
+
}),
|
|
64
|
+
invokeVercelFormat: method({
|
|
65
|
+
auth: 'authorized',
|
|
66
|
+
input: z.strictObject({ body: z.string().max(10 * 1024 * 1024) }),
|
|
67
|
+
output: output.binary(),
|
|
68
|
+
}),
|
|
69
|
+
},
|
|
70
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AIModel } from './class.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { AIModel } from './class.js';
|
package/package.json
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@astrale-domains/ai-gateway",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"repository": {
|
|
5
|
+
"type": "git",
|
|
6
|
+
"url": "git+https://github.com/astrale-os/domains.git",
|
|
7
|
+
"directory": "ai-gateway"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist"
|
|
11
|
+
],
|
|
12
|
+
"type": "module",
|
|
13
|
+
"main": "./dist/schema/index.js",
|
|
14
|
+
"types": "./dist/schema/index.d.ts",
|
|
15
|
+
"imports": {
|
|
16
|
+
"#schema": "./dist/schema/index.js",
|
|
17
|
+
"#schema/*": "./dist/schema/*/index.js"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/schema/index.d.ts",
|
|
22
|
+
"import": "./dist/schema/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./package.json": "./package.json"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"@astrale-os/sdk": "0.5.0-beta.45",
|
|
31
|
+
"zod": "^4.4.3"
|
|
32
|
+
},
|
|
33
|
+
"devDependencies": {
|
|
34
|
+
"@astrale-os/adapter-astrale": "0.5.0-beta.41",
|
|
35
|
+
"@astrale-os/adapter-cloudflare": "0.5.0-beta.48",
|
|
36
|
+
"@astrale-os/ox": ">=0.1.3 <1.0.0",
|
|
37
|
+
"@astrale-os/shell": "0.4.2-beta.3",
|
|
38
|
+
"@astrale-os/shell-react": "0.3.2-beta.2",
|
|
39
|
+
"@tailwindcss/vite": "^4.0.6",
|
|
40
|
+
"@tanstack/react-router": "1.170.17",
|
|
41
|
+
"@tanstack/router-plugin": "1.168.19",
|
|
42
|
+
"@types/node": "^22.0.0",
|
|
43
|
+
"@types/react": "^19.2.0",
|
|
44
|
+
"@types/react-dom": "^19.2.0",
|
|
45
|
+
"@vitejs/plugin-react": "^6.0.5",
|
|
46
|
+
"oxlint": ">=1.78.0 <2.0.0",
|
|
47
|
+
"react": "^19.2.0",
|
|
48
|
+
"react-dom": "^19.2.0",
|
|
49
|
+
"tailwindcss": "^4.0.6",
|
|
50
|
+
"typescript": "7.0.2",
|
|
51
|
+
"vite": "^8.2.1",
|
|
52
|
+
"vitest": "^4.1.10"
|
|
53
|
+
},
|
|
54
|
+
"engines": {
|
|
55
|
+
"node": ">=22.13"
|
|
56
|
+
},
|
|
57
|
+
"trustedDependencies": [
|
|
58
|
+
"esbuild",
|
|
59
|
+
"sharp",
|
|
60
|
+
"workerd"
|
|
61
|
+
],
|
|
62
|
+
"scripts": {
|
|
63
|
+
"dev": "astrale-domain dev",
|
|
64
|
+
"prod": "astrale-domain deploy prod",
|
|
65
|
+
"deploy": "astrale-domain deploy",
|
|
66
|
+
"build": "astrale-domain build",
|
|
67
|
+
"lint": "astrale-domain lint",
|
|
68
|
+
"lint:fix": "astrale-domain lint --fix",
|
|
69
|
+
"package": "astrale-domain package",
|
|
70
|
+
"typecheck": "tsc --noEmit",
|
|
71
|
+
"test": "vitest run --config vitest.config.ts",
|
|
72
|
+
"frontend:dev": "vite",
|
|
73
|
+
"frontend:build": "vite build"
|
|
74
|
+
}
|
|
75
|
+
}
|