egaki 0.5.0 → 0.6.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/CHANGELOG.md +57 -0
- package/README.md +107 -3
- package/dist/cli.js +459 -124
- package/dist/credentials.d.ts +11 -2
- package/dist/credentials.d.ts.map +1 -1
- package/dist/credentials.js +68 -5
- package/dist/login.d.ts.map +1 -1
- package/dist/login.js +45 -4
- package/dist/model-catalog.d.ts +96 -3
- package/dist/model-catalog.d.ts.map +1 -1
- package/dist/model-catalog.js +427 -3
- package/dist/models.d.ts +4 -4
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +162 -96
- package/dist/video-model-catalog.d.ts +1 -51
- package/dist/video-model-catalog.d.ts.map +1 -1
- package/dist/video-model-catalog.js +5 -306
- package/dist/xai-auth.d.ts +29 -0
- package/dist/xai-auth.d.ts.map +1 -0
- package/dist/xai-auth.js +325 -0
- package/package.json +5 -4
- package/src/cli.ts +621 -133
- package/src/credentials.ts +70 -7
- package/src/login.ts +48 -3
- package/src/model-catalog.ts +537 -7
- package/src/models.ts +239 -119
- package/src/video-model-catalog.ts +14 -363
- package/src/xai-auth.ts +396 -0
package/dist/credentials.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ChatGptAuth } from './chatgpt-auth.js';
|
|
2
|
+
import type { XaiAuth } from './xai-auth.js';
|
|
2
3
|
export type ProviderInfo = {
|
|
3
4
|
envVar: string;
|
|
4
5
|
label: string;
|
|
@@ -8,14 +9,16 @@ export type ProviderInfo = {
|
|
|
8
9
|
};
|
|
9
10
|
export declare const PROVIDERS: Record<string, ProviderInfo>;
|
|
10
11
|
export declare const EGAKI_GATEWAY_URL = "https://egaki.org/v3/ai";
|
|
11
|
-
/** A credential value is
|
|
12
|
-
export type CredentialValue = string | ChatGptAuth;
|
|
12
|
+
/** A credential value is a plain API key string, a ChatGPT OAuth object, or an xAI OAuth object. */
|
|
13
|
+
export type CredentialValue = string | ChatGptAuth | XaiAuth;
|
|
13
14
|
export type Credentials = Record<string, CredentialValue>;
|
|
14
15
|
export declare function readCredentials(): Credentials;
|
|
15
16
|
export declare function writeCredentials(creds: Credentials): void;
|
|
16
17
|
export declare function saveProviderKey(provider: string, key: string): void;
|
|
17
18
|
export declare function saveChatGptAuth(auth: ChatGptAuth): void;
|
|
18
19
|
export declare function getChatGptAuth(): ChatGptAuth | undefined;
|
|
20
|
+
export declare function saveXaiAuth(auth: XaiAuth): void;
|
|
21
|
+
export declare function getXaiAuth(): XaiAuth | undefined;
|
|
19
22
|
export declare function removeProviderKey(provider: string): void;
|
|
20
23
|
export declare function getProviderKey(provider: string): string | undefined;
|
|
21
24
|
export declare function injectCredentialsToEnv(): void;
|
|
@@ -24,6 +27,12 @@ export declare function injectCredentialsToEnv(): void;
|
|
|
24
27
|
* for OpenAI image models instead of a direct OpenAI API key.
|
|
25
28
|
*/
|
|
26
29
|
export declare function shouldUseChatGptBackend(): boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Returns true when xAI models should use the OAuth flow instead of a direct
|
|
32
|
+
* XAI_API_KEY. Priority: explicit env var > xai-oauth tokens > stored xai key.
|
|
33
|
+
* Only an explicit XAI_API_KEY (set before egaki runs) overrides OAuth.
|
|
34
|
+
*/
|
|
35
|
+
export declare function shouldUseXaiOAuth(): boolean;
|
|
27
36
|
export declare function getKeyStatus(provider: string): {
|
|
28
37
|
available: boolean;
|
|
29
38
|
source: 'env' | 'stored' | 'oauth' | 'none';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"credentials.d.ts","sourceRoot":"","sources":["../src/credentials.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AACpD,OAAO,KA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,EAAE,MAAM,GAAG;IAC9C,SAAS,EAAE,OAAO,CAAA;IAClB,MAAM,EAAE,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,MAAM,CAAA;CAC5C,CA0CA"}
|
package/dist/credentials.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// Reads and writes API keys from ~/.config/egaki/credentials.json.
|
|
3
3
|
// Keys are stored per-provider and injected as env vars at runtime.
|
|
4
4
|
//
|
|
5
|
-
// Most providers store a plain API key string.
|
|
6
|
-
//
|
|
5
|
+
// Most providers store a plain API key string. OAuth providers store structured
|
|
6
|
+
// token objects for their custom backend flows.
|
|
7
7
|
import fs from 'node:fs';
|
|
8
8
|
import path from 'node:path';
|
|
9
9
|
import os from 'node:os';
|
|
@@ -47,6 +47,17 @@ export const PROVIDERS = {
|
|
|
47
47
|
label: 'fal.ai (Flux, SDXL, Recraft)',
|
|
48
48
|
hint: 'Get your key at https://fal.ai/dashboard/keys',
|
|
49
49
|
},
|
|
50
|
+
xai: {
|
|
51
|
+
envVar: 'XAI_API_KEY',
|
|
52
|
+
label: 'xAI (API key)',
|
|
53
|
+
hint: 'Get your key at https://console.x.ai/team/default/api-keys',
|
|
54
|
+
},
|
|
55
|
+
'xai-oauth': {
|
|
56
|
+
envVar: 'XAI_API_KEY',
|
|
57
|
+
label: 'xAI Grok Build (use your subscription)',
|
|
58
|
+
hint: 'Sign in with your xAI / Grok account via browser',
|
|
59
|
+
oauth: true,
|
|
60
|
+
},
|
|
50
61
|
};
|
|
51
62
|
export const EGAKI_GATEWAY_URL = 'https://egaki.org/v3/ai';
|
|
52
63
|
function getConfigDir() {
|
|
@@ -92,6 +103,18 @@ export function getChatGptAuth() {
|
|
|
92
103
|
}
|
|
93
104
|
return undefined;
|
|
94
105
|
}
|
|
106
|
+
export function saveXaiAuth(auth) {
|
|
107
|
+
const creds = readCredentials();
|
|
108
|
+
creds['xai-oauth'] = auth;
|
|
109
|
+
writeCredentials(creds);
|
|
110
|
+
}
|
|
111
|
+
export function getXaiAuth() {
|
|
112
|
+
const creds = readCredentials();
|
|
113
|
+
const val = creds['xai-oauth'];
|
|
114
|
+
if (!val || typeof val !== 'object')
|
|
115
|
+
return undefined;
|
|
116
|
+
return val;
|
|
117
|
+
}
|
|
95
118
|
export function removeProviderKey(provider) {
|
|
96
119
|
const creds = readCredentials();
|
|
97
120
|
delete creds[provider];
|
|
@@ -102,18 +125,28 @@ export function getProviderKey(provider) {
|
|
|
102
125
|
const val = creds[provider];
|
|
103
126
|
return typeof val === 'string' ? val : undefined;
|
|
104
127
|
}
|
|
105
|
-
// Inject all stored non-
|
|
128
|
+
// Inject all stored non-OAuth credentials as env vars so the AI SDK
|
|
106
129
|
// providers pick them up automatically. Env vars already set by the user take
|
|
107
130
|
// precedence (we don't overwrite them).
|
|
131
|
+
//
|
|
132
|
+
// Special case: if xAI OAuth tokens exist, skip injecting the stored xai API
|
|
133
|
+
// key so OAuth takes priority. Only an explicit XAI_API_KEY env var (set by
|
|
134
|
+
// the user before egaki runs) will override OAuth.
|
|
108
135
|
export function injectCredentialsToEnv() {
|
|
109
136
|
const creds = readCredentials();
|
|
137
|
+
const hasXaiOAuth = Boolean(getXaiAuth());
|
|
110
138
|
for (const [provider, value] of Object.entries(creds)) {
|
|
111
139
|
const info = PROVIDERS[provider];
|
|
112
140
|
if (!info)
|
|
113
141
|
continue;
|
|
114
|
-
// Skip
|
|
142
|
+
// Skip OAuth entries — handled separately via custom fetch
|
|
115
143
|
if (provider === 'chatgpt')
|
|
116
144
|
continue;
|
|
145
|
+
if (provider === 'xai-oauth')
|
|
146
|
+
continue;
|
|
147
|
+
// Skip stored xai key when OAuth tokens exist (OAuth takes priority)
|
|
148
|
+
if (provider === 'xai' && hasXaiOAuth && !process.env[info.envVar])
|
|
149
|
+
continue;
|
|
117
150
|
if (typeof value === 'string' && !process.env[info.envVar]) {
|
|
118
151
|
process.env[info.envVar] = value;
|
|
119
152
|
}
|
|
@@ -126,6 +159,16 @@ export function injectCredentialsToEnv() {
|
|
|
126
159
|
export function shouldUseChatGptBackend() {
|
|
127
160
|
return !process.env['OPENAI_API_KEY'] && Boolean(getChatGptAuth());
|
|
128
161
|
}
|
|
162
|
+
/**
|
|
163
|
+
* Returns true when xAI models should use the OAuth flow instead of a direct
|
|
164
|
+
* XAI_API_KEY. Priority: explicit env var > xai-oauth tokens > stored xai key.
|
|
165
|
+
* Only an explicit XAI_API_KEY (set before egaki runs) overrides OAuth.
|
|
166
|
+
*/
|
|
167
|
+
export function shouldUseXaiOAuth() {
|
|
168
|
+
if (process.env['XAI_API_KEY'])
|
|
169
|
+
return false;
|
|
170
|
+
return Boolean(getXaiAuth());
|
|
171
|
+
}
|
|
129
172
|
// Check if a provider has a key available (from env or stored credentials).
|
|
130
173
|
// Returns the source of the key for display purposes.
|
|
131
174
|
export function getKeyStatus(provider) {
|
|
@@ -133,7 +176,7 @@ export function getKeyStatus(provider) {
|
|
|
133
176
|
if (!info) {
|
|
134
177
|
return { available: false, source: 'none' };
|
|
135
178
|
}
|
|
136
|
-
//
|
|
179
|
+
// OAuth providers are special cases
|
|
137
180
|
if (provider === 'chatgpt') {
|
|
138
181
|
const auth = getChatGptAuth();
|
|
139
182
|
if (auth) {
|
|
@@ -141,6 +184,26 @@ export function getKeyStatus(provider) {
|
|
|
141
184
|
}
|
|
142
185
|
return { available: false, source: 'none' };
|
|
143
186
|
}
|
|
187
|
+
if (provider === 'xai-oauth') {
|
|
188
|
+
const auth = getXaiAuth();
|
|
189
|
+
if (auth) {
|
|
190
|
+
return { available: true, source: 'oauth' };
|
|
191
|
+
}
|
|
192
|
+
return { available: false, source: 'none' };
|
|
193
|
+
}
|
|
194
|
+
// For xai provider, report the same priority used by generation:
|
|
195
|
+
// explicit env var > xai-oauth tokens > stored xai key.
|
|
196
|
+
if (provider === 'xai') {
|
|
197
|
+
if (process.env[info.envVar])
|
|
198
|
+
return { available: true, source: 'env' };
|
|
199
|
+
const oauthAuth = getXaiAuth();
|
|
200
|
+
if (oauthAuth)
|
|
201
|
+
return { available: true, source: 'oauth' };
|
|
202
|
+
const stored = getProviderKey(provider);
|
|
203
|
+
if (stored)
|
|
204
|
+
return { available: true, source: 'stored' };
|
|
205
|
+
return { available: false, source: 'none' };
|
|
206
|
+
}
|
|
144
207
|
if (process.env[info.envVar]) {
|
|
145
208
|
return { available: true, source: 'env' };
|
|
146
209
|
}
|
package/dist/login.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../src/login.ts"],"names":[],"mappings":"AA4BA,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,IAAI,CAAC,CAkGtD;AAED,wBAAsB,mBAAmB,CAAC,EACxC,QAAQ,EACR,GAAG,GACJ,EAAE;IACD,QAAQ,EAAE,MAAM,CAAA;IAChB,GAAG,EAAE,MAAM,CAAA;CACZ,GAAG,OAAO,CAAC,IAAI,CAAC,CAiChB;AAED,wBAAgB,eAAe,IAAI,IAAI,CA2DtC;AAED,wBAAgB,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,CAalD;AAGD,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,MAAM,CAAC,CAMxD"}
|
package/dist/login.js
CHANGED
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
// ChatGPT OAuth uses a browser flow instead of pasting a key.
|
|
5
5
|
import { intro, outro, select, password, isCancel, cancel, log, note, } from '@clack/prompts';
|
|
6
6
|
import pc from 'picocolors';
|
|
7
|
-
import { PROVIDERS, saveProviderKey, removeProviderKey, getKeyStatus, getChatGptAuth, saveChatGptAuth, } from './credentials.js';
|
|
7
|
+
import { PROVIDERS, saveProviderKey, removeProviderKey, getKeyStatus, getChatGptAuth, saveChatGptAuth, getXaiAuth, saveXaiAuth, } from './credentials.js';
|
|
8
8
|
import { chatGptOAuthLogin, extractPlanType } from './chatgpt-auth.js';
|
|
9
|
+
import { xaiOAuthLogin } from './xai-auth.js';
|
|
9
10
|
export async function loginInteractive() {
|
|
10
11
|
intro(pc.bold('egaki login'));
|
|
11
12
|
const providerOptions = Object.entries(PROVIDERS).map(([key, info]) => {
|
|
@@ -18,9 +19,17 @@ export async function loginInteractive() {
|
|
|
18
19
|
return pc.green('(saved)');
|
|
19
20
|
}
|
|
20
21
|
if (status.source === 'oauth') {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
if (key === 'chatgpt') {
|
|
23
|
+
const auth = getChatGptAuth();
|
|
24
|
+
const email = auth?.email;
|
|
25
|
+
return pc.green(`(signed in${email ? ` as ${email}` : ''})`);
|
|
26
|
+
}
|
|
27
|
+
if (key === 'xai-oauth') {
|
|
28
|
+
const auth = getXaiAuth();
|
|
29
|
+
const email = auth?.email;
|
|
30
|
+
return pc.green(`(signed in${email ? ` as ${email}` : ''})`);
|
|
31
|
+
}
|
|
32
|
+
return pc.green('(signed in)');
|
|
24
33
|
}
|
|
25
34
|
return pc.dim('(not configured)');
|
|
26
35
|
})();
|
|
@@ -54,6 +63,13 @@ export async function loginInteractive() {
|
|
|
54
63
|
outro('Done — ChatGPT OAuth saved');
|
|
55
64
|
return;
|
|
56
65
|
}
|
|
66
|
+
// xAI Grok Build uses browser OAuth
|
|
67
|
+
if (provider === 'xai-oauth') {
|
|
68
|
+
const auth = await xaiOAuthLogin();
|
|
69
|
+
saveXaiAuth(auth);
|
|
70
|
+
outro('Done — xAI OAuth saved');
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
57
73
|
log.info(`${pc.dim('Env var:')} ${info.envVar} ${pc.dim('(also used by the CLI when set)')}`);
|
|
58
74
|
log.info(`${pc.dim('Get key:')} ${info.hint}`);
|
|
59
75
|
const key = await password({
|
|
@@ -87,6 +103,13 @@ export async function loginNonInteractive({ provider, key, }) {
|
|
|
87
103
|
console.log(pc.green('ChatGPT OAuth saved'));
|
|
88
104
|
return;
|
|
89
105
|
}
|
|
106
|
+
// xAI Grok Build uses browser OAuth — key flag is not needed
|
|
107
|
+
if (provider === 'xai-oauth') {
|
|
108
|
+
const auth = await xaiOAuthLogin();
|
|
109
|
+
saveXaiAuth(auth);
|
|
110
|
+
console.log(pc.green('xAI OAuth saved'));
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
90
113
|
if (!key || key.trim().length === 0) {
|
|
91
114
|
console.error(pc.red('API key cannot be empty'));
|
|
92
115
|
process.exit(1);
|
|
@@ -117,6 +140,24 @@ export function showLoginStatus() {
|
|
|
117
140
|
}
|
|
118
141
|
continue;
|
|
119
142
|
}
|
|
143
|
+
if (key === 'xai-oauth') {
|
|
144
|
+
const auth = getXaiAuth();
|
|
145
|
+
if (auth) {
|
|
146
|
+
const email = auth.email ?? 'unknown';
|
|
147
|
+
const expired = auth.expires < Date.now();
|
|
148
|
+
const expiryLabel = expired
|
|
149
|
+
? pc.yellow('(token expired, will auto-refresh)')
|
|
150
|
+
: pc.dim('(token valid)');
|
|
151
|
+
console.log(`${pc.green('*')} ${info.label} ${pc.green('(signed in)')}`);
|
|
152
|
+
console.log(pc.dim(` account: ${email}`));
|
|
153
|
+
console.log(` ${expiryLabel}`);
|
|
154
|
+
}
|
|
155
|
+
else {
|
|
156
|
+
console.log(`${pc.dim('-')} ${info.label} ${pc.dim('(not signed in)')}`);
|
|
157
|
+
console.log(pc.dim(` run: egaki login → select xAI Grok Build`));
|
|
158
|
+
}
|
|
159
|
+
continue;
|
|
160
|
+
}
|
|
120
161
|
const icon = status.available ? pc.green('*') : pc.dim('-');
|
|
121
162
|
const source = (() => {
|
|
122
163
|
if (status.source === 'env') {
|
package/dist/model-catalog.d.ts
CHANGED
|
@@ -10,7 +10,44 @@ export type PerTokenCost = {
|
|
|
10
10
|
/** USD per million output tokens */
|
|
11
11
|
outputPerM: number;
|
|
12
12
|
};
|
|
13
|
+
export type VideoDurationPricingTier = {
|
|
14
|
+
/** USD per second for this variant */
|
|
15
|
+
costPerSecond: number;
|
|
16
|
+
/** Optional resolution discriminator (e.g. 720p, 1080p, 4k) */
|
|
17
|
+
resolution?: string;
|
|
18
|
+
/** Optional mode discriminator (e.g. std, pro) */
|
|
19
|
+
mode?: string;
|
|
20
|
+
/** Optional audio discriminator */
|
|
21
|
+
audio?: boolean;
|
|
22
|
+
};
|
|
23
|
+
export type PerVideoSecondCost = {
|
|
24
|
+
type: 'per-video-second';
|
|
25
|
+
/** Fallback duration when request does not specify one (seconds) */
|
|
26
|
+
defaultDurationSec: number;
|
|
27
|
+
tiers: VideoDurationPricingTier[];
|
|
28
|
+
};
|
|
29
|
+
export type UnknownCost = {
|
|
30
|
+
type: 'unknown';
|
|
31
|
+
};
|
|
13
32
|
export type ModelCost = PerImageCost | PerTokenCost;
|
|
33
|
+
export type VideoModelCost = PerVideoSecondCost | UnknownCost;
|
|
34
|
+
export type AnyCost = ModelCost | VideoModelCost;
|
|
35
|
+
export type ProviderOption = {
|
|
36
|
+
/** CLI flag name, e.g. 'quality', 'output-format' */
|
|
37
|
+
flag: string;
|
|
38
|
+
/** The key sent to providerOptions.{provider}.{key} */
|
|
39
|
+
providerKey: string;
|
|
40
|
+
/** Human description for --help */
|
|
41
|
+
description: string;
|
|
42
|
+
/** Enum values if constrained, shown in flag description */
|
|
43
|
+
values?: string[];
|
|
44
|
+
/** Server-side default when not specified */
|
|
45
|
+
defaultValue?: string;
|
|
46
|
+
/** Value type */
|
|
47
|
+
type: 'string' | 'number' | 'boolean';
|
|
48
|
+
/** Whether this flag accepts multiple values (array) */
|
|
49
|
+
array?: boolean;
|
|
50
|
+
};
|
|
14
51
|
export type ModelFeatures = {
|
|
15
52
|
/** supports input images for editing */
|
|
16
53
|
editing: boolean;
|
|
@@ -25,10 +62,28 @@ export type ModelFeatures = {
|
|
|
25
62
|
/** supports generating n > 1 images */
|
|
26
63
|
multipleImages: boolean;
|
|
27
64
|
};
|
|
28
|
-
export type
|
|
65
|
+
export type VideoModelFeatures = {
|
|
66
|
+
/** Supports text prompt to video generation */
|
|
67
|
+
textToVideo: boolean;
|
|
68
|
+
/** Supports image-to-video prompt object ({ image, text }) */
|
|
69
|
+
imageToVideo: boolean;
|
|
70
|
+
/** Optional capabilities exposed by provider */
|
|
71
|
+
capabilities: Array<'t2v' | 'i2v' | 'r2v' | 'motion-control' | 'editing' | 'extension'>;
|
|
72
|
+
/** Optional supported aspect ratios */
|
|
73
|
+
aspectRatios?: string[];
|
|
74
|
+
/** Optional supported resolutions */
|
|
75
|
+
resolutions?: string[];
|
|
76
|
+
/** Optional duration range in seconds */
|
|
77
|
+
durationRangeSec?: {
|
|
78
|
+
min: number;
|
|
79
|
+
max: number;
|
|
80
|
+
};
|
|
81
|
+
seed: boolean;
|
|
82
|
+
multipleVideos: boolean;
|
|
83
|
+
};
|
|
84
|
+
export type ImageModelEntry = {
|
|
29
85
|
id: string;
|
|
30
86
|
name: string;
|
|
31
|
-
/** Optional longer description shown in `egaki models` output */
|
|
32
87
|
description?: string;
|
|
33
88
|
provider: string;
|
|
34
89
|
strategy: 'image' | 'text';
|
|
@@ -36,7 +91,45 @@ export type ModelEntry = {
|
|
|
36
91
|
released: string;
|
|
37
92
|
cost: ModelCost;
|
|
38
93
|
features: ModelFeatures;
|
|
94
|
+
/** Provider-specific options passable via providerOptions.{provider} */
|
|
95
|
+
providerOptions?: ProviderOption[];
|
|
96
|
+
};
|
|
97
|
+
export type VideoModelEntry = {
|
|
98
|
+
id: string;
|
|
99
|
+
name: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
provider: string;
|
|
102
|
+
strategy: 'video';
|
|
103
|
+
released: string;
|
|
104
|
+
cost: VideoModelCost;
|
|
105
|
+
features: VideoModelFeatures;
|
|
106
|
+
/** Provider-specific options passable via providerOptions.{provider} */
|
|
107
|
+
providerOptions?: ProviderOption[];
|
|
39
108
|
};
|
|
109
|
+
/** @deprecated Use ImageModelEntry instead */
|
|
110
|
+
export type ModelEntry = ImageModelEntry;
|
|
111
|
+
export type AnyModelEntry = ImageModelEntry | VideoModelEntry;
|
|
40
112
|
export declare const CATALOG: ModelEntry[];
|
|
41
|
-
export declare
|
|
113
|
+
export declare const VIDEO_CATALOG: VideoModelEntry[];
|
|
114
|
+
/**
|
|
115
|
+
* Collect the valid values for a CLI flag across all providers in the catalog.
|
|
116
|
+
* Returns a map of provider name → enum values array. Only includes providers
|
|
117
|
+
* that declare values for the given flag. Used by cli.ts to auto-generate
|
|
118
|
+
* flag descriptions like "xAI: low, medium, high. OpenAI: auto, low, medium, high".
|
|
119
|
+
*/
|
|
120
|
+
export declare function getProviderValuesForFlag(flag: string, catalogs?: AnyModelEntry[][]): Map<string, string[]>;
|
|
121
|
+
/**
|
|
122
|
+
* Build a human-readable description suffix listing provider-specific values
|
|
123
|
+
* for a flag. Includes default values when available.
|
|
124
|
+
* Example: "xai: low, medium, high (default: medium). openai: auto, low, medium, high (default: auto)"
|
|
125
|
+
*/
|
|
126
|
+
export declare function describeProviderValues(flag: string, catalogs?: AnyModelEntry[][]): string;
|
|
127
|
+
/**
|
|
128
|
+
* Find the ProviderOption definition for a given flag and provider from a model entry.
|
|
129
|
+
* Returns undefined if the model doesn't support this flag.
|
|
130
|
+
*/
|
|
131
|
+
export declare function findProviderOption(entry: AnyModelEntry, flag: string): ProviderOption | undefined;
|
|
132
|
+
export declare function findModel(id: string): ImageModelEntry | undefined;
|
|
133
|
+
export declare function findVideoModel(id: string): VideoModelEntry | undefined;
|
|
134
|
+
export declare function findAnyModel(id: string): AnyModelEntry | undefined;
|
|
42
135
|
//# sourceMappingURL=model-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../src/model-catalog.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"model-catalog.d.ts","sourceRoot":"","sources":["../src/model-catalog.ts"],"names":[],"mappings":"AA0BA,MAAM,MAAM,YAAY,GAAG;IACzB,IAAI,EAAE,WAAW,CAAA;IACjB,kDAAk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