@brotu/ai 0.1.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/CATALOG.md +387 -0
- package/LICENSE +21 -0
- package/README.md +115 -0
- package/dist/adapters/byteplus.adapter.d.ts +51 -0
- package/dist/adapters/byteplus.adapter.d.ts.map +1 -0
- package/dist/adapters/elevenlabs.adapter.d.ts +48 -0
- package/dist/adapters/elevenlabs.adapter.d.ts.map +1 -0
- package/dist/adapters/estimate.d.ts +10 -0
- package/dist/adapters/estimate.d.ts.map +1 -0
- package/dist/adapters/google.adapter.d.ts +52 -0
- package/dist/adapters/google.adapter.d.ts.map +1 -0
- package/dist/adapters/kling.adapter.d.ts +57 -0
- package/dist/adapters/kling.adapter.d.ts.map +1 -0
- package/dist/adapters/openai.adapter.d.ts +40 -0
- package/dist/adapters/openai.adapter.d.ts.map +1 -0
- package/dist/adapters/qwen.adapter.d.ts +53 -0
- package/dist/adapters/qwen.adapter.d.ts.map +1 -0
- package/dist/catalog.cjs +988 -0
- package/dist/catalog.d.ts +27 -0
- package/dist/catalog.d.ts.map +1 -0
- package/dist/catalog.js +20 -0
- package/dist/chunk-GKLTQ55S.js +1176 -0
- package/dist/client.d.ts +86 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/constants/model.types.d.ts +118 -0
- package/dist/constants/model.types.d.ts.map +1 -0
- package/dist/helpers/result.d.ts +54 -0
- package/dist/helpers/result.d.ts.map +1 -0
- package/dist/index.cjs +3568 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2386 -0
- package/dist/lib/jobs.d.ts +46 -0
- package/dist/lib/jobs.d.ts.map +1 -0
- package/dist/lib/storage.d.ts +33 -0
- package/dist/lib/storage.d.ts.map +1 -0
- package/dist/ports/content-generator.port.d.ts +170 -0
- package/dist/ports/content-generator.port.d.ts.map +1 -0
- package/dist/providers/byteplus.models.d.ts +51 -0
- package/dist/providers/byteplus.models.d.ts.map +1 -0
- package/dist/providers/elevenlabs.models.d.ts +27 -0
- package/dist/providers/elevenlabs.models.d.ts.map +1 -0
- package/dist/providers/google.models.d.ts +42 -0
- package/dist/providers/google.models.d.ts.map +1 -0
- package/dist/providers/kling.models.d.ts +159 -0
- package/dist/providers/kling.models.d.ts.map +1 -0
- package/dist/providers/openai.models.d.ts +27 -0
- package/dist/providers/openai.models.d.ts.map +1 -0
- package/dist/providers/qwen.models.d.ts +88 -0
- package/dist/providers/qwen.models.d.ts.map +1 -0
- package/dist/types.d.ts +55 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { GenerationParams, GenerationResult, GenerationType } from "../ports/content-generator.port";
|
|
2
|
+
/**
|
|
3
|
+
* A submitted generation, in a shape you can put in a database.
|
|
4
|
+
*
|
|
5
|
+
* It carries the params because pricing and output shaping are derived from them,
|
|
6
|
+
* and a process that resumes this job days later has nothing else to go on.
|
|
7
|
+
*/
|
|
8
|
+
export interface Job {
|
|
9
|
+
id: string;
|
|
10
|
+
provider: string;
|
|
11
|
+
model: string;
|
|
12
|
+
kind: GenerationType;
|
|
13
|
+
/** Provider-specific path used to ask about this job. */
|
|
14
|
+
pollEndpoint?: string;
|
|
15
|
+
params: GenerationParams;
|
|
16
|
+
/** Whatever the caller tagged the request with. */
|
|
17
|
+
metadata?: Record<string, string>;
|
|
18
|
+
/** Set when the provider answered immediately instead of queueing. */
|
|
19
|
+
result?: GenerationResult;
|
|
20
|
+
submittedAt: string;
|
|
21
|
+
}
|
|
22
|
+
export type JobStatus = "pending" | "succeeded" | "failed";
|
|
23
|
+
export interface JobSnapshot {
|
|
24
|
+
status: JobStatus;
|
|
25
|
+
/** Present once the job is no longer pending. */
|
|
26
|
+
result?: GenerationResult;
|
|
27
|
+
error?: string;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Thrown to unwind a generation call the moment the provider hands back a task
|
|
31
|
+
* id, so `submit` gets the handle without waiting for the result.
|
|
32
|
+
*
|
|
33
|
+
* ponytail: a control-flow throw beats threading a flag through ten polling
|
|
34
|
+
* sites and four method bodies that retry around them. The cost is the seven
|
|
35
|
+
* catch blocks in the adapter, which must re-raise it — `isPendingJob` exists so
|
|
36
|
+
* they can, and so can yours if you wrap adapter calls.
|
|
37
|
+
*/
|
|
38
|
+
export declare class PendingJob extends Error {
|
|
39
|
+
readonly taskId: string;
|
|
40
|
+
readonly pollEndpoint?: string;
|
|
41
|
+
constructor(taskId: string, pollEndpoint?: string);
|
|
42
|
+
}
|
|
43
|
+
export declare function isPendingJob(error: unknown): error is PendingJob;
|
|
44
|
+
export declare function runInSubmitMode<T>(fn: () => Promise<T>): Promise<T>;
|
|
45
|
+
export declare function isSubmitMode(): boolean;
|
|
46
|
+
//# sourceMappingURL=jobs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jobs.d.ts","sourceRoot":"","sources":["../../src/lib/jobs.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,gBAAgB,EAChB,gBAAgB,EAChB,cAAc,EACd,MAAM,iCAAiC,CAAC;AAEzC;;;;;GAKG;AACH,MAAM,WAAW,GAAG;IACnB,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,cAAc,CAAC;IACrB,yDAAyD;IACzD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,MAAM,EAAE,gBAAgB,CAAC;IACzB,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAClC,sEAAsE;IACtE,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,WAAW;IAC3B,MAAM,EAAE,SAAS,CAAC;IAClB,iDAAiD;IACjD,MAAM,CAAC,EAAE,gBAAgB,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;;;;;;GAQG;AACH,qBAAa,UAAW,SAAQ,KAAK;IACpC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAE/B,YAAY,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,EAKhD;CACD;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,UAAU,CAEhE;AAKD,wBAAgB,eAAe,CAAC,CAAC,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAEnE;AAED,wBAAgB,YAAY,IAAI,OAAO,CAEtC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { GenerationOutput } from "../ports/content-generator.port";
|
|
2
|
+
export interface S3StorageConfig {
|
|
3
|
+
bucket: string;
|
|
4
|
+
accessKeyId: string;
|
|
5
|
+
secretAccessKey: string;
|
|
6
|
+
region?: string;
|
|
7
|
+
/** For R2, MinIO, or any S3-compatible host. Omit for AWS. */
|
|
8
|
+
endpoint?: string;
|
|
9
|
+
/** Public base (CDN or public bucket). Set it and nothing gets presigned. */
|
|
10
|
+
publicUrl?: string;
|
|
11
|
+
/** Key prefix, e.g. "generations". */
|
|
12
|
+
prefix?: string;
|
|
13
|
+
/** Presign lifetime when there is no `publicUrl`. Defaults to an hour. */
|
|
14
|
+
signedUrlExpiresIn?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Copy finished outputs into the bucket. On by default, because provider URLs
|
|
17
|
+
* expire — often within hours — and a job you resume tomorrow would find
|
|
18
|
+
* nothing there.
|
|
19
|
+
*/
|
|
20
|
+
persistOutputs?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface Storage {
|
|
23
|
+
upload(buffer: Buffer, filename: string, mimeType: string): Promise<string>;
|
|
24
|
+
/** Copy a provider URL into the bucket and return the durable URL. */
|
|
25
|
+
persist(url: string, mimeType?: string): Promise<string>;
|
|
26
|
+
}
|
|
27
|
+
export declare function createS3Storage(config: S3StorageConfig): Storage;
|
|
28
|
+
/**
|
|
29
|
+
* Rewrite outputs to point at the bucket. A failure to copy one leaves that
|
|
30
|
+
* output on its provider URL rather than losing the whole generation.
|
|
31
|
+
*/
|
|
32
|
+
export declare function persistOutputs(storage: Storage, outputs: GenerationOutput[]): Promise<GenerationOutput[]>;
|
|
33
|
+
//# sourceMappingURL=storage.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storage.d.ts","sourceRoot":"","sources":["../../src/lib/storage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAExE,MAAM,WAAW,eAAe;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,eAAe,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sCAAsC;IACtC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,0EAA0E;IAC1E,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B;;;;OAIG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;CACzB;AAED,MAAM,WAAW,OAAO;IACvB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5E,sEAAsE;IACtE,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;CACzD;AAuDD,wBAAgB,eAAe,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CA0EhE;AAED;;;GAGG;AACH,wBAAsB,cAAc,CACnC,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,gBAAgB,EAAE,GACzB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAqB7B"}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import type { BillingUnit } from "../constants/model.types";
|
|
2
|
+
/** Known values, kept open because providers disagree on spelling and units. */
|
|
3
|
+
export type VideoResolution = "480p" | "580p" | "720p" | "768p" | "1080p" | "4k" | "480P" | "720P" | "1080P" | (string & {});
|
|
4
|
+
export type ImageResolution = "1K" | "2K" | "4K" | (string & {});
|
|
5
|
+
/**
|
|
6
|
+
* Content Generator Port - Interface for AI content generation providers
|
|
7
|
+
* Implements hexagonal architecture pattern for provider abstraction
|
|
8
|
+
*/
|
|
9
|
+
export type GenerationType = "image" | "video" | "text" | "audio";
|
|
10
|
+
/** What every generation call accepts, whatever it produces. */
|
|
11
|
+
export interface CommonGenerationParams {
|
|
12
|
+
prompt: string;
|
|
13
|
+
model?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Your own tags, carried through untouched and handed back on the job and the
|
|
16
|
+
* result. Never sent to the provider — it is for correlating a generation
|
|
17
|
+
* with whatever it belongs to on your side: a user, a campaign, a job queue.
|
|
18
|
+
*/
|
|
19
|
+
metadata?: Record<string, string>;
|
|
20
|
+
/**
|
|
21
|
+
* Fields merged straight into the provider's request body, keyed by provider
|
|
22
|
+
* name. The escape hatch for anything the shared params cannot express; it
|
|
23
|
+
* overrides what the adapter would otherwise send.
|
|
24
|
+
*/
|
|
25
|
+
providerOptions?: Record<string, Record<string, unknown>>;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Shared image parameters.
|
|
29
|
+
*
|
|
30
|
+
* Only fields at least one adapter reads live here. A field nothing sends is
|
|
31
|
+
* worse than a missing one: it reads as supported and silently does nothing.
|
|
32
|
+
* Anything one vendor alone understands goes in `providerOptions`.
|
|
33
|
+
*/
|
|
34
|
+
export interface ImageGenerationParams extends CommonGenerationParams {
|
|
35
|
+
negativePrompt?: string;
|
|
36
|
+
/**
|
|
37
|
+
* Providers disagree on spelling and units: "1K"/"2K"/"4K" on Seedream and
|
|
38
|
+
* wan2.7-image, "1024*1024" pixel pairs elsewhere. The union is for
|
|
39
|
+
* autocomplete; any string is accepted and the adapter validates it against
|
|
40
|
+
* the model's own list.
|
|
41
|
+
*/
|
|
42
|
+
resolution?: ImageResolution;
|
|
43
|
+
aspectRatio?: "1:1" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "auto" | (string & {});
|
|
44
|
+
outputFormat?: "png" | "jpeg";
|
|
45
|
+
/**
|
|
46
|
+
* Quality tier, where the provider has one. On OpenAI this moves the price by
|
|
47
|
+
* more than 30x, so the adapter pins it rather than letting the API choose.
|
|
48
|
+
*/
|
|
49
|
+
quality?: "low" | "medium" | "high";
|
|
50
|
+
seed?: number;
|
|
51
|
+
/** Reference images, cited positionally by most providers. */
|
|
52
|
+
referenceImages?: string[];
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Shared video parameters. Same rule as images: nothing here that no adapter
|
|
56
|
+
* reads. Vendor-specific inputs live behind `ai.<provider>.*` capabilities or
|
|
57
|
+
* in `providerOptions`.
|
|
58
|
+
*/
|
|
59
|
+
export interface VideoGenerationParams extends CommonGenerationParams {
|
|
60
|
+
negativePrompt?: string;
|
|
61
|
+
/** Seconds. Which values are legal is per-model; see CATALOG.md. */
|
|
62
|
+
duration?: number;
|
|
63
|
+
/**
|
|
64
|
+
* Kling and Seedance spell these lowercase, Qwen uppercase, and wan2.6 wants
|
|
65
|
+
* a "1280*720" pixel pair instead. The union is for autocomplete; any string
|
|
66
|
+
* is accepted and the adapter validates it against the model's own list.
|
|
67
|
+
*/
|
|
68
|
+
resolution?: VideoResolution;
|
|
69
|
+
aspectRatio?: "1:1" | "3:4" | "4:3" | "4:5" | "5:4" | "9:16" | "16:9" | "21:9" | "auto" | (string & {});
|
|
70
|
+
/** Quality tier, where the provider has one. */
|
|
71
|
+
mode?: "std" | "pro";
|
|
72
|
+
/** Ask for an audio track on models that can produce one. */
|
|
73
|
+
withAudio?: boolean;
|
|
74
|
+
seed?: number;
|
|
75
|
+
/** First frame, for image-to-video. */
|
|
76
|
+
imageUrl?: string;
|
|
77
|
+
/** Reference images. Index 0 is the first frame, index 1 the last, where supported. */
|
|
78
|
+
referenceImages?: string[];
|
|
79
|
+
/** Several references at once, for reference-to-video models. */
|
|
80
|
+
imageUrls?: string[];
|
|
81
|
+
/** Source video, for editing and continuation. */
|
|
82
|
+
videoUrl?: string;
|
|
83
|
+
videoUrls?: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface TextGenerationParams extends CommonGenerationParams {
|
|
86
|
+
systemPrompt?: string;
|
|
87
|
+
maxTokens?: number;
|
|
88
|
+
temperature?: number;
|
|
89
|
+
topP?: number;
|
|
90
|
+
referenceImages?: string[];
|
|
91
|
+
}
|
|
92
|
+
/** Speech synthesis. `prompt` is the text to speak. */
|
|
93
|
+
export interface AudioGenerationParams extends CommonGenerationParams {
|
|
94
|
+
/** Provider-specific voice name; see the model's entry in CATALOG.md. */
|
|
95
|
+
voice?: string;
|
|
96
|
+
outputFormat?: "mp3" | "wav" | "pcm";
|
|
97
|
+
/** Playback rate, where the provider supports it. */
|
|
98
|
+
speed?: number;
|
|
99
|
+
language?: string;
|
|
100
|
+
}
|
|
101
|
+
export type GenerationParams = ImageGenerationParams | VideoGenerationParams | TextGenerationParams | AudioGenerationParams;
|
|
102
|
+
/**
|
|
103
|
+
* One produced file. The named fields are the ones every provider can answer;
|
|
104
|
+
* anything a single vendor reports and the others do not goes in `raw`, so the
|
|
105
|
+
* shape does not drift as providers are added.
|
|
106
|
+
*/
|
|
107
|
+
export interface GenerationOutput {
|
|
108
|
+
url: string;
|
|
109
|
+
mimeType: string;
|
|
110
|
+
/** The provider's own id for the task that produced this. */
|
|
111
|
+
taskId?: string;
|
|
112
|
+
/** Video length in seconds, when the provider reports it. */
|
|
113
|
+
durationSeconds?: number;
|
|
114
|
+
/** Bytes, when the provider reports it. Most do not. */
|
|
115
|
+
sizeBytes?: number;
|
|
116
|
+
/**
|
|
117
|
+
* When the provider's URL stops working, as an ISO timestamp. Every provider
|
|
118
|
+
* hands back a presigned link, so copy the file before this passes — or give
|
|
119
|
+
* the client a `storage` bucket and it copies for you.
|
|
120
|
+
*/
|
|
121
|
+
expiresAt?: string;
|
|
122
|
+
/** Set once the output has been copied into your own bucket. */
|
|
123
|
+
sourceUrl?: string;
|
|
124
|
+
/** Whatever this provider reports that has no shared name. */
|
|
125
|
+
raw?: Record<string, unknown>;
|
|
126
|
+
}
|
|
127
|
+
/** Handy for adapters: an ISO stamp N hours from now. */
|
|
128
|
+
export declare function expiresInHours(hours: number): string;
|
|
129
|
+
export interface GenerationResult {
|
|
130
|
+
success: boolean;
|
|
131
|
+
outputs: GenerationOutput[];
|
|
132
|
+
creditsUsed: number;
|
|
133
|
+
provider: string;
|
|
134
|
+
model: string;
|
|
135
|
+
processingTimeMs: number;
|
|
136
|
+
error?: string;
|
|
137
|
+
}
|
|
138
|
+
/** What a generation will be billed for. */
|
|
139
|
+
export interface CostEstimate {
|
|
140
|
+
/** What the provider counts. */
|
|
141
|
+
unit: BillingUnit;
|
|
142
|
+
/** How many of them this request will use. */
|
|
143
|
+
units: number;
|
|
144
|
+
/**
|
|
145
|
+
* Price in USD, or null when this model has no verified rate in the catalog.
|
|
146
|
+
* Null rather than zero on purpose: a made-up number is worse than an honest
|
|
147
|
+
* gap, and zero reads as free.
|
|
148
|
+
*/
|
|
149
|
+
usd: number | null;
|
|
150
|
+
/** What the price depends on, or why it is unknown. */
|
|
151
|
+
note?: string;
|
|
152
|
+
provider: string;
|
|
153
|
+
model: string;
|
|
154
|
+
}
|
|
155
|
+
export interface ContentGeneratorPort {
|
|
156
|
+
readonly providerName: string;
|
|
157
|
+
readonly supportedTypes: GenerationType[];
|
|
158
|
+
generateImage(params: ImageGenerationParams): Promise<GenerationResult>;
|
|
159
|
+
generateVideo(params: VideoGenerationParams): Promise<GenerationResult>;
|
|
160
|
+
generateText(params: TextGenerationParams): Promise<GenerationResult>;
|
|
161
|
+
generateAudio(params: AudioGenerationParams): Promise<GenerationResult>;
|
|
162
|
+
estimateCost(type: GenerationType, params: GenerationParams): Promise<CostEstimate>;
|
|
163
|
+
supportsModel(model: string): boolean;
|
|
164
|
+
getAvailableModels(): {
|
|
165
|
+
id: string;
|
|
166
|
+
name: string;
|
|
167
|
+
type: GenerationType;
|
|
168
|
+
}[];
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=content-generator.port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-generator.port.d.ts","sourceRoot":"","sources":["../../src/ports/content-generator.port.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,gFAAgF;AAChF,MAAM,MAAM,eAAe,GACxB,MAAM,GACN,MAAM,GACN,MAAM,GACN,MAAM,GACN,OAAO,GACP,IAAI,GACJ,MAAM,GACN,MAAM,GACN,OAAO,GAEP,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjB,MAAM,MAAM,eAAe,GACxB,IAAI,GACJ,IAAI,GACJ,IAAI,GAEJ,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;AAEjB;;;GAGG;AAEH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC;AAElE,gEAAgE;AAChE,MAAM,WAAW,sBAAsB;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACl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AM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,cAAc,CAAA;KAAE,EAAE,CAAC;CAC3E"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AIModelConfig } from "../constants/model.types";
|
|
2
|
+
/**
|
|
3
|
+
* BytePlus ModelArk (Seedance).
|
|
4
|
+
*
|
|
5
|
+
* Ark rejects a field the model does not accept with a 400 rather than ignoring
|
|
6
|
+
* it — `"the specified parameter 'draft' is not supported for model
|
|
7
|
+
* seedance-1-0-pro in t2v, must be empty"` — so the adapter cannot serialize a
|
|
8
|
+
* whole option struct. This table is what tells it which fields are legal, and
|
|
9
|
+
* it is the reason the table exists at all.
|
|
10
|
+
*/
|
|
11
|
+
export type SeedanceFamily = "1.0" | "1.5" | "2.x";
|
|
12
|
+
export interface BytePlusModelBinding {
|
|
13
|
+
/** Ark's model id, which is also our catalog id — they need no translation. */
|
|
14
|
+
family: SeedanceFamily;
|
|
15
|
+
textToVideo: boolean;
|
|
16
|
+
imageToVideo: boolean;
|
|
17
|
+
/** Accepts a `last_frame` alongside `first_frame`. */
|
|
18
|
+
lastFrame: boolean;
|
|
19
|
+
/** Max `reference_image` items, or 0 where the family rejects them. */
|
|
20
|
+
referenceImages: number;
|
|
21
|
+
/** Accepts `reference_video` / `reference_audio`. */
|
|
22
|
+
referenceMedia: boolean;
|
|
23
|
+
durations: {
|
|
24
|
+
min: number;
|
|
25
|
+
max: number;
|
|
26
|
+
};
|
|
27
|
+
resolutions: string[];
|
|
28
|
+
/**
|
|
29
|
+
* What Ark uses when `resolution` is omitted. The 1.0-pro models default to
|
|
30
|
+
* 1080p, and billing scales with pixels, so the adapter always sends it.
|
|
31
|
+
*/
|
|
32
|
+
defaultResolution: string;
|
|
33
|
+
}
|
|
34
|
+
export declare const BYTEPLUS_MODELS: Record<string, BytePlusModelBinding>;
|
|
35
|
+
/** Fields each family accepts. Sending one outside its family is a 400. */
|
|
36
|
+
export declare function fieldsFor(family: SeedanceFamily): {
|
|
37
|
+
seed: boolean;
|
|
38
|
+
cameraFixed: boolean;
|
|
39
|
+
generateAudio: boolean;
|
|
40
|
+
priority: boolean;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Image models. Unlike video, `/images/generations` answers synchronously — the
|
|
44
|
+
* image is in the response, there is no task to poll.
|
|
45
|
+
*/
|
|
46
|
+
export declare const BYTEPLUS_IMAGE_MODELS: Record<string, {
|
|
47
|
+
sizes: string[];
|
|
48
|
+
}>;
|
|
49
|
+
export declare const BYTEPLUS_IMAGE_CATALOG: AIModelConfig[];
|
|
50
|
+
export declare const BYTEPLUS_CATALOG: AIModelConfig[];
|
|
51
|
+
//# sourceMappingURL=byteplus.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"byteplus.models.d.ts","sourceRoot":"","sources":["../../src/providers/byteplus.models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;;GAQG;AACH,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,CAAC;AAEnD,MAAM,WAAW,oBAAoB;IACpC,+EAA+E;IAC/E,MAAM,EAAE,cAAc,CAAC;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,YAAY,EAAE,OAAO,CAAC;IACtB,sDAAsD;IACtD,SAAS,EAAE,OAAO,CAAC;IACnB,uEAAuE;IACvE,eAAe,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,cAAc,EAAE,OAAO,CAAC;IACxB,SAAS,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,GAAG,EAAE,MAAM,CAAA;KAAE,CAAC;IACxC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB;;;OAGG;IACH,iBAAiB,EAAE,MAAM,CAAC;CAC1B;AAwDD,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAuGhE,CAAC;AAEF,2EAA2E;AAC3E,wBAAgB,SAAS,CAAC,MAAM,EAAE,cAAc,GAAG;IAClD,IAAI,EAAE,OAAO,CAAC;IACd,WAAW,EAAE,OAAO,CAAC;IACrB,aAAa,EAAE,OAAO,CAAC;IACvB,QAAQ,EAAE,OAAO,CAAC;CAClB,CAOA;AAED;;;GAGG;AACH,eAAO,MAAM,qBAAqB,EAAE,MAAM,CAAC,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,EAAE,CAAA;CAAE,CAQrE,CAAC;AAEF,eAAO,MAAM,sBAAsB,EAAE,aAAa,EAgB/C,CAAC;AAEJ,eAAO,MAAM,gBAAgB,EAAE,aAAa,EA+BzC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AIModelConfig } from "../constants/model.types";
|
|
2
|
+
/**
|
|
3
|
+
* ElevenLabs speech.
|
|
4
|
+
*
|
|
5
|
+
* It breaks two conventions every other provider here follows, and the adapter
|
|
6
|
+
* exists mostly to absorb them: the key goes in `xi-api-key` rather than an
|
|
7
|
+
* Authorization header, and the response is raw audio bytes rather than JSON.
|
|
8
|
+
*
|
|
9
|
+
* The voice is a path parameter and is required — there is no default. Voice
|
|
10
|
+
* ids are opaque strings from your own account, so the catalog cannot ship a
|
|
11
|
+
* list; `listVoices()` on the adapter fetches yours.
|
|
12
|
+
*/
|
|
13
|
+
export interface ElevenLabsModelBinding {
|
|
14
|
+
/** Maximum characters the model accepts in one request. */
|
|
15
|
+
maxCharacters: number;
|
|
16
|
+
languages: number;
|
|
17
|
+
/** Roughly what it is for, since the ids do not say. */
|
|
18
|
+
note: string;
|
|
19
|
+
}
|
|
20
|
+
export declare const ELEVENLABS_MODELS: Record<string, ElevenLabsModelBinding>;
|
|
21
|
+
/**
|
|
22
|
+
* `codec_samplerate_bitrate`. The API defaults to mp3_44100_128, and the higher
|
|
23
|
+
* tiers are gated behind paid plans.
|
|
24
|
+
*/
|
|
25
|
+
export declare const ELEVENLABS_OUTPUT_FORMATS: readonly ["mp3_22050_32", "mp3_44100_32", "mp3_44100_64", "mp3_44100_96", "mp3_44100_128", "mp3_44100_192", "pcm_16000", "pcm_22050", "pcm_24000", "pcm_44100", "ulaw_8000"];
|
|
26
|
+
export declare const ELEVENLABS_CATALOG: AIModelConfig[];
|
|
27
|
+
//# sourceMappingURL=elevenlabs.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"elevenlabs.models.d.ts","sourceRoot":"","sources":["../../src/providers/elevenlabs.models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;;;;GAUG;AACH,MAAM,WAAW,sBAAsB;IACtC,2DAA2D;IAC3D,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,MAAM,CAAC;IAClB,wDAAwD;IACxD,IAAI,EAAE,MAAM,CAAC;CACb;AAED,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,sBAAsB,CAgBpE,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,yBAAyB,YACrC,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,EACX,WAAW,CACF,CAAC;AAEX,eAAO,MAAM,kBAAkB,EAAE,aAAa,EAc3C,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { AIModelConfig } from "../constants/model.types";
|
|
2
|
+
/**
|
|
3
|
+
* Google, through the Gemini Developer API rather than Vertex AI: it takes a
|
|
4
|
+
* plain API key instead of minting service-account tokens against a project and
|
|
5
|
+
* a region.
|
|
6
|
+
*
|
|
7
|
+
* The host serves two conventions at once. Image generation goes through the
|
|
8
|
+
* newer Interactions API with snake_case `input`/`response_format`; Veo uses the
|
|
9
|
+
* older `instances`/`parameters` predict envelope in camelCase. One serializer
|
|
10
|
+
* cannot produce both, which is why the two are modelled separately here.
|
|
11
|
+
*
|
|
12
|
+
* Imagen is deliberately absent — Imagen 4 shut down on 17 August 2026 and its
|
|
13
|
+
* reference page is now only a deprecation notice.
|
|
14
|
+
*/
|
|
15
|
+
export interface GoogleImageBinding {
|
|
16
|
+
/** `512px` is lite-only; the rest are uppercase K by the vendor's own spec. */
|
|
17
|
+
sizes: string[];
|
|
18
|
+
/** USD per image at 1K, since billing is token-based and scales with size. */
|
|
19
|
+
usdAt1K: number;
|
|
20
|
+
}
|
|
21
|
+
export declare const GOOGLE_IMAGE_MODELS: Record<string, GoogleImageBinding>;
|
|
22
|
+
export interface GoogleVideoBinding {
|
|
23
|
+
/**
|
|
24
|
+
* Which of the host's two APIs serves it. Veo uses the older
|
|
25
|
+
* `instances`/`parameters` predict envelope in camelCase; Omni uses the same
|
|
26
|
+
* Interactions API as images, in snake_case. They cannot share a serializer.
|
|
27
|
+
*/
|
|
28
|
+
api: "predict" | "interactions";
|
|
29
|
+
resolutions: string[];
|
|
30
|
+
/** Sent as a string, not a number. */
|
|
31
|
+
durations: string[];
|
|
32
|
+
referenceImages: boolean;
|
|
33
|
+
/** Omni refines a previous result through `previous_interaction_id`. */
|
|
34
|
+
conversationalEditing?: boolean;
|
|
35
|
+
/** USD per second, when published. Omni's rate is not on the pricing page. */
|
|
36
|
+
usdPerSecond?: number;
|
|
37
|
+
/** Per-second rates that differ by resolution. */
|
|
38
|
+
usdByResolution?: Record<string, number>;
|
|
39
|
+
}
|
|
40
|
+
export declare const GOOGLE_VIDEO_MODELS: Record<string, GoogleVideoBinding>;
|
|
41
|
+
export declare const GOOGLE_CATALOG: AIModelConfig[];
|
|
42
|
+
//# sourceMappingURL=google.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google.models.d.ts","sourceRoot":"","sources":["../../src/providers/google.models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,kBAAkB;IAClC,+EAA+E;IAC/E,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;CAChB;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAWlE,CAAC;AAEF,MAAM,WAAW,kBAAkB;IAClC;;;;OAIG;IACH,GAAG,EAAE,SAAS,GAAG,cAAc,CAAC;IAChC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,sCAAsC;IACtC,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB,eAAe,EAAE,OAAO,CAAC;IACzB,wEAAwE;IACxE,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8EAA8E;IAC9E,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kDAAkD;IAClD,eAAe,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACzC;AAED,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CA0ClE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAAa,EA0CzC,CAAC"}
|
|
@@ -0,0 +1,159 @@
|
|
|
1
|
+
import type { AIModelConfig } from "../constants/model.types";
|
|
2
|
+
/**
|
|
3
|
+
* Kling runs two HTTP APIs side by side on the same host.
|
|
4
|
+
*
|
|
5
|
+
* - `v1` — `POST /v1/videos/{text2video,image2video}`, body `{model_name, prompt, image}`,
|
|
6
|
+
* polled per-kind, reports `succeed`, results under `task_result.videos[]`.
|
|
7
|
+
* - `next` — `POST /{text-to-video,image-to-video}/{model}`, body `{prompt|contents, settings}`,
|
|
8
|
+
* polled through one `GET /tasks`, reports `succeeded`, results under `outputs[]`.
|
|
9
|
+
*
|
|
10
|
+
* Newer models exist only on `next`, older ones only on `v1`. Everything in this
|
|
11
|
+
* file was verified against the live API by probing validation order: the server
|
|
12
|
+
* checks fields one at a time, so an intentionally invalid later field reveals
|
|
13
|
+
* whether the earlier one was accepted, without ever queueing a paid task.
|
|
14
|
+
*/
|
|
15
|
+
export type KlingApi = "v1" | "next";
|
|
16
|
+
export interface KlingModelBinding {
|
|
17
|
+
/** What the API calls it, which differs from our catalog id. */
|
|
18
|
+
modelName: string;
|
|
19
|
+
api: KlingApi;
|
|
20
|
+
kind: "video" | "image";
|
|
21
|
+
imageToVideo?: boolean;
|
|
22
|
+
textToVideo?: boolean;
|
|
23
|
+
/** Exactly the durations the API accepts. Anything else is rejected. */
|
|
24
|
+
durations?: number[];
|
|
25
|
+
resolutions?: string[];
|
|
26
|
+
/** `kling-v1-5` rejects "std" on text2video. */
|
|
27
|
+
modes?: Array<"std" | "pro">;
|
|
28
|
+
/** `kling-3.0-turbo` takes a first frame only. Defaults to true. */
|
|
29
|
+
lastFrame?: boolean;
|
|
30
|
+
}
|
|
31
|
+
export declare const KLING_MODELS: Record<string, KlingModelBinding>;
|
|
32
|
+
/**
|
|
33
|
+
* Speech. `POST /v1/audio/tts`, which is a third dialect on this host: its body
|
|
34
|
+
* is snake_case, while the path-versioned video API uses `contents`/`settings`
|
|
35
|
+
* and the legacy one uses `model_name`. Sending camelCase here lands in another
|
|
36
|
+
* DTO and reports a misleading "must not be blank" for fields you did send.
|
|
37
|
+
*
|
|
38
|
+
* Every id below was verified against the live API — an unknown one answers
|
|
39
|
+
* "Voice id not found", so this list is measured rather than transcribed.
|
|
40
|
+
*/
|
|
41
|
+
export declare const KLING_VOICES: readonly ["genshin_vindi2", "zhinen_xuesheng", "ai_shatang", "genshin_klee2", "genshin_kirara", "ai_kaiya", "chat1_female_new-3", "cartoon-boy-07", "cartoon-girl-01", "uk_boy1", "uk_man2", "PeppaPig_platform", "ai_huangzhong_712", "ai_huangyaoshi_712", "ai_laoguowang_712", "chengshu_jiejie", "you_pingjing", "calm_story1", "laopopo_speech02", "heainainai_speech02"];
|
|
42
|
+
/** Speech is one endpoint, not a family, so the catalog carries one entry. */
|
|
43
|
+
export declare const KLING_AUDIO_MODEL = "kling/tts";
|
|
44
|
+
export declare const KLING_AUDIO_CATALOG: AIModelConfig[];
|
|
45
|
+
/** Catalog entries for every Kling model, all routed to the native adapter. */
|
|
46
|
+
export declare const KLING_CATALOG: AIModelConfig[];
|
|
47
|
+
/** Where a capability's results land in the polled task. */
|
|
48
|
+
export type KlingResultField = "outputs" | "videos" | "images" | "elements";
|
|
49
|
+
export interface KlingCapability<TInput> {
|
|
50
|
+
/** Path to POST to. A function because some embed the model. */
|
|
51
|
+
path: (input: TInput) => string;
|
|
52
|
+
api: KlingApi;
|
|
53
|
+
body: (input: TInput) => Record<string, unknown>;
|
|
54
|
+
results: KlingResultField;
|
|
55
|
+
/** Media kind of the result, for the output mime type. */
|
|
56
|
+
kind: "video" | "image" | "element";
|
|
57
|
+
}
|
|
58
|
+
/** Options every path-versioned capability accepts. */
|
|
59
|
+
export interface KlingRequestOptions {
|
|
60
|
+
callbackUrl?: string;
|
|
61
|
+
/** Your own id for the task. Must be unique within your account. */
|
|
62
|
+
externalTaskId?: string;
|
|
63
|
+
watermark?: boolean;
|
|
64
|
+
}
|
|
65
|
+
export interface MotionControlInput {
|
|
66
|
+
/** `kling-3.0` or `kling-2.6`. */
|
|
67
|
+
model?: "kling-3.0" | "kling-2.6";
|
|
68
|
+
/** The character you want. URL or bare base64. */
|
|
69
|
+
imageUrl: string;
|
|
70
|
+
/** The movement you want. URL only, mp4/mov, max 100MB. */
|
|
71
|
+
videoUrl: string;
|
|
72
|
+
/**
|
|
73
|
+
* Whose framing the output follows. `image` caps the reference video at 10s,
|
|
74
|
+
* `video` allows 30s.
|
|
75
|
+
*/
|
|
76
|
+
characterOrientation: "image" | "video";
|
|
77
|
+
prompt?: string;
|
|
78
|
+
resolution?: "720p" | "1080p";
|
|
79
|
+
/** Defaults to `original` here, unlike every other endpoint. */
|
|
80
|
+
audio?: "original" | "off";
|
|
81
|
+
options?: KlingRequestOptions;
|
|
82
|
+
}
|
|
83
|
+
export declare const motionControl: KlingCapability<MotionControlInput>;
|
|
84
|
+
export interface OmniVideoReference {
|
|
85
|
+
/** `refer_image` is a free-standing style or scene reference. */
|
|
86
|
+
type: "first_frame" | "last_frame" | "refer_image" | "feature_video" | "base_video";
|
|
87
|
+
url: string;
|
|
88
|
+
/** Task-local id, cited in the prompt as `@id`. */
|
|
89
|
+
id?: string;
|
|
90
|
+
}
|
|
91
|
+
export interface OmniVideoInput {
|
|
92
|
+
model?: "kling-3.0-omni" | "kling-o1";
|
|
93
|
+
prompt: string;
|
|
94
|
+
references?: OmniVideoReference[];
|
|
95
|
+
/** Library elements, cited in the prompt as `@id`. */
|
|
96
|
+
elements?: Array<{
|
|
97
|
+
elementId: string;
|
|
98
|
+
id: string;
|
|
99
|
+
}>;
|
|
100
|
+
resolution?: "720p" | "1080p" | "4k";
|
|
101
|
+
duration?: number;
|
|
102
|
+
/** `original` keeps the reference video's own audio track. */
|
|
103
|
+
audio?: "native" | "original" | "off";
|
|
104
|
+
/** Required when there is neither a first frame nor a reference video. */
|
|
105
|
+
aspectRatio?: "16:9" | "9:16" | "1:1";
|
|
106
|
+
multiShot?: boolean;
|
|
107
|
+
options?: KlingRequestOptions;
|
|
108
|
+
}
|
|
109
|
+
export declare const omniVideo: KlingCapability<OmniVideoInput>;
|
|
110
|
+
export interface AvatarInput {
|
|
111
|
+
/** Portrait. URL or bare base64, max 10MB. */
|
|
112
|
+
imageUrl: string;
|
|
113
|
+
/** Either an id from the TTS API, or a sound file. Exactly one. */
|
|
114
|
+
audioId?: string;
|
|
115
|
+
soundFileUrl?: string;
|
|
116
|
+
/** Drives gestures, emotion and camera movement. */
|
|
117
|
+
prompt?: string;
|
|
118
|
+
mode?: "std" | "pro";
|
|
119
|
+
options?: KlingRequestOptions;
|
|
120
|
+
}
|
|
121
|
+
export declare const avatar: KlingCapability<AvatarInput>;
|
|
122
|
+
export interface OutpaintingInput {
|
|
123
|
+
imageUrl: string;
|
|
124
|
+
/**
|
|
125
|
+
* All four are required even at zero. Up/down multiply the original height,
|
|
126
|
+
* left/right the original width. The result may not exceed 3x the original area.
|
|
127
|
+
*/
|
|
128
|
+
up: number;
|
|
129
|
+
down: number;
|
|
130
|
+
left: number;
|
|
131
|
+
right: number;
|
|
132
|
+
prompt?: string;
|
|
133
|
+
n?: number;
|
|
134
|
+
options?: KlingRequestOptions;
|
|
135
|
+
}
|
|
136
|
+
export declare const outpainting: KlingCapability<OutpaintingInput>;
|
|
137
|
+
export interface ImageOmniInput {
|
|
138
|
+
model?: "kling-image-o1" | "kling-v3-omni";
|
|
139
|
+
/** Reference images are cited positionally as `<<<image_1>>>`. */
|
|
140
|
+
prompt: string;
|
|
141
|
+
imageUrls?: string[];
|
|
142
|
+
elementIds?: string[];
|
|
143
|
+
resolution?: "1k" | "2k" | "4k";
|
|
144
|
+
/** `series` emits a coherent set instead of one image. */
|
|
145
|
+
resultType?: "single" | "series";
|
|
146
|
+
seriesAmount?: number | "auto";
|
|
147
|
+
n?: number;
|
|
148
|
+
aspectRatio?: string;
|
|
149
|
+
options?: KlingRequestOptions;
|
|
150
|
+
}
|
|
151
|
+
export declare const imageOmni: KlingCapability<ImageOmniInput>;
|
|
152
|
+
export declare const KLING_CAPABILITIES: {
|
|
153
|
+
readonly motionControl: KlingCapability<MotionControlInput>;
|
|
154
|
+
readonly omniVideo: KlingCapability<OmniVideoInput>;
|
|
155
|
+
readonly avatar: KlingCapability<AvatarInput>;
|
|
156
|
+
readonly outpainting: KlingCapability<OutpaintingInput>;
|
|
157
|
+
readonly imageOmni: KlingCapability<ImageOmniInput>;
|
|
158
|
+
};
|
|
159
|
+
//# sourceMappingURL=kling.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"kling.models.d.ts","sourceRoot":"","sources":["../../src/providers/kling.models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;;;;;;;GAYG;AACH,MAAM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BAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,WAAW,EAAE,eAAe,CAAC,gBAAgB,CAiCzD,CAAC;AAIF,MAAM,WAAW,cAAc;IAC9B,KAAK,CAAC,EAAE,gBAAgB,GAAG,eAAe,CAAC;IAC3C,kEAAkE;IAClE,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;IAChC,0DAA0D;IAC1D,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IACjC,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,CAAC,CAAC,EAAE,MAAM,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,mBAAmB,CAAC;CAC9B;AAED,eAAO,MAAM,SAAS,EAAE,eAAe,CAAC,cAAc,CAkCrD,CAAC;AAEF,eAAO,MAAM,kBAAkB;;;;;;CAMrB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { AIModelConfig } from "../constants/model.types";
|
|
2
|
+
/**
|
|
3
|
+
* OpenAI images.
|
|
4
|
+
*
|
|
5
|
+
* No video: the Videos API and every Sora model are deprecated with a hard
|
|
6
|
+
* shutdown on 24 September 2026, and OpenAI lists no replacement. Building that
|
|
7
|
+
* adapter would be building something with five weeks left.
|
|
8
|
+
*/
|
|
9
|
+
export interface OpenAIImageBinding {
|
|
10
|
+
/** Sizes the model accepts. `any` means arbitrary WxH within the limits. */
|
|
11
|
+
sizes: string[] | "any";
|
|
12
|
+
/** Quality tiers, which drive a 35x price swing. */
|
|
13
|
+
qualities: Array<"low" | "medium" | "high">;
|
|
14
|
+
/** gpt-image-2 rejects `background: transparent` outright. */
|
|
15
|
+
transparentBackground: boolean;
|
|
16
|
+
/** Deprecated models still answer, but not for long. */
|
|
17
|
+
shutdownOn?: string;
|
|
18
|
+
/** USD per image, by quality, at 1024x1024. */
|
|
19
|
+
usd: {
|
|
20
|
+
low: number;
|
|
21
|
+
medium: number;
|
|
22
|
+
high: number;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
export declare const OPENAI_IMAGE_MODELS: Record<string, OpenAIImageBinding>;
|
|
26
|
+
export declare const OPENAI_CATALOG: AIModelConfig[];
|
|
27
|
+
//# sourceMappingURL=openai.models.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"openai.models.d.ts","sourceRoot":"","sources":["../../src/providers/openai.models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,WAAW,kBAAkB;IAClC,4EAA4E;IAC5E,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;IACxB,oDAAoD;IACpD,SAAS,EAAE,KAAK,CAAC,KAAK,GAAG,QAAQ,GAAG,MAAM,CAAC,CAAC;IAC5C,8DAA8D;IAC9D,qBAAqB,EAAE,OAAO,CAAC;IAC/B,wDAAwD;IACxD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,+CAA+C;IAC/C,GAAG,EAAE;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACnD;AAID,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAuBlE,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,aAAa,EAkBvC,CAAC"}
|