@codeworksh/aikit 0.6.0 → 0.7.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.
@@ -0,0 +1,328 @@
1
+ import Type$1, { Static, TSchema } from "typebox";
2
+ //#region src/model/catalog.d.ts
3
+ declare const KnownProviderEnum$1: {
4
+ readonly anthropic: "anthropic";
5
+ readonly google: "google";
6
+ readonly googleVertex: "google-vertex";
7
+ readonly googleVertexAnthropic: "google-vertex-anthropic";
8
+ readonly openai: "openai";
9
+ readonly openaiCompatible: "openai-compatible";
10
+ readonly openaiCodex: "openai-codex";
11
+ readonly openrouter: "openrouter";
12
+ readonly xai: "xai";
13
+ };
14
+ declare const KnownProviderEnumSchema$1: Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>;
15
+ type KnownProviderEnum$1 = Static<typeof KnownProviderEnumSchema$1>;
16
+ declare namespace model_d_exports {
17
+ export { APIMetadata, APIMetadataSchema, APIMethodEnum, APIMethodEnumSchema, ActiveThinkingLevel, BuiltInModels, Compatibility, CompatibilitySchema, ExtrasSchema, Info, KnownProviderEnum, KnownProviderEnumSchema, ProviderInfo, ProviderToProtocol, Schema, TModel, ThinkingLevel, ThinkingLevelEnum, ThinkingLevelMap, ThinkingLevelMapSchema, calculateCost, clampThinkingLevel, getBuiltInModels, getModel, getModels, getProviders, getSupportedThinkingLevels, modelsAreEqual, normalizeInput, registry, supportsProtocol };
18
+ }
19
+ declare const KnownProviderEnum: {
20
+ readonly anthropic: "anthropic";
21
+ readonly google: "google";
22
+ readonly googleVertex: "google-vertex";
23
+ readonly googleVertexAnthropic: "google-vertex-anthropic";
24
+ readonly openai: "openai";
25
+ readonly openaiCompatible: "openai-compatible";
26
+ readonly openaiCodex: "openai-codex";
27
+ readonly openrouter: "openrouter";
28
+ readonly xai: "xai";
29
+ };
30
+ declare const KnownProviderEnumSchema: Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>;
31
+ type KnownProviderEnum = KnownProviderEnum$1;
32
+ declare const ThinkingLevelEnum: {
33
+ readonly off: "off";
34
+ readonly minimal: "minimal";
35
+ readonly low: "low";
36
+ readonly medium: "medium";
37
+ readonly high: "high";
38
+ readonly xhigh: "xhigh";
39
+ readonly max: "max";
40
+ };
41
+ declare const ThinkingLevel: Type$1.TUnion<[Type$1.TLiteral<"off">, Type$1.TLiteral<"minimal">, Type$1.TLiteral<"low">, Type$1.TLiteral<"medium">, Type$1.TLiteral<"high">, Type$1.TLiteral<"xhigh">, Type$1.TLiteral<"max">]>;
42
+ type ThinkingLevel = Static<typeof ThinkingLevel>;
43
+ declare const ActiveThinkingLevel: Type$1.TUnion<[Type$1.TLiteral<"minimal">, Type$1.TLiteral<"low">, Type$1.TLiteral<"medium">, Type$1.TLiteral<"high">, Type$1.TLiteral<"xhigh">, Type$1.TLiteral<"max">]>;
44
+ type ActiveThinkingLevel = Static<typeof ActiveThinkingLevel>;
45
+ declare const ProviderInfo: Type$1.TObject<{
46
+ id: Type$1.TString;
47
+ name: Type$1.TString;
48
+ source: Type$1.TEnum<["env", "config", "custom", "api", "unknown"]>;
49
+ env: Type$1.TArray<Type$1.TString>;
50
+ key: Type$1.TOptional<Type$1.TString>;
51
+ options: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TAny>>;
52
+ }>;
53
+ type ProviderInfo = Static<typeof ProviderInfo>;
54
+ declare const APIMethodEnum: {
55
+ readonly languageModel: "languageModel";
56
+ readonly chat: "chat";
57
+ readonly completion: "completion";
58
+ readonly completionModel: "completionModel";
59
+ readonly messages: "messages";
60
+ readonly responses: "responses";
61
+ };
62
+ declare const APIMethodEnumSchema: Type$1.TUnion<[Type$1.TLiteral<"languageModel">, Type$1.TLiteral<"chat">, Type$1.TLiteral<"completion">, Type$1.TLiteral<"completionModel">, Type$1.TLiteral<"messages">, Type$1.TLiteral<"responses">]>;
63
+ type APIMethodEnum = Static<typeof APIMethodEnumSchema>;
64
+ declare const APIMetadataSchema: Type$1.TObject<{
65
+ id: Type$1.TOptional<Type$1.TString>;
66
+ url: Type$1.TOptional<Type$1.TString>;
67
+ method: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"languageModel">, Type$1.TLiteral<"chat">, Type$1.TLiteral<"completion">, Type$1.TLiteral<"completionModel">, Type$1.TLiteral<"messages">, Type$1.TLiteral<"responses">]>>;
68
+ }>;
69
+ type APIMetadata = Static<typeof APIMetadataSchema>;
70
+ declare const ThinkingLevelMapSchema: Type$1.TObject<{
71
+ high: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
72
+ low: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
73
+ max: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
74
+ medium: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
75
+ minimal: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
76
+ off: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
77
+ xhigh: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
78
+ }>;
79
+ type ThinkingLevelMap = Static<typeof ThinkingLevelMapSchema>;
80
+ declare const CompatibilitySchema: Type$1.TObject<{
81
+ supportsToolSearch: Type$1.TOptional<Type$1.TBoolean>;
82
+ supportsAdditionalTools: Type$1.TOptional<Type$1.TBoolean>;
83
+ supportsStrictMode: Type$1.TOptional<Type$1.TBoolean>;
84
+ supportsOpenAIGrammarTools: Type$1.TOptional<Type$1.TBoolean>;
85
+ }>;
86
+ type Compatibility = Static<typeof CompatibilitySchema>;
87
+ declare const Schema: Type$1.TObject<{
88
+ id: Type$1.TString;
89
+ name: Type$1.TString;
90
+ provider: Type$1.TObject<{
91
+ id: Type$1.TString;
92
+ name: Type$1.TString;
93
+ source: Type$1.TEnum<["env", "config", "custom", "api", "unknown"]>;
94
+ env: Type$1.TArray<Type$1.TString>;
95
+ key: Type$1.TOptional<Type$1.TString>;
96
+ options: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TAny>>;
97
+ }>;
98
+ baseUrl: Type$1.TString;
99
+ reasoning: Type$1.TBoolean;
100
+ thinkingLevelMap: Type$1.TOptional<Type$1.TObject<{
101
+ high: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
102
+ low: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
103
+ max: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
104
+ medium: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
105
+ minimal: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
106
+ off: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
107
+ xhigh: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
108
+ }>>;
109
+ input: Type$1.TArray<Type$1.TUnion<[Type$1.TLiteral<"text">, Type$1.TLiteral<"image">]>>;
110
+ cost: Type$1.TObject<{
111
+ input: Type$1.TNumber;
112
+ output: Type$1.TNumber;
113
+ cacheRead: Type$1.TNumber;
114
+ cacheWrite: Type$1.TNumber;
115
+ tiers: Type$1.TOptional<Type$1.TArray<Type$1.TObject<{
116
+ input: Type$1.TNumber;
117
+ output: Type$1.TNumber;
118
+ cacheRead: Type$1.TNumber;
119
+ cacheWrite: Type$1.TNumber;
120
+ inputTokensAbove: Type$1.TNumber;
121
+ }>>>;
122
+ }>;
123
+ contextWindow: Type$1.TNumber;
124
+ maxTokens: Type$1.TNumber;
125
+ headers: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TString>>;
126
+ npm: Type$1.TOptional<Type$1.TString>;
127
+ api: Type$1.TOptional<Type$1.TObject<{
128
+ id: Type$1.TOptional<Type$1.TString>;
129
+ url: Type$1.TOptional<Type$1.TString>;
130
+ method: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"languageModel">, Type$1.TLiteral<"chat">, Type$1.TLiteral<"completion">, Type$1.TLiteral<"completionModel">, Type$1.TLiteral<"messages">, Type$1.TLiteral<"responses">]>>;
131
+ }>>;
132
+ providerOptionsKey: Type$1.TOptional<Type$1.TString>;
133
+ options: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TUnknown>>;
134
+ providerOptions: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TUnknown>>;
135
+ compat: Type$1.TOptional<Type$1.TObject<{
136
+ supportsToolSearch: Type$1.TOptional<Type$1.TBoolean>;
137
+ supportsAdditionalTools: Type$1.TOptional<Type$1.TBoolean>;
138
+ supportsStrictMode: Type$1.TOptional<Type$1.TBoolean>;
139
+ supportsOpenAIGrammarTools: Type$1.TOptional<Type$1.TBoolean>;
140
+ }>>;
141
+ protocol: Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>;
142
+ supportedProtocols: Type$1.TOptional<Type$1.TObject<{
143
+ anthropic: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
144
+ google: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
145
+ googleVertex: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
146
+ googleVertexAnthropic: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
147
+ openai: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
148
+ openaiCompatible: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
149
+ openaiCodex: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
150
+ openrouter: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
151
+ xai: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
152
+ }>>;
153
+ }>;
154
+ declare const ExtrasSchema: Type$1.TObject<{}>;
155
+ declare const Info: Type$1.TObject<{
156
+ id: Type$1.TString;
157
+ name: Type$1.TString;
158
+ provider: Type$1.TObject<{
159
+ id: Type$1.TString;
160
+ name: Type$1.TString;
161
+ source: Type$1.TEnum<["env", "config", "custom", "api", "unknown"]>;
162
+ env: Type$1.TArray<Type$1.TString>;
163
+ key: Type$1.TOptional<Type$1.TString>;
164
+ options: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TAny>>;
165
+ }>;
166
+ baseUrl: Type$1.TString;
167
+ reasoning: Type$1.TBoolean;
168
+ thinkingLevelMap: Type$1.TOptional<Type$1.TObject<{
169
+ high: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
170
+ low: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
171
+ max: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
172
+ medium: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
173
+ minimal: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
174
+ off: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
175
+ xhigh: Type$1.TOptional<Type$1.TUnion<[Type$1.TString, Type$1.TNull]>>;
176
+ }>>;
177
+ input: Type$1.TArray<Type$1.TUnion<[Type$1.TLiteral<"text">, Type$1.TLiteral<"image">]>>;
178
+ cost: Type$1.TObject<{
179
+ input: Type$1.TNumber;
180
+ output: Type$1.TNumber;
181
+ cacheRead: Type$1.TNumber;
182
+ cacheWrite: Type$1.TNumber;
183
+ tiers: Type$1.TOptional<Type$1.TArray<Type$1.TObject<{
184
+ input: Type$1.TNumber;
185
+ output: Type$1.TNumber;
186
+ cacheRead: Type$1.TNumber;
187
+ cacheWrite: Type$1.TNumber;
188
+ inputTokensAbove: Type$1.TNumber;
189
+ }>>>;
190
+ }>;
191
+ contextWindow: Type$1.TNumber;
192
+ maxTokens: Type$1.TNumber;
193
+ headers: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TString>>;
194
+ npm: Type$1.TOptional<Type$1.TString>;
195
+ api: Type$1.TOptional<Type$1.TObject<{
196
+ id: Type$1.TOptional<Type$1.TString>;
197
+ url: Type$1.TOptional<Type$1.TString>;
198
+ method: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"languageModel">, Type$1.TLiteral<"chat">, Type$1.TLiteral<"completion">, Type$1.TLiteral<"completionModel">, Type$1.TLiteral<"messages">, Type$1.TLiteral<"responses">]>>;
199
+ }>>;
200
+ providerOptionsKey: Type$1.TOptional<Type$1.TString>;
201
+ options: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TUnknown>>;
202
+ providerOptions: Type$1.TOptional<Type$1.TRecord<"^.*$", Type$1.TUnknown>>;
203
+ compat: Type$1.TOptional<Type$1.TObject<{
204
+ supportsToolSearch: Type$1.TOptional<Type$1.TBoolean>;
205
+ supportsAdditionalTools: Type$1.TOptional<Type$1.TBoolean>;
206
+ supportsStrictMode: Type$1.TOptional<Type$1.TBoolean>;
207
+ supportsOpenAIGrammarTools: Type$1.TOptional<Type$1.TBoolean>;
208
+ }>>;
209
+ protocol: Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>;
210
+ supportedProtocols: Type$1.TOptional<Type$1.TObject<{
211
+ anthropic: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
212
+ google: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
213
+ googleVertex: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
214
+ googleVertexAnthropic: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
215
+ openai: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
216
+ openaiCompatible: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
217
+ openaiCodex: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
218
+ openrouter: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
219
+ xai: Type$1.TOptional<Type$1.TUnion<[Type$1.TLiteral<"anthropic">, Type$1.TLiteral<"google">, Type$1.TLiteral<"google-vertex">, Type$1.TLiteral<"google-vertex-anthropic">, Type$1.TLiteral<"openai">, Type$1.TLiteral<"openai-compatible">, Type$1.TLiteral<"openai-codex">, Type$1.TLiteral<"openrouter">, Type$1.TLiteral<"xai">]>>;
220
+ }>>;
221
+ }>;
222
+ type Info = Static<typeof Info>;
223
+ type TModel<TProtocol extends KnownProviderEnum> = Omit<Info, "protocol"> & {
224
+ protocol: TProtocol;
225
+ };
226
+ declare function calculateCost(model: Info, usage: {
227
+ input: number;
228
+ output: number;
229
+ cacheRead: number;
230
+ cacheWrite: number;
231
+ cost: {
232
+ input: number;
233
+ output: number;
234
+ cacheRead: number;
235
+ cacheWrite: number;
236
+ total: number;
237
+ };
238
+ }): void;
239
+ type BuiltInModels = Partial<Record<string, Record<string, Info>>>;
240
+ declare function normalizeInput(input?: string[]): Array<"text" | "image">;
241
+ declare function getBuiltInModels(): Promise<BuiltInModels>;
242
+ declare const registry: {
243
+ (): Promise<Map<string, Map<string, {
244
+ id: string;
245
+ name: string;
246
+ provider: {
247
+ id: string;
248
+ name: string;
249
+ source: "api" | "config" | "custom" | "env" | "unknown";
250
+ env: string[];
251
+ key?: string;
252
+ options?: Record<string, any>;
253
+ };
254
+ baseUrl: string;
255
+ reasoning: boolean;
256
+ thinkingLevelMap?: {
257
+ high?: string | null;
258
+ low?: string | null;
259
+ max?: string | null;
260
+ medium?: string | null;
261
+ minimal?: string | null;
262
+ off?: string | null;
263
+ xhigh?: string | null;
264
+ };
265
+ input: ("image" | "text")[];
266
+ cost: {
267
+ input: number;
268
+ output: number;
269
+ cacheRead: number;
270
+ cacheWrite: number;
271
+ tiers?: {
272
+ input: number;
273
+ output: number;
274
+ cacheRead: number;
275
+ cacheWrite: number;
276
+ inputTokensAbove: number;
277
+ }[];
278
+ };
279
+ contextWindow: number;
280
+ maxTokens: number;
281
+ headers?: Record<string, string>;
282
+ npm?: string;
283
+ api?: {
284
+ id?: string;
285
+ url?: string;
286
+ method?: "chat" | "completion" | "completionModel" | "languageModel" | "messages" | "responses";
287
+ };
288
+ providerOptionsKey?: string;
289
+ options?: Record<string, unknown>;
290
+ providerOptions?: Record<string, unknown>;
291
+ compat?: {
292
+ supportsToolSearch?: boolean;
293
+ supportsAdditionalTools?: boolean;
294
+ supportsStrictMode?: boolean;
295
+ supportsOpenAIGrammarTools?: boolean;
296
+ };
297
+ protocol: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
298
+ supportedProtocols?: {
299
+ anthropic?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
300
+ google?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
301
+ googleVertex?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
302
+ googleVertexAnthropic?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
303
+ openai?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
304
+ openaiCompatible?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
305
+ openaiCodex?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
306
+ openrouter?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
307
+ xai?: "anthropic" | "google" | "google-vertex" | "google-vertex-anthropic" | "openai" | "openai-codex" | "openai-compatible" | "openrouter" | "xai";
308
+ };
309
+ }>>>;
310
+ reset: () => void;
311
+ };
312
+ declare function supportsProtocol(model: Info, protocol: KnownProviderEnum): boolean;
313
+ type ProviderToProtocol<TProvider extends string> = TProvider extends KnownProviderEnum ? TProvider : KnownProviderEnum;
314
+ declare function getModel<TProvider extends string, TProtocol extends KnownProviderEnum = ProviderToProtocol<TProvider>>(provider: TProvider, model: string, overrides?: Partial<Info> & {
315
+ protocol?: TProtocol;
316
+ }): Promise<TModel<TProtocol> | undefined>;
317
+ declare function getProviders(): Promise<string[]>;
318
+ declare function getModels<TProvider extends string>(provider: TProvider): Promise<Info[]>;
319
+ /**
320
+ * Check if two models are equal by comparing both their id and provider id.
321
+ * Returns false if either model is null or undefined.
322
+ */
323
+ declare function modelsAreEqual(a: Info | null | undefined, b: Info | null | undefined): boolean;
324
+ declare function getSupportedThinkingLevels<TProtocol extends KnownProviderEnum>(model: TModel<TProtocol>): ThinkingLevel[];
325
+ declare function clampThinkingLevel<TProtocol extends KnownProviderEnum>(model: TModel<TProtocol>, level: ThinkingLevel): ThinkingLevel;
326
+ //#endregion
327
+ export { ProviderToProtocol as a, getModels as c, modelsAreEqual as d, registry as f, KnownProviderEnum as i, getProviders as l, ActiveThinkingLevel as n, TModel as o, Info as r, getModel as s, APIMethodEnum as t, model_d_exports as u };
328
+ //# sourceMappingURL=model-En2JLLXC.d.mts.map
@@ -0,0 +1,325 @@
1
+ import { C as lazy, S as path, T as writeJson, a as protocolForPackage, b as normalizeInput, n as isAISDKPackage, s as APIMethodEnum, u as KnownProviderEnum, w as readJson } from "./registry-CMkIE_B4.mjs";
2
+ import { resolve } from "node:path";
3
+ import { mapValues, pickBy, pipe } from "remeda";
4
+ //#region src/cli/modelgen.ts
5
+ const DEFAULT_PROVIDER_BASE_URLS = {
6
+ [KnownProviderEnum.anthropic]: "https://api.anthropic.com/v1",
7
+ [KnownProviderEnum.openai]: "https://api.openai.com/v1",
8
+ [KnownProviderEnum.openrouter]: "https://openrouter.ai/api/v1",
9
+ [KnownProviderEnum.xai]: "https://api.x.ai/v1"
10
+ };
11
+ function modelsDevURL() {
12
+ return process.env.OPENCODE_MODELS_URL || "https://models.dev";
13
+ }
14
+ function modelsDevPath() {
15
+ return process.env.OPENCODE_MODELS_DEV_FILE;
16
+ }
17
+ const modelsDevData = lazy(async () => {
18
+ const path = modelsDevPath();
19
+ if (path) {
20
+ const result = await readJson(path).catch(() => void 0);
21
+ if (result) return result;
22
+ }
23
+ const json = await fetch(`${modelsDevURL()}/api.json`).then((x) => x.text());
24
+ return JSON.parse(json);
25
+ });
26
+ async function pullModelsDevData() {
27
+ return modelsDevData();
28
+ }
29
+ function toModelValue(providerId, provider, model) {
30
+ return applyModification(providerId, provider, model);
31
+ }
32
+ async function loadBuiltInFromModelsDev() {
33
+ const catalog = await pullModelsDevData();
34
+ return pipe(catalog, pickBy((provider) => Object.values(provider.models).some((model) => Boolean(model.tool_call) && isAISDKPackage(resolveModelNpm(provider, model)))), mapValues((provider, providerId) => pipe(provider.models, pickBy((model) => Boolean(model.tool_call) && isAISDKPackage(resolveModelNpm(provider, model))), mapValues((model) => toModelValue(providerId, provider, model)), pickBy((model) => model !== void 0))));
35
+ }
36
+ function resolveModelNpm(provider, model) {
37
+ return model.provider?.npm ?? provider.npm ?? "@ai-sdk/openai-compatible";
38
+ }
39
+ function resolveModelBaseUrl(provider, model) {
40
+ const npm = resolveModelNpm(provider, model);
41
+ const protocol = protocolForPackage(npm);
42
+ return model.baseUrl ?? model.provider?.api ?? provider.api ?? DEFAULT_PROVIDER_BASE_URLS[protocol] ?? "";
43
+ }
44
+ function resolveModelAPIMethod(npm) {
45
+ const protocol = protocolForPackage(npm);
46
+ if (protocol === KnownProviderEnum.openai || protocol === KnownProviderEnum.xai) return APIMethodEnum.responses;
47
+ return APIMethodEnum.languageModel;
48
+ }
49
+ function resolveProviderOptionsKey(protocol) {
50
+ if (protocol === KnownProviderEnum.openaiCompatible) return "openai-compatible";
51
+ if (protocol === KnownProviderEnum.googleVertex) return "google-vertex";
52
+ if (protocol === KnownProviderEnum.googleVertexAnthropic) return "google-vertex-anthropic";
53
+ return protocol;
54
+ }
55
+ const OPENAI_RESPONSES_NONE_REASONING_MODELS = /* @__PURE__ */ new Set([
56
+ "gpt-5.1",
57
+ "gpt-5.2",
58
+ "gpt-5.3-codex",
59
+ "gpt-5.4",
60
+ "gpt-5.4-mini",
61
+ "gpt-5.4-nano",
62
+ "gpt-5.5"
63
+ ]);
64
+ function supportsOpenAiXhigh(model) {
65
+ const modelId = model.id;
66
+ return modelId.includes("gpt-5.2") || modelId.includes("gpt-5.3") || modelId.includes("gpt-5.4") || modelId.includes("gpt-5.5") || model.protocol === KnownProviderEnum.openaiCodex && modelId.includes("gpt-5.6");
67
+ }
68
+ function supportsOpenAiCodexMax(model) {
69
+ return model.protocol === KnownProviderEnum.openaiCodex && model.id.includes("gpt-5.6");
70
+ }
71
+ function mergeThinkingLevelMap(model, map) {
72
+ model.thinkingLevelMap = {
73
+ ...model.thinkingLevelMap,
74
+ ...map
75
+ };
76
+ }
77
+ function applyThinkingLevelMetadata(model) {
78
+ if (model.protocol === KnownProviderEnum.openai && model.id.startsWith("gpt-5")) mergeThinkingLevelMap(model, { off: null });
79
+ if (model.protocol === KnownProviderEnum.openai && model.provider.id === "openai" && OPENAI_RESPONSES_NONE_REASONING_MODELS.has(model.id)) mergeThinkingLevelMap(model, { off: "none" });
80
+ if (supportsOpenAiXhigh(model)) mergeThinkingLevelMap(model, { xhigh: "xhigh" });
81
+ if (supportsOpenAiCodexMax(model)) mergeThinkingLevelMap(model, { max: "max" });
82
+ if (model.id.includes("opus-4-6") || model.id.includes("opus-4.6")) mergeThinkingLevelMap(model, { xhigh: "max" });
83
+ if (model.id.includes("opus-4-7") || model.id.includes("opus-4.7")) mergeThinkingLevelMap(model, { xhigh: "xhigh" });
84
+ }
85
+ const OPENAI_CODEX_PROVIDER_ID = "openai-codex";
86
+ const OPENAI_CODEX_NPM = "@codeworksh/ai-sdk-openai-codex";
87
+ const OPENAI_CODEX_BASE_URL = "https://chatgpt.com/backend-api";
88
+ const OPENAI_CODEX_CONTEXT = 272e3;
89
+ const OPENAI_CODEX_GPT_56_CONTEXT = 272e3;
90
+ const OPENAI_CODEX_SPARK_CONTEXT = 128e3;
91
+ const OPENAI_CODEX_MAX_TOKENS = 128e3;
92
+ const OPENAI_LONG_CONTEXT_INPUT_THRESHOLD = 272e3;
93
+ const OPENAI_CODEX_TOOL_SEARCH_MODEL_IDS = /* @__PURE__ */ new Set([
94
+ "gpt-5.4",
95
+ "gpt-5.4-mini",
96
+ "gpt-5.5",
97
+ "gpt-5.6-luna",
98
+ "gpt-5.6-sol",
99
+ "gpt-5.6-terra"
100
+ ]);
101
+ const OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS = /* @__PURE__ */ new Set([
102
+ "gpt-5.6-luna",
103
+ "gpt-5.6-sol",
104
+ "gpt-5.6-terra"
105
+ ]);
106
+ function roundCost(value) {
107
+ return Number(value.toFixed(6));
108
+ }
109
+ function withOpenAiLongContextPricing(cost) {
110
+ return {
111
+ ...cost,
112
+ tiers: [{
113
+ inputTokensAbove: OPENAI_LONG_CONTEXT_INPUT_THRESHOLD,
114
+ input: roundCost(cost.input * 2),
115
+ output: roundCost(cost.output * 1.5),
116
+ cacheRead: roundCost(cost.cacheRead * 2),
117
+ cacheWrite: roundCost(cost.cacheWrite * 2)
118
+ }]
119
+ };
120
+ }
121
+ const OPENAI_CODEX_GPT_56_COSTS = {
122
+ "gpt-5.6-luna": {
123
+ input: .2,
124
+ output: 1.2,
125
+ cacheRead: .02,
126
+ cacheWrite: .25
127
+ },
128
+ "gpt-5.6-terra": {
129
+ input: 2,
130
+ output: 12,
131
+ cacheRead: .2,
132
+ cacheWrite: 2.5
133
+ }
134
+ };
135
+ const OPENAI_CODEX_MODELS = [
136
+ {
137
+ id: "gpt-5.3-codex-spark",
138
+ name: "GPT-5.3 Codex Spark",
139
+ input: ["text"],
140
+ cost: {
141
+ input: 1.75,
142
+ output: 14,
143
+ cacheRead: .175,
144
+ cacheWrite: 0
145
+ },
146
+ contextWindow: OPENAI_CODEX_SPARK_CONTEXT
147
+ },
148
+ {
149
+ id: "gpt-5.4",
150
+ name: "GPT-5.4",
151
+ input: ["text", "image"],
152
+ cost: withOpenAiLongContextPricing({
153
+ input: 2.5,
154
+ output: 15,
155
+ cacheRead: .25,
156
+ cacheWrite: 0
157
+ }),
158
+ contextWindow: OPENAI_CODEX_CONTEXT
159
+ },
160
+ {
161
+ id: "gpt-5.4-mini",
162
+ name: "GPT-5.4 mini",
163
+ input: ["text", "image"],
164
+ cost: {
165
+ input: .75,
166
+ output: 4.5,
167
+ cacheRead: .075,
168
+ cacheWrite: 0
169
+ },
170
+ contextWindow: OPENAI_CODEX_CONTEXT
171
+ },
172
+ {
173
+ id: "gpt-5.5",
174
+ name: "GPT-5.5",
175
+ input: ["text", "image"],
176
+ cost: withOpenAiLongContextPricing({
177
+ input: 5,
178
+ output: 30,
179
+ cacheRead: .5,
180
+ cacheWrite: 0
181
+ }),
182
+ contextWindow: OPENAI_CODEX_CONTEXT
183
+ },
184
+ {
185
+ id: "gpt-5.6-luna",
186
+ name: "GPT-5.6 Luna",
187
+ input: ["text", "image"],
188
+ cost: withOpenAiLongContextPricing(OPENAI_CODEX_GPT_56_COSTS["gpt-5.6-luna"]),
189
+ contextWindow: OPENAI_CODEX_GPT_56_CONTEXT,
190
+ thinkingLevelMap: { minimal: null }
191
+ },
192
+ {
193
+ id: "gpt-5.6-sol",
194
+ name: "GPT-5.6 Sol",
195
+ input: ["text", "image"],
196
+ cost: withOpenAiLongContextPricing({
197
+ input: 5,
198
+ output: 30,
199
+ cacheRead: .5,
200
+ cacheWrite: 6.25
201
+ }),
202
+ contextWindow: OPENAI_CODEX_GPT_56_CONTEXT,
203
+ thinkingLevelMap: { minimal: null }
204
+ },
205
+ {
206
+ id: "gpt-5.6-terra",
207
+ name: "GPT-5.6 Terra",
208
+ input: ["text", "image"],
209
+ cost: withOpenAiLongContextPricing(OPENAI_CODEX_GPT_56_COSTS["gpt-5.6-terra"]),
210
+ contextWindow: OPENAI_CODEX_GPT_56_CONTEXT,
211
+ thinkingLevelMap: { minimal: null }
212
+ }
213
+ ];
214
+ function openAICodexBuiltInModels() {
215
+ const models = {};
216
+ for (const seed of OPENAI_CODEX_MODELS) {
217
+ const supportsToolSearch = OPENAI_CODEX_TOOL_SEARCH_MODEL_IDS.has(seed.id);
218
+ const supportsAdditionalTools = OPENAI_CODEX_ADDITIONAL_TOOLS_MODEL_IDS.has(seed.id);
219
+ const info = {
220
+ ...seed,
221
+ provider: {
222
+ id: OPENAI_CODEX_PROVIDER_ID,
223
+ name: "OpenAI Codex (ChatGPT)",
224
+ source: "custom",
225
+ env: ["OPENAI_CODEX_API_KEY"]
226
+ },
227
+ baseUrl: OPENAI_CODEX_BASE_URL,
228
+ reasoning: true,
229
+ thinkingLevelMap: {
230
+ off: null,
231
+ ...seed.thinkingLevelMap
232
+ },
233
+ maxTokens: OPENAI_CODEX_MAX_TOKENS,
234
+ npm: OPENAI_CODEX_NPM,
235
+ api: {
236
+ id: seed.id,
237
+ url: OPENAI_CODEX_BASE_URL,
238
+ method: APIMethodEnum.responses
239
+ },
240
+ providerOptionsKey: OPENAI_CODEX_PROVIDER_ID,
241
+ compat: {
242
+ supportsOpenAIGrammarTools: true,
243
+ ...supportsToolSearch ? { supportsToolSearch: true } : {},
244
+ ...supportsAdditionalTools ? { supportsAdditionalTools: true } : {}
245
+ },
246
+ protocol: KnownProviderEnum.openaiCodex
247
+ };
248
+ applyThinkingLevelMetadata(info);
249
+ models[seed.id] = info;
250
+ }
251
+ return models;
252
+ }
253
+ async function generateModels(args = {}) {
254
+ const path$1 = resolve(args.path ?? path());
255
+ const modelsDev = await loadBuiltInFromModelsDev();
256
+ const customCodexModels = openAICodexBuiltInModels();
257
+ const allModels = {
258
+ ...modelsDev,
259
+ [OPENAI_CODEX_PROVIDER_ID]: customCodexModels
260
+ };
261
+ await writeJson(path$1, allModels);
262
+ return path$1;
263
+ }
264
+ const ModelgenCommand = {
265
+ command: "modelgen [path]",
266
+ describe: "generate models.gen.json",
267
+ builder: (yargs) => yargs.positional("path", {
268
+ type: "string",
269
+ describe: "output path (defaults to CODEWORK_MODELS_FILE or ./models.gen.json)"
270
+ }),
271
+ handler: async (args) => {
272
+ const path = await generateModels(args);
273
+ console.log(`Generated model catalog at ${path}`);
274
+ }
275
+ };
276
+ function applyModification(providerId, provider, model) {
277
+ const npm = resolveModelNpm(provider, model);
278
+ if (!isAISDKPackage(npm)) return;
279
+ const protocol = protocolForPackage(npm);
280
+ const baseUrl = resolveModelBaseUrl(provider, model);
281
+ const providerInfo = {
282
+ id: providerId,
283
+ name: provider.name,
284
+ source: "api",
285
+ env: provider.env
286
+ };
287
+ if (provider.key) providerInfo.key = provider.key;
288
+ const api = {
289
+ id: model.id,
290
+ method: resolveModelAPIMethod(npm)
291
+ };
292
+ if (baseUrl) api.url = baseUrl;
293
+ const info = {
294
+ id: model.id,
295
+ name: model.name,
296
+ provider: providerInfo,
297
+ baseUrl,
298
+ reasoning: Boolean(model.reasoning),
299
+ input: normalizeInput(model.modalities.input),
300
+ cost: {
301
+ input: model.cost?.input ?? 0,
302
+ output: model.cost?.output ?? 0,
303
+ cacheRead: model.cost?.cache_read ?? 0,
304
+ cacheWrite: model.cost?.cache_write ?? 0
305
+ },
306
+ contextWindow: model.limit?.context ?? 4096,
307
+ maxTokens: model.limit?.output ?? 4096,
308
+ headers: {
309
+ ...provider.headers,
310
+ ...model.provider?.headers,
311
+ ...model.headers
312
+ },
313
+ npm,
314
+ api,
315
+ providerOptionsKey: resolveProviderOptionsKey(protocol),
316
+ protocol
317
+ };
318
+ if (Object.keys(info.headers ?? {}).length === 0) delete info.headers;
319
+ applyThinkingLevelMetadata(info);
320
+ return info;
321
+ }
322
+ //#endregion
323
+ export { generateModels as n, ModelgenCommand as t };
324
+
325
+ //# sourceMappingURL=modelgen-BcsqB44a.mjs.map