@ai-sdk/fal 3.0.0-beta.8 → 3.0.0-canary.32
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 +209 -0
- package/README.md +2 -0
- package/dist/index.js +303 -233
- package/dist/index.js.map +1 -1
- package/package.json +11 -9
- package/src/fal-config.ts +2 -2
- package/src/{fal-image-options.ts → fal-image-model-options.ts} +5 -1
- package/src/fal-image-model.ts +23 -6
- package/src/fal-provider.ts +10 -10
- package/src/fal-speech-model-options.ts +21 -0
- package/src/fal-speech-model.ts +22 -24
- package/src/fal-transcription-model-options.ts +43 -0
- package/src/fal-transcription-model.ts +25 -49
- package/src/fal-video-model-options.ts +39 -0
- package/src/fal-video-model.ts +6 -41
- package/src/index.ts +4 -4
- package/dist/index.d.mts +0 -156
- package/dist/index.mjs +0 -1126
- package/dist/index.mjs.map +0 -1
package/src/fal-speech-model.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';
|
|
1
|
+
import type { SpeechModelV4, SharedV4Warning } from '@ai-sdk/provider';
|
|
2
2
|
import {
|
|
3
3
|
combineHeaders,
|
|
4
4
|
createBinaryResponseHandler,
|
|
@@ -7,31 +7,15 @@ import {
|
|
|
7
7
|
getFromApi,
|
|
8
8
|
parseProviderOptions,
|
|
9
9
|
postJsonToApi,
|
|
10
|
+
serializeModelOptions,
|
|
11
|
+
WORKFLOW_SERIALIZE,
|
|
12
|
+
WORKFLOW_DESERIALIZE,
|
|
10
13
|
} from '@ai-sdk/provider-utils';
|
|
11
14
|
import { z } from 'zod/v4';
|
|
12
|
-
import { FalConfig } from './fal-config';
|
|
15
|
+
import type { FalConfig } from './fal-config';
|
|
13
16
|
import { falFailedResponseHandler } from './fal-error';
|
|
14
|
-
import {
|
|
15
|
-
import { FalSpeechModelId } from './fal-speech-settings';
|
|
16
|
-
|
|
17
|
-
const falSpeechModelOptionsSchema = z.looseObject({
|
|
18
|
-
voice_setting: z
|
|
19
|
-
.object({
|
|
20
|
-
speed: z.number().nullish(),
|
|
21
|
-
vol: z.number().nullish(),
|
|
22
|
-
voice_id: z.string().nullish(),
|
|
23
|
-
pitch: z.number().nullish(),
|
|
24
|
-
english_normalization: z.boolean().nullish(),
|
|
25
|
-
emotion: z.enum(FAL_EMOTIONS).nullish(),
|
|
26
|
-
})
|
|
27
|
-
.partial()
|
|
28
|
-
.nullish(),
|
|
29
|
-
audio_setting: z.record(z.string(), z.unknown()).nullish(),
|
|
30
|
-
language_boost: z.enum(FAL_LANGUAGE_BOOSTS).nullish(),
|
|
31
|
-
pronunciation_dict: z.record(z.string(), z.string()).nullish(),
|
|
32
|
-
});
|
|
33
|
-
|
|
34
|
-
export type FalSpeechModelOptions = z.infer<typeof falSpeechModelOptionsSchema>;
|
|
17
|
+
import { falSpeechModelOptionsSchema } from './fal-speech-model-options';
|
|
18
|
+
import type { FalSpeechModelId } from './fal-speech-settings';
|
|
35
19
|
|
|
36
20
|
interface FalSpeechModelConfig extends FalConfig {
|
|
37
21
|
_internal?: {
|
|
@@ -46,6 +30,20 @@ export class FalSpeechModel implements SpeechModelV4 {
|
|
|
46
30
|
return this.config.provider;
|
|
47
31
|
}
|
|
48
32
|
|
|
33
|
+
static [WORKFLOW_SERIALIZE](model: FalSpeechModel) {
|
|
34
|
+
return serializeModelOptions({
|
|
35
|
+
modelId: model.modelId,
|
|
36
|
+
config: model.config,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
41
|
+
modelId: FalSpeechModelId;
|
|
42
|
+
config: FalSpeechModelConfig;
|
|
43
|
+
}) {
|
|
44
|
+
return new FalSpeechModel(options.modelId, options.config);
|
|
45
|
+
}
|
|
46
|
+
|
|
49
47
|
constructor(
|
|
50
48
|
readonly modelId: FalSpeechModelId,
|
|
51
49
|
private readonly config: FalSpeechModelConfig,
|
|
@@ -112,7 +110,7 @@ export class FalSpeechModel implements SpeechModelV4 {
|
|
|
112
110
|
path: `https://fal.run/${this.modelId}`,
|
|
113
111
|
modelId: this.modelId,
|
|
114
112
|
}),
|
|
115
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
113
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
116
114
|
body: requestBody,
|
|
117
115
|
failedResponseHandler: falFailedResponseHandler,
|
|
118
116
|
successfulResponseHandler: createJsonResponseHandler(
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
|
|
3
|
+
// https://fal.ai/models/fal-ai/whisper/api?platform=http
|
|
4
|
+
export const falTranscriptionModelOptionsSchema = z.object({
|
|
5
|
+
/**
|
|
6
|
+
* Language of the audio file. If set to null, the language will be automatically detected. Defaults to null.
|
|
7
|
+
*
|
|
8
|
+
* If translate is selected as the task, the audio will be translated to English, regardless of the language selected.
|
|
9
|
+
*/
|
|
10
|
+
language: z
|
|
11
|
+
.union([z.enum(['en']), z.string()])
|
|
12
|
+
.nullish()
|
|
13
|
+
.default('en'),
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Whether to diarize the audio file. Defaults to true.
|
|
17
|
+
*/
|
|
18
|
+
diarize: z.boolean().nullish().default(true),
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Level of the chunks to return. Either segment or word. Default value: "segment"
|
|
22
|
+
*/
|
|
23
|
+
chunkLevel: z.enum(['segment', 'word']).nullish().default('segment'),
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Version of the model to use. All of the models are the Whisper large variant. Default value: "3"
|
|
27
|
+
*/
|
|
28
|
+
version: z.enum(['3']).nullish().default('3'),
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Default value: 64
|
|
32
|
+
*/
|
|
33
|
+
batchSize: z.number().nullish().default(64),
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Number of speakers in the audio file. Defaults to null. If not provided, the number of speakers will be automatically detected.
|
|
37
|
+
*/
|
|
38
|
+
numSpeakers: z.number().nullable().nullish(),
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
export type FalTranscriptionModelOptions = z.infer<
|
|
42
|
+
typeof falTranscriptionModelOptionsSchema
|
|
43
|
+
>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
AISDKError,
|
|
3
|
-
TranscriptionModelV4,
|
|
4
|
-
SharedV4Warning,
|
|
3
|
+
type TranscriptionModelV4,
|
|
4
|
+
type SharedV4Warning,
|
|
5
5
|
} from '@ai-sdk/provider';
|
|
6
6
|
import {
|
|
7
7
|
combineHeaders,
|
|
@@ -12,54 +12,16 @@ import {
|
|
|
12
12
|
getFromApi,
|
|
13
13
|
parseProviderOptions,
|
|
14
14
|
postJsonToApi,
|
|
15
|
+
serializeModelOptions,
|
|
16
|
+
WORKFLOW_SERIALIZE,
|
|
17
|
+
WORKFLOW_DESERIALIZE,
|
|
15
18
|
} from '@ai-sdk/provider-utils';
|
|
16
19
|
import { z } from 'zod/v4';
|
|
17
|
-
import { FalConfig } from './fal-config';
|
|
20
|
+
import type { FalConfig } from './fal-config';
|
|
18
21
|
import { falErrorDataSchema, falFailedResponseHandler } from './fal-error';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
22
|
-
// https://fal.ai/models/fal-ai/whisper/api?platform=http
|
|
23
|
-
const falTranscriptionModelOptionsSchema = z.object({
|
|
24
|
-
/**
|
|
25
|
-
* Language of the audio file. If set to null, the language will be automatically detected. Defaults to null.
|
|
26
|
-
*
|
|
27
|
-
* If translate is selected as the task, the audio will be translated to English, regardless of the language selected.
|
|
28
|
-
*/
|
|
29
|
-
language: z
|
|
30
|
-
.union([z.enum(['en']), z.string()])
|
|
31
|
-
.nullish()
|
|
32
|
-
.default('en'),
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* Whether to diarize the audio file. Defaults to true.
|
|
36
|
-
*/
|
|
37
|
-
diarize: z.boolean().nullish().default(true),
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* Level of the chunks to return. Either segment or word. Default value: "segment"
|
|
41
|
-
*/
|
|
42
|
-
chunkLevel: z.enum(['segment', 'word']).nullish().default('segment'),
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Version of the model to use. All of the models are the Whisper large variant. Default value: "3"
|
|
46
|
-
*/
|
|
47
|
-
version: z.enum(['3']).nullish().default('3'),
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* Default value: 64
|
|
51
|
-
*/
|
|
52
|
-
batchSize: z.number().nullish().default(64),
|
|
53
|
-
|
|
54
|
-
/**
|
|
55
|
-
* Number of speakers in the audio file. Defaults to null. If not provided, the number of speakers will be automatically detected.
|
|
56
|
-
*/
|
|
57
|
-
numSpeakers: z.number().nullable().nullish(),
|
|
58
|
-
});
|
|
59
|
-
|
|
60
|
-
export type FalTranscriptionModelOptions = z.infer<
|
|
61
|
-
typeof falTranscriptionModelOptionsSchema
|
|
62
|
-
>;
|
|
22
|
+
import { falTranscriptionModelOptionsSchema } from './fal-transcription-model-options';
|
|
23
|
+
import type { FalTranscriptionModelId } from './fal-transcription-options';
|
|
24
|
+
import type { FalTranscriptionAPITypes } from './fal-api-types';
|
|
63
25
|
|
|
64
26
|
interface FalTranscriptionModelConfig extends FalConfig {
|
|
65
27
|
_internal?: {
|
|
@@ -74,6 +36,20 @@ export class FalTranscriptionModel implements TranscriptionModelV4 {
|
|
|
74
36
|
return this.config.provider;
|
|
75
37
|
}
|
|
76
38
|
|
|
39
|
+
static [WORKFLOW_SERIALIZE](model: FalTranscriptionModel) {
|
|
40
|
+
return serializeModelOptions({
|
|
41
|
+
modelId: model.modelId,
|
|
42
|
+
config: model.config,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
static [WORKFLOW_DESERIALIZE](options: {
|
|
47
|
+
modelId: FalTranscriptionModelId;
|
|
48
|
+
config: FalTranscriptionModelConfig;
|
|
49
|
+
}) {
|
|
50
|
+
return new FalTranscriptionModel(options.modelId, options.config);
|
|
51
|
+
}
|
|
52
|
+
|
|
77
53
|
constructor(
|
|
78
54
|
readonly modelId: FalTranscriptionModelId,
|
|
79
55
|
private readonly config: FalTranscriptionModelConfig,
|
|
@@ -138,7 +114,7 @@ export class FalTranscriptionModel implements TranscriptionModelV4 {
|
|
|
138
114
|
path: `https://queue.fal.run/fal-ai/${this.modelId}`,
|
|
139
115
|
modelId: this.modelId,
|
|
140
116
|
}),
|
|
141
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
117
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
142
118
|
body: {
|
|
143
119
|
...body,
|
|
144
120
|
audio_url: audioUrl,
|
|
@@ -170,7 +146,7 @@ export class FalTranscriptionModel implements TranscriptionModelV4 {
|
|
|
170
146
|
path: `https://queue.fal.run/fal-ai/${this.modelId}/requests/${queueResponse.request_id}`,
|
|
171
147
|
modelId: this.modelId,
|
|
172
148
|
}),
|
|
173
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
149
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
174
150
|
failedResponseHandler: async ({
|
|
175
151
|
requestBodyValues,
|
|
176
152
|
response,
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { lazySchema, zodSchema } from '@ai-sdk/provider-utils';
|
|
2
|
+
import { z } from 'zod/v4';
|
|
3
|
+
|
|
4
|
+
export type FalVideoModelOptions = {
|
|
5
|
+
loop?: boolean | null;
|
|
6
|
+
motionStrength?: number | null;
|
|
7
|
+
pollIntervalMs?: number | null;
|
|
8
|
+
pollTimeoutMs?: number | null;
|
|
9
|
+
resolution?: string | null;
|
|
10
|
+
negativePrompt?: string | null;
|
|
11
|
+
promptOptimizer?: boolean | null;
|
|
12
|
+
[key: string]: unknown; // For passthrough
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
// Provider options schema for FAL video generation
|
|
16
|
+
export const falVideoModelOptionsSchema = lazySchema(() =>
|
|
17
|
+
zodSchema(
|
|
18
|
+
z
|
|
19
|
+
.object({
|
|
20
|
+
// Video loop - only for Luma models
|
|
21
|
+
loop: z.boolean().nullish(),
|
|
22
|
+
|
|
23
|
+
// Motion strength (provider-specific)
|
|
24
|
+
motionStrength: z.number().min(0).max(1).nullish(),
|
|
25
|
+
|
|
26
|
+
// Polling configuration
|
|
27
|
+
pollIntervalMs: z.number().positive().nullish(),
|
|
28
|
+
pollTimeoutMs: z.number().positive().nullish(),
|
|
29
|
+
|
|
30
|
+
// Resolution (model-specific, e.g., '480p', '720p', '1080p')
|
|
31
|
+
resolution: z.string().nullish(),
|
|
32
|
+
|
|
33
|
+
// Model-specific parameters
|
|
34
|
+
negativePrompt: z.string().nullish(),
|
|
35
|
+
promptOptimizer: z.boolean().nullish(),
|
|
36
|
+
})
|
|
37
|
+
.passthrough(),
|
|
38
|
+
),
|
|
39
|
+
);
|
package/src/fal-video-model.ts
CHANGED
|
@@ -10,53 +10,18 @@ import {
|
|
|
10
10
|
createJsonResponseHandler,
|
|
11
11
|
delay,
|
|
12
12
|
getFromApi,
|
|
13
|
-
lazySchema,
|
|
14
13
|
parseProviderOptions,
|
|
15
14
|
postJsonToApi,
|
|
16
|
-
zodSchema,
|
|
17
15
|
} from '@ai-sdk/provider-utils';
|
|
18
16
|
import { z } from 'zod/v4';
|
|
19
17
|
import type { FalConfig } from './fal-config';
|
|
20
18
|
import { falErrorDataSchema, falFailedResponseHandler } from './fal-error';
|
|
19
|
+
import {
|
|
20
|
+
falVideoModelOptionsSchema,
|
|
21
|
+
type FalVideoModelOptions,
|
|
22
|
+
} from './fal-video-model-options';
|
|
21
23
|
import type { FalVideoModelId } from './fal-video-settings';
|
|
22
24
|
|
|
23
|
-
export type FalVideoModelOptions = {
|
|
24
|
-
loop?: boolean | null;
|
|
25
|
-
motionStrength?: number | null;
|
|
26
|
-
pollIntervalMs?: number | null;
|
|
27
|
-
pollTimeoutMs?: number | null;
|
|
28
|
-
resolution?: string | null;
|
|
29
|
-
negativePrompt?: string | null;
|
|
30
|
-
promptOptimizer?: boolean | null;
|
|
31
|
-
[key: string]: unknown; // For passthrough
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
// Provider options schema for FAL video generation
|
|
35
|
-
export const falVideoModelOptionsSchema = lazySchema(() =>
|
|
36
|
-
zodSchema(
|
|
37
|
-
z
|
|
38
|
-
.object({
|
|
39
|
-
// Video loop - only for Luma models
|
|
40
|
-
loop: z.boolean().nullish(),
|
|
41
|
-
|
|
42
|
-
// Motion strength (provider-specific)
|
|
43
|
-
motionStrength: z.number().min(0).max(1).nullish(),
|
|
44
|
-
|
|
45
|
-
// Polling configuration
|
|
46
|
-
pollIntervalMs: z.number().positive().nullish(),
|
|
47
|
-
pollTimeoutMs: z.number().positive().nullish(),
|
|
48
|
-
|
|
49
|
-
// Resolution (model-specific, e.g., '480p', '720p', '1080p')
|
|
50
|
-
resolution: z.string().nullish(),
|
|
51
|
-
|
|
52
|
-
// Model-specific parameters
|
|
53
|
-
negativePrompt: z.string().nullish(),
|
|
54
|
-
promptOptimizer: z.boolean().nullish(),
|
|
55
|
-
})
|
|
56
|
-
.passthrough(),
|
|
57
|
-
),
|
|
58
|
-
);
|
|
59
|
-
|
|
60
25
|
interface FalVideoModelConfig extends FalConfig {
|
|
61
26
|
_internal?: {
|
|
62
27
|
currentDate?: () => Date;
|
|
@@ -158,7 +123,7 @@ export class FalVideoModel implements Experimental_VideoModelV4 {
|
|
|
158
123
|
path: `https://queue.fal.run/fal-ai/${this.normalizedModelId}`,
|
|
159
124
|
modelId: this.modelId,
|
|
160
125
|
}),
|
|
161
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
126
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
162
127
|
body,
|
|
163
128
|
failedResponseHandler: falFailedResponseHandler,
|
|
164
129
|
successfulResponseHandler:
|
|
@@ -189,7 +154,7 @@ export class FalVideoModel implements Experimental_VideoModelV4 {
|
|
|
189
154
|
path: responseUrl,
|
|
190
155
|
modelId: this.modelId,
|
|
191
156
|
}),
|
|
192
|
-
headers: combineHeaders(this.config.headers(), options.headers),
|
|
157
|
+
headers: combineHeaders(this.config.headers?.(), options.headers),
|
|
193
158
|
failedResponseHandler: async ({
|
|
194
159
|
response,
|
|
195
160
|
url,
|
package/src/index.ts
CHANGED
|
@@ -4,13 +4,13 @@ export type {
|
|
|
4
4
|
FalImageModelOptions,
|
|
5
5
|
/** @deprecated Use `FalImageModelOptions` instead. */
|
|
6
6
|
FalImageModelOptions as FalImageProviderOptions,
|
|
7
|
-
} from './fal-image-options';
|
|
8
|
-
export type { FalSpeechModelOptions } from './fal-speech-model';
|
|
9
|
-
export type { FalTranscriptionModelOptions } from './fal-transcription-model';
|
|
7
|
+
} from './fal-image-model-options';
|
|
8
|
+
export type { FalSpeechModelOptions } from './fal-speech-model-options';
|
|
9
|
+
export type { FalTranscriptionModelOptions } from './fal-transcription-model-options';
|
|
10
10
|
export type {
|
|
11
11
|
FalVideoModelOptions,
|
|
12
12
|
/** @deprecated Use `FalVideoModelOptions` instead. */
|
|
13
13
|
FalVideoModelOptions as FalVideoProviderOptions,
|
|
14
|
-
} from './fal-video-model';
|
|
14
|
+
} from './fal-video-model-options';
|
|
15
15
|
export type { FalVideoModelId } from './fal-video-settings';
|
|
16
16
|
export { VERSION } from './version';
|
package/dist/index.d.mts
DELETED
|
@@ -1,156 +0,0 @@
|
|
|
1
|
-
import { ProviderV4, ImageModelV4, TranscriptionModelV4, Experimental_VideoModelV4, SpeechModelV4 } from '@ai-sdk/provider';
|
|
2
|
-
import * as _ai_sdk_provider_utils from '@ai-sdk/provider-utils';
|
|
3
|
-
import { FetchFunction, InferSchema } from '@ai-sdk/provider-utils';
|
|
4
|
-
import { z } from 'zod/v4';
|
|
5
|
-
|
|
6
|
-
type FalImageModelId = 'fal-ai/aura-sr' | 'fal-ai/bria/background/remove' | 'fal-ai/bria/eraser' | 'fal-ai/bria/product-shot' | 'fal-ai/bria/reimagine' | 'bria/text-to-image/3.2' | 'fal-ai/bria/text-to-image/base' | 'fal-ai/bria/text-to-image/fast' | 'fal-ai/bria/text-to-image/hd' | 'fal-ai/bytedance/dreamina/v3.1/text-to-image' | 'fal-ai/ccsr' | 'fal-ai/clarity-upscaler' | 'fal-ai/creative-upscaler' | 'fal-ai/esrgan' | 'fal-ai/flux-general' | 'fal-ai/flux-general/differential-diffusion' | 'fal-ai/flux-general/image-to-image' | 'fal-ai/flux-general/inpainting' | 'fal-ai/flux-general/rf-inversion' | 'fal-ai/flux-kontext-lora/text-to-image' | 'fal-ai/flux-lora' | 'fal-ai/flux-lora/image-to-image' | 'fal-ai/flux-lora/inpainting' | 'fal-ai/flux-pro/kontext' | 'fal-ai/flux-pro/kontext/max' | 'fal-ai/flux-pro/v1.1' | 'fal-ai/flux-pro/v1.1-ultra' | 'fal-ai/flux-pro/v1.1-ultra-finetuned' | 'fal-ai/flux-pro/v1.1-ultra/redux' | 'fal-ai/flux-pro/v1.1/redux' | 'fal-ai/flux/dev' | 'fal-ai/flux/dev/image-to-image' | 'fal-ai/flux/dev/redux' | 'fal-ai/flux/krea' | 'fal-ai/flux/krea/image-to-image' | 'fal-ai/flux/krea/redux' | 'fal-ai/flux/schnell' | 'fal-ai/flux/schnell/redux' | 'fal-ai/ideogram/character' | 'fal-ai/ideogram/character/edit' | 'fal-ai/ideogram/character/remix' | 'fal-ai/imagen4/preview' | 'fal-ai/luma-photon' | 'fal-ai/luma-photon/flash' | 'fal-ai/object-removal' | 'fal-ai/omnigen-v2' | 'fal-ai/qwen-image' | 'fal-ai/recraft/v3/text-to-image' | 'fal-ai/recraft/v3/image-to-image' | 'fal-ai/sana/sprint' | 'fal-ai/sana/v1.5/4.8b' | 'fal-ai/sana/v1.5/1.6b' | 'fal-ai/sky-raccoon' | 'fal-ai/wan/v2.2-5b/text-to-image' | 'fal-ai/wan/v2.2-a14b/text-to-image' | 'fal-ai/fashn/tryon/v1.6' | (string & {});
|
|
7
|
-
|
|
8
|
-
type FalTranscriptionModelId = 'whisper' | 'wizper' | (string & {});
|
|
9
|
-
|
|
10
|
-
type FalSpeechModelId = 'fal-ai/minimax/voice-clone' | 'fal-ai/minimax/voice-design' | 'fal-ai/dia-tts/voice-clone' | 'fal-ai/minimax/speech-02-hd' | 'fal-ai/minimax/speech-02-turbo' | 'fal-ai/dia-tts' | 'resemble-ai/chatterboxhd/text-to-speech' | (string & {});
|
|
11
|
-
|
|
12
|
-
type FalVideoModelId = 'luma-dream-machine' | 'luma-ray-2' | 'luma-ray-2-flash' | 'minimax-video' | 'minimax-video-01' | 'hunyuan-video' | (string & {});
|
|
13
|
-
|
|
14
|
-
interface FalProviderSettings {
|
|
15
|
-
/**
|
|
16
|
-
* fal.ai API key. Default value is taken from the `FAL_API_KEY` environment
|
|
17
|
-
* variable, falling back to `FAL_KEY`.
|
|
18
|
-
*/
|
|
19
|
-
apiKey?: string;
|
|
20
|
-
/**
|
|
21
|
-
* Base URL for the API calls.
|
|
22
|
-
* The default prefix is `https://fal.run`.
|
|
23
|
-
*/
|
|
24
|
-
baseURL?: string;
|
|
25
|
-
/**
|
|
26
|
-
* Custom headers to include in the requests.
|
|
27
|
-
*/
|
|
28
|
-
headers?: Record<string, string>;
|
|
29
|
-
/**
|
|
30
|
-
* Custom fetch implementation. You can use it as a middleware to intercept
|
|
31
|
-
* requests, or to provide a custom fetch implementation for e.g. testing.
|
|
32
|
-
*/
|
|
33
|
-
fetch?: FetchFunction;
|
|
34
|
-
}
|
|
35
|
-
interface FalProvider extends ProviderV4 {
|
|
36
|
-
/**
|
|
37
|
-
* Creates a model for image generation.
|
|
38
|
-
*/
|
|
39
|
-
image(modelId: FalImageModelId): ImageModelV4;
|
|
40
|
-
/**
|
|
41
|
-
* Creates a model for image generation.
|
|
42
|
-
*/
|
|
43
|
-
imageModel(modelId: FalImageModelId): ImageModelV4;
|
|
44
|
-
/**
|
|
45
|
-
* Creates a model for transcription.
|
|
46
|
-
*/
|
|
47
|
-
transcription(modelId: FalTranscriptionModelId): TranscriptionModelV4;
|
|
48
|
-
/**
|
|
49
|
-
* Creates a model for video generation.
|
|
50
|
-
*/
|
|
51
|
-
video(modelId: FalVideoModelId): Experimental_VideoModelV4;
|
|
52
|
-
/**
|
|
53
|
-
* Creates a model for video generation.
|
|
54
|
-
*/
|
|
55
|
-
videoModel(modelId: FalVideoModelId): Experimental_VideoModelV4;
|
|
56
|
-
/**
|
|
57
|
-
* Creates a model for speech generation.
|
|
58
|
-
*/
|
|
59
|
-
speech(modelId: FalSpeechModelId): SpeechModelV4;
|
|
60
|
-
/**
|
|
61
|
-
* @deprecated Use `embeddingModel` instead.
|
|
62
|
-
*/
|
|
63
|
-
textEmbeddingModel(modelId: string): never;
|
|
64
|
-
}
|
|
65
|
-
/**
|
|
66
|
-
* Create a fal.ai provider instance.
|
|
67
|
-
*/
|
|
68
|
-
declare function createFal(options?: FalProviderSettings): FalProvider;
|
|
69
|
-
/**
|
|
70
|
-
* Default fal.ai provider instance.
|
|
71
|
-
*/
|
|
72
|
-
declare const fal: FalProvider;
|
|
73
|
-
|
|
74
|
-
declare const falImageModelOptionsSchema: _ai_sdk_provider_utils.LazySchema<Record<string, unknown>>;
|
|
75
|
-
type FalImageModelOptions = InferSchema<typeof falImageModelOptionsSchema>;
|
|
76
|
-
|
|
77
|
-
declare const falSpeechModelOptionsSchema: z.ZodObject<{
|
|
78
|
-
voice_setting: z.ZodOptional<z.ZodNullable<z.ZodObject<{
|
|
79
|
-
speed: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
80
|
-
vol: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
81
|
-
voice_id: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
|
|
82
|
-
pitch: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
83
|
-
english_normalization: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
|
|
84
|
-
emotion: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
85
|
-
happy: "happy";
|
|
86
|
-
sad: "sad";
|
|
87
|
-
angry: "angry";
|
|
88
|
-
fearful: "fearful";
|
|
89
|
-
disgusted: "disgusted";
|
|
90
|
-
surprised: "surprised";
|
|
91
|
-
neutral: "neutral";
|
|
92
|
-
}>>>>;
|
|
93
|
-
}, z.core.$strip>>>;
|
|
94
|
-
audio_setting: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
95
|
-
language_boost: z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
96
|
-
Chinese: "Chinese";
|
|
97
|
-
"Chinese,Yue": "Chinese,Yue";
|
|
98
|
-
English: "English";
|
|
99
|
-
Arabic: "Arabic";
|
|
100
|
-
Russian: "Russian";
|
|
101
|
-
Spanish: "Spanish";
|
|
102
|
-
French: "French";
|
|
103
|
-
Portuguese: "Portuguese";
|
|
104
|
-
German: "German";
|
|
105
|
-
Turkish: "Turkish";
|
|
106
|
-
Dutch: "Dutch";
|
|
107
|
-
Ukrainian: "Ukrainian";
|
|
108
|
-
Vietnamese: "Vietnamese";
|
|
109
|
-
Indonesian: "Indonesian";
|
|
110
|
-
Japanese: "Japanese";
|
|
111
|
-
Italian: "Italian";
|
|
112
|
-
Korean: "Korean";
|
|
113
|
-
Thai: "Thai";
|
|
114
|
-
Polish: "Polish";
|
|
115
|
-
Romanian: "Romanian";
|
|
116
|
-
Greek: "Greek";
|
|
117
|
-
Czech: "Czech";
|
|
118
|
-
Finnish: "Finnish";
|
|
119
|
-
Hindi: "Hindi";
|
|
120
|
-
auto: "auto";
|
|
121
|
-
}>>>;
|
|
122
|
-
pronunciation_dict: z.ZodOptional<z.ZodNullable<z.ZodRecord<z.ZodString, z.ZodString>>>;
|
|
123
|
-
}, z.core.$loose>;
|
|
124
|
-
type FalSpeechModelOptions = z.infer<typeof falSpeechModelOptionsSchema>;
|
|
125
|
-
|
|
126
|
-
declare const falTranscriptionModelOptionsSchema: z.ZodObject<{
|
|
127
|
-
language: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodUnion<readonly [z.ZodEnum<{
|
|
128
|
-
en: "en";
|
|
129
|
-
}>, z.ZodString]>>>>;
|
|
130
|
-
diarize: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>>;
|
|
131
|
-
chunkLevel: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
132
|
-
segment: "segment";
|
|
133
|
-
word: "word";
|
|
134
|
-
}>>>>;
|
|
135
|
-
version: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodEnum<{
|
|
136
|
-
3: "3";
|
|
137
|
-
}>>>>;
|
|
138
|
-
batchSize: z.ZodDefault<z.ZodOptional<z.ZodNullable<z.ZodNumber>>>;
|
|
139
|
-
numSpeakers: z.ZodOptional<z.ZodNullable<z.ZodNullable<z.ZodNumber>>>;
|
|
140
|
-
}, z.core.$strip>;
|
|
141
|
-
type FalTranscriptionModelOptions = z.infer<typeof falTranscriptionModelOptionsSchema>;
|
|
142
|
-
|
|
143
|
-
type FalVideoModelOptions = {
|
|
144
|
-
loop?: boolean | null;
|
|
145
|
-
motionStrength?: number | null;
|
|
146
|
-
pollIntervalMs?: number | null;
|
|
147
|
-
pollTimeoutMs?: number | null;
|
|
148
|
-
resolution?: string | null;
|
|
149
|
-
negativePrompt?: string | null;
|
|
150
|
-
promptOptimizer?: boolean | null;
|
|
151
|
-
[key: string]: unknown;
|
|
152
|
-
};
|
|
153
|
-
|
|
154
|
-
declare const VERSION: string;
|
|
155
|
-
|
|
156
|
-
export { type FalImageModelOptions, type FalImageModelOptions as FalImageProviderOptions, type FalProvider, type FalProviderSettings, type FalSpeechModelOptions, type FalTranscriptionModelOptions, type FalVideoModelId, type FalVideoModelOptions, type FalVideoModelOptions as FalVideoProviderOptions, VERSION, createFal, fal };
|