@fungi.computer/darkroom 0.6.0 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +178 -0
- package/dist/app-media-contracts.d.ts +107 -12
- package/dist/audio-providers/elevenlabs.d.ts +40 -0
- package/dist/audio-providers/elevenlabs.js +69 -0
- package/dist/audio-reference-types.d.ts +28 -0
- package/dist/audio-reference-types.js +16 -0
- package/dist/audio-references.d.ts +14 -0
- package/dist/audio-references.js +69 -0
- package/dist/browser-failure.d.ts +2 -0
- package/dist/browser-failure.js +2 -0
- package/dist/cloudflare/provider.d.ts +6 -4
- package/dist/cloudflare/provider.js +39 -21
- package/dist/cloudflare/reference-images.d.ts +6 -0
- package/dist/cloudflare/reference-images.js +25 -7
- package/dist/cost-estimate.js +2 -2
- package/dist/daily-media-meter.d.ts +55 -0
- package/dist/daily-media-meter.js +81 -0
- package/dist/execution-error.d.ts +1 -1
- package/dist/gateway-models.d.ts +19 -9
- package/dist/gateway-models.js +57 -19
- package/dist/gateway-wire.d.ts +1 -0
- package/dist/gateway-wire.js +2 -0
- package/dist/index.d.ts +116 -24
- package/dist/index.js +147 -26
- package/dist/media-binding.d.ts +60 -7
- package/dist/media-binding.js +43 -21
- package/dist/media-generation.js +20 -7
- package/dist/media-operation-contract.d.ts +9 -3
- package/dist/media-operation-contract.js +6 -4
- package/dist/media-operation-do.d.ts +13 -2
- package/dist/media-operation-do.js +26 -1
- package/dist/media-operation-owner.d.ts +10 -2
- package/dist/media-operation-owner.js +56 -11
- package/dist/media-operation.js +5 -3
- package/dist/media-quote.d.ts +14 -0
- package/dist/media-quote.js +17 -0
- package/dist/model-catalog.d.ts +602 -6
- package/dist/model-catalog.js +309 -9
- package/dist/reference-image-size.d.ts +4 -3
- package/dist/reference-image-size.js +9 -9
- package/dist/server.d.ts +31 -8
- package/dist/server.js +51 -8
- package/dist/video-providers/reference-encoding.d.ts +7 -2
- package/dist/video-providers/reference-encoding.js +14 -3
- package/dist/video-providers/types.d.ts +2 -2
- package/dist/video-providers/unified.d.ts +1 -0
- package/dist/video-providers/unified.js +4 -2
- package/docs/api/app-media-contracts.md +50 -10
- package/docs/api/browser.md +4 -2
- package/docs/api/cloudflare.md +56 -3
- package/docs/api/index.md +1042 -121
- package/docs/api/server.md +306 -50
- package/package.json +3 -2
package/docs/api/index.md
CHANGED
|
@@ -23,14 +23,15 @@ Invalid generation settings or unsupported model parameters.
|
|
|
23
23
|
##### Constructor
|
|
24
24
|
|
|
25
25
|
```ts
|
|
26
|
-
new MediaSettingsError(message): MediaSettingsError;
|
|
26
|
+
new MediaSettingsError(message, options?): MediaSettingsError;
|
|
27
27
|
```
|
|
28
28
|
|
|
29
29
|
###### Parameters
|
|
30
30
|
|
|
31
|
-
| Parameter
|
|
32
|
-
|
|
|
33
|
-
| `message`
|
|
31
|
+
| Parameter | Type |
|
|
32
|
+
| ---------- | -------------- |
|
|
33
|
+
| `message` | `string` |
|
|
34
|
+
| `options?` | `ErrorOptions` |
|
|
34
35
|
|
|
35
36
|
###### Returns
|
|
36
37
|
|
|
@@ -44,6 +45,36 @@ Error.constructor;
|
|
|
44
45
|
|
|
45
46
|
## Type Aliases
|
|
46
47
|
|
|
48
|
+
### MediaAudioReferenceBytes
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
type MediaAudioReferenceBytes = Readonly<{
|
|
52
|
+
bytes: Uint8Array;
|
|
53
|
+
mimeType: AudioReferenceMimeType;
|
|
54
|
+
durationSeconds: number;
|
|
55
|
+
filename?: string;
|
|
56
|
+
}>;
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
One reference clip with the facts the provider request and the 30-second budget
|
|
60
|
+
need.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
64
|
+
### AudioReferenceMimeType
|
|
65
|
+
|
|
66
|
+
```ts
|
|
67
|
+
type AudioReferenceMimeType =
|
|
68
|
+
"audio/mpeg" | "audio/mp4" | "audio/wav" | "audio/ogg";
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
Containers a clip may arrive in: `mp3`, `m4a`, `wav`, `ogg` and `opus` files.
|
|
72
|
+
Seedance 2.5 states only that clips are "base64 data:audio/... URIs" and does
|
|
73
|
+
not list formats, so Darkroom admits what the gallery plays.
|
|
74
|
+
https://developers.cloudflare.com/ai/models/bytedance/seedance-2.5/schema-input.json
|
|
75
|
+
|
|
76
|
+
---
|
|
77
|
+
|
|
47
78
|
### ImageParams
|
|
48
79
|
|
|
49
80
|
```ts
|
|
@@ -153,10 +184,11 @@ MIME type corresponding to a supported image encoding.
|
|
|
153
184
|
### MediaOutputFormat
|
|
154
185
|
|
|
155
186
|
```ts
|
|
156
|
-
type MediaOutputFormat = ImageFormat | "mp4";
|
|
187
|
+
type MediaOutputFormat = ImageFormat | "mp4" | "mp3";
|
|
157
188
|
```
|
|
158
189
|
|
|
159
|
-
A saved generation: an image,
|
|
190
|
+
A saved generation: an image, an MP4 from a video model, or an MP3 from an audio
|
|
191
|
+
model.
|
|
160
192
|
|
|
161
193
|
---
|
|
162
194
|
|
|
@@ -182,14 +214,16 @@ Decoded reference bytes and the dimensions sent to the provider.
|
|
|
182
214
|
type MediaGenerationSettings = Readonly<{
|
|
183
215
|
model: string;
|
|
184
216
|
prompt: string;
|
|
185
|
-
width
|
|
186
|
-
height
|
|
217
|
+
width?: number;
|
|
218
|
+
height?: number;
|
|
187
219
|
steps?: number;
|
|
188
220
|
durationSeconds?: number;
|
|
221
|
+
voiceId?: string;
|
|
189
222
|
resolution?: MediaVideoResolution;
|
|
190
223
|
aspectRatio?: MediaVideoAspectRatio;
|
|
191
224
|
generateAudio?: boolean;
|
|
192
225
|
references?: readonly MediaReference[];
|
|
226
|
+
audioReferences?: readonly MediaReference[];
|
|
193
227
|
}>;
|
|
194
228
|
```
|
|
195
229
|
|
|
@@ -205,6 +239,7 @@ type MediaProvider = (
|
|
|
205
239
|
references,
|
|
206
240
|
signal?,
|
|
207
241
|
outputFormat?,
|
|
242
|
+
audioReferences?,
|
|
208
243
|
) => Promise<
|
|
209
244
|
Readonly<{
|
|
210
245
|
bytes: Uint8Array;
|
|
@@ -218,12 +253,13 @@ out. Hosts may bind it to Workers AI or their own transport.
|
|
|
218
253
|
|
|
219
254
|
#### Parameters
|
|
220
255
|
|
|
221
|
-
| Parameter
|
|
222
|
-
|
|
|
223
|
-
| `settings`
|
|
224
|
-
| `references`
|
|
225
|
-
| `signal?`
|
|
226
|
-
| `outputFormat?`
|
|
256
|
+
| Parameter | Type |
|
|
257
|
+
| ------------------ | ------------------------------------------------------------------ |
|
|
258
|
+
| `settings` | [`MediaGenerationSettings`](#mediagenerationsettings) |
|
|
259
|
+
| `references` | readonly [`MediaReferenceBytes`](#mediareferencebytes)[] |
|
|
260
|
+
| `signal?` | `AbortSignal` |
|
|
261
|
+
| `outputFormat?` | `"png"` \| `"jpeg"` \| `"webp"` |
|
|
262
|
+
| `audioReferences?` | readonly [`MediaAudioReferenceBytes`](#mediaaudioreferencebytes)[] |
|
|
227
263
|
|
|
228
264
|
#### Returns
|
|
229
265
|
|
|
@@ -319,6 +355,18 @@ One path-only video reference.
|
|
|
319
355
|
|
|
320
356
|
---
|
|
321
357
|
|
|
358
|
+
### MediaAudioReferenceSelection
|
|
359
|
+
|
|
360
|
+
```ts
|
|
361
|
+
type MediaAudioReferenceSelection = z.output<
|
|
362
|
+
typeof mediaAudioReferenceSelectionSchema
|
|
363
|
+
>;
|
|
364
|
+
```
|
|
365
|
+
|
|
366
|
+
One path-only audio reference.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
322
370
|
### MediaVideoSelectionInput
|
|
323
371
|
|
|
324
372
|
```ts
|
|
@@ -333,7 +381,7 @@ Caller video selection before defaults and model-specific refinements.
|
|
|
333
381
|
|
|
334
382
|
```ts
|
|
335
383
|
type MediaVideoSelection = Readonly<{
|
|
336
|
-
model:
|
|
384
|
+
model: string;
|
|
337
385
|
prompt: string;
|
|
338
386
|
width: number;
|
|
339
387
|
height: number;
|
|
@@ -342,6 +390,7 @@ type MediaVideoSelection = Readonly<{
|
|
|
342
390
|
durationSeconds: number;
|
|
343
391
|
generateAudio?: boolean;
|
|
344
392
|
references?: readonly Readonly<MediaVideoReference>[];
|
|
393
|
+
audioReferences?: readonly Readonly<MediaAudioReferenceSelection>[];
|
|
345
394
|
}>;
|
|
346
395
|
```
|
|
347
396
|
|
|
@@ -350,6 +399,16 @@ hydration.
|
|
|
350
399
|
|
|
351
400
|
---
|
|
352
401
|
|
|
402
|
+
### MediaAudioSelectionInput
|
|
403
|
+
|
|
404
|
+
```ts
|
|
405
|
+
type MediaAudioSelectionInput = z.input<typeof mediaAudioSelectionSchema>;
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
Caller audio selection before defaults and model-specific refinements.
|
|
409
|
+
|
|
410
|
+
---
|
|
411
|
+
|
|
353
412
|
### MediaReferenceReader
|
|
354
413
|
|
|
355
414
|
```ts
|
|
@@ -565,6 +624,36 @@ Immutable video capability and price metadata.
|
|
|
565
624
|
|
|
566
625
|
---
|
|
567
626
|
|
|
627
|
+
### MediaAudioModelId
|
|
628
|
+
|
|
629
|
+
```ts
|
|
630
|
+
type MediaAudioModelId = z.output<typeof mediaAudioModelIdSchema>;
|
|
631
|
+
```
|
|
632
|
+
|
|
633
|
+
Verified audio model identifier.
|
|
634
|
+
|
|
635
|
+
---
|
|
636
|
+
|
|
637
|
+
### MediaAudioVoice
|
|
638
|
+
|
|
639
|
+
```ts
|
|
640
|
+
type MediaAudioVoice = z.output<typeof mediaAudioVoiceSchema>;
|
|
641
|
+
```
|
|
642
|
+
|
|
643
|
+
One premade speech voice.
|
|
644
|
+
|
|
645
|
+
---
|
|
646
|
+
|
|
647
|
+
### MediaAudioModel
|
|
648
|
+
|
|
649
|
+
```ts
|
|
650
|
+
type MediaAudioModel = z.output<typeof mediaAudioSchema>;
|
|
651
|
+
```
|
|
652
|
+
|
|
653
|
+
Immutable audio capability and price metadata.
|
|
654
|
+
|
|
655
|
+
---
|
|
656
|
+
|
|
568
657
|
### MediaModelInput
|
|
569
658
|
|
|
570
659
|
```ts
|
|
@@ -583,8 +672,66 @@ type MediaModel = z.output<typeof mediaModelSchema>;
|
|
|
583
672
|
|
|
584
673
|
One immutable provider catalog entry.
|
|
585
674
|
|
|
675
|
+
---
|
|
676
|
+
|
|
677
|
+
### MediaCatalogueModel
|
|
678
|
+
|
|
679
|
+
```ts
|
|
680
|
+
type MediaCatalogueModel = z.output<typeof mediaCatalogueModelSchema>;
|
|
681
|
+
```
|
|
682
|
+
|
|
683
|
+
One provider's catalogue entry.
|
|
684
|
+
|
|
685
|
+
---
|
|
686
|
+
|
|
687
|
+
### MediaCatalogue
|
|
688
|
+
|
|
689
|
+
```ts
|
|
690
|
+
type MediaCatalogue = readonly MediaCatalogueModel[];
|
|
691
|
+
```
|
|
692
|
+
|
|
693
|
+
One provider's model list: the typed bounds every request is checked against.
|
|
694
|
+
|
|
695
|
+
---
|
|
696
|
+
|
|
697
|
+
### MediaPictureModel
|
|
698
|
+
|
|
699
|
+
```ts
|
|
700
|
+
type MediaPictureModel = Omit<MediaModel, "kind" | "audio"> & object;
|
|
701
|
+
```
|
|
702
|
+
|
|
703
|
+
A catalog entry that is a picture or video model.
|
|
704
|
+
|
|
705
|
+
#### Type Declaration
|
|
706
|
+
|
|
707
|
+
| Name | Type | Description |
|
|
708
|
+
| ------- | ---------------------- | --------------------------------------------- |
|
|
709
|
+
| `kind` | `"image"` \| `"video"` | Still-image or video generation; never audio. |
|
|
710
|
+
| `audio` | `null` | Always null for a picture or video model. |
|
|
711
|
+
|
|
586
712
|
## Variables
|
|
587
713
|
|
|
714
|
+
### MAX\_AUDIO\_REFERENCE\_BYTES
|
|
715
|
+
|
|
716
|
+
```ts
|
|
717
|
+
const MAX_AUDIO_REFERENCE_BYTES: number;
|
|
718
|
+
```
|
|
719
|
+
|
|
720
|
+
Decoded bytes of one reference clip: well past 30 seconds of any admitted
|
|
721
|
+
container.
|
|
722
|
+
|
|
723
|
+
---
|
|
724
|
+
|
|
725
|
+
### MAX\_AUDIO\_REFERENCE\_BODY\_BYTES
|
|
726
|
+
|
|
727
|
+
```ts
|
|
728
|
+
const MAX_AUDIO_REFERENCE_BODY_BYTES: number;
|
|
729
|
+
```
|
|
730
|
+
|
|
731
|
+
Decoded bytes across every clip of one request; base64 adds a third.
|
|
732
|
+
|
|
733
|
+
---
|
|
734
|
+
|
|
588
735
|
### mediaFailureStageSchema
|
|
589
736
|
|
|
590
737
|
```ts
|
|
@@ -670,6 +817,17 @@ Maximum retained still-image output bytes.
|
|
|
670
817
|
|
|
671
818
|
---
|
|
672
819
|
|
|
820
|
+
### MAX\_AUDIO\_REFERENCE\_COUNT
|
|
821
|
+
|
|
822
|
+
```ts
|
|
823
|
+
const MAX_AUDIO_REFERENCE_COUNT: 10 = 10;
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
Schema ceiling for audio reference lists; each model's own `audioReferences.max`
|
|
827
|
+
is enforced after parsing.
|
|
828
|
+
|
|
829
|
+
---
|
|
830
|
+
|
|
673
831
|
### mediaGenerationSettingsSchema
|
|
674
832
|
|
|
675
833
|
```ts
|
|
@@ -677,10 +835,11 @@ const mediaGenerationSettingsSchema: ZodObject<
|
|
|
677
835
|
{
|
|
678
836
|
model: ZodString;
|
|
679
837
|
prompt: ZodString;
|
|
680
|
-
width: ZodNumber
|
|
681
|
-
height: ZodNumber
|
|
838
|
+
width: ZodOptional<ZodNumber>;
|
|
839
|
+
height: ZodOptional<ZodNumber>;
|
|
682
840
|
steps: ZodOptional<ZodNumber>;
|
|
683
841
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
842
|
+
voiceId: ZodOptional<ZodString>;
|
|
684
843
|
resolution: ZodOptional<
|
|
685
844
|
ZodEnum<{
|
|
686
845
|
p480: "480p";
|
|
@@ -720,6 +879,17 @@ const mediaGenerationSettingsSchema: ZodObject<
|
|
|
720
879
|
>
|
|
721
880
|
>
|
|
722
881
|
>;
|
|
882
|
+
audioReferences: ZodOptional<
|
|
883
|
+
ZodArray<
|
|
884
|
+
ZodObject<
|
|
885
|
+
{
|
|
886
|
+
computerId: ZodString;
|
|
887
|
+
path: ZodString;
|
|
888
|
+
},
|
|
889
|
+
$strict
|
|
890
|
+
>
|
|
891
|
+
>
|
|
892
|
+
>;
|
|
723
893
|
},
|
|
724
894
|
$strict
|
|
725
895
|
>;
|
|
@@ -736,10 +906,11 @@ const mediaGenerationSelectionSchema: ZodObject<
|
|
|
736
906
|
{
|
|
737
907
|
model: ZodString;
|
|
738
908
|
prompt: ZodString;
|
|
739
|
-
width: ZodNumber
|
|
740
|
-
height: ZodNumber
|
|
909
|
+
width: ZodOptional<ZodNumber>;
|
|
910
|
+
height: ZodOptional<ZodNumber>;
|
|
741
911
|
steps: ZodOptional<ZodNumber>;
|
|
742
912
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
913
|
+
voiceId: ZodOptional<ZodString>;
|
|
743
914
|
resolution: ZodOptional<
|
|
744
915
|
ZodEnum<{
|
|
745
916
|
p480: "480p";
|
|
@@ -779,6 +950,17 @@ const mediaGenerationSelectionSchema: ZodObject<
|
|
|
779
950
|
>
|
|
780
951
|
>
|
|
781
952
|
>;
|
|
953
|
+
audioReferences: ZodOptional<
|
|
954
|
+
ZodArray<
|
|
955
|
+
ZodObject<
|
|
956
|
+
{
|
|
957
|
+
computerId: ZodOptional<ZodString>;
|
|
958
|
+
path: ZodString;
|
|
959
|
+
},
|
|
960
|
+
$strict
|
|
961
|
+
>
|
|
962
|
+
>
|
|
963
|
+
>;
|
|
782
964
|
},
|
|
783
965
|
$strict
|
|
784
966
|
>;
|
|
@@ -810,6 +992,23 @@ Path-only video reference; the host supplies authority and reads its bytes.
|
|
|
810
992
|
|
|
811
993
|
---
|
|
812
994
|
|
|
995
|
+
### mediaAudioReferenceSelectionSchema
|
|
996
|
+
|
|
997
|
+
```ts
|
|
998
|
+
const mediaAudioReferenceSelectionSchema: ZodLazy<
|
|
999
|
+
ZodObject<
|
|
1000
|
+
{
|
|
1001
|
+
path: ZodString;
|
|
1002
|
+
},
|
|
1003
|
+
$strict
|
|
1004
|
+
>
|
|
1005
|
+
>;
|
|
1006
|
+
```
|
|
1007
|
+
|
|
1008
|
+
Path-only audio reference; the host supplies authority and reads its bytes.
|
|
1009
|
+
|
|
1010
|
+
---
|
|
1011
|
+
|
|
813
1012
|
### mediaVideoSelectionSchema
|
|
814
1013
|
|
|
815
1014
|
```ts
|
|
@@ -865,6 +1064,18 @@ const mediaVideoSelectionSchema: ZodLazy<
|
|
|
865
1064
|
>
|
|
866
1065
|
>
|
|
867
1066
|
>;
|
|
1067
|
+
audioReferences: ZodOptional<
|
|
1068
|
+
ZodArray<
|
|
1069
|
+
ZodLazy<
|
|
1070
|
+
ZodObject<
|
|
1071
|
+
{
|
|
1072
|
+
path: ZodString;
|
|
1073
|
+
},
|
|
1074
|
+
$strict
|
|
1075
|
+
>
|
|
1076
|
+
>
|
|
1077
|
+
>
|
|
1078
|
+
>;
|
|
868
1079
|
},
|
|
869
1080
|
$strict
|
|
870
1081
|
>
|
|
@@ -876,6 +1087,31 @@ validateMediaVideoSelection.
|
|
|
876
1087
|
|
|
877
1088
|
---
|
|
878
1089
|
|
|
1090
|
+
### mediaAudioSelectionSchema
|
|
1091
|
+
|
|
1092
|
+
```ts
|
|
1093
|
+
const mediaAudioSelectionSchema: ZodLazy<
|
|
1094
|
+
ZodObject<
|
|
1095
|
+
{
|
|
1096
|
+
model: ZodEnum<{
|
|
1097
|
+
multilingual: "elevenlabs/eleven-multilingual-v2";
|
|
1098
|
+
v3: "elevenlabs/eleven-v3";
|
|
1099
|
+
music: "elevenlabs/music-v2";
|
|
1100
|
+
}>;
|
|
1101
|
+
prompt: ZodString;
|
|
1102
|
+
voiceId: ZodOptional<ZodString>;
|
|
1103
|
+
durationSeconds: ZodOptional<ZodNumber>;
|
|
1104
|
+
},
|
|
1105
|
+
$strict
|
|
1106
|
+
>
|
|
1107
|
+
>;
|
|
1108
|
+
```
|
|
1109
|
+
|
|
1110
|
+
Neutral audio selection: speech takes a voice, music a length; model-specific
|
|
1111
|
+
limits are checked by validateMediaGenerationSettings.
|
|
1112
|
+
|
|
1113
|
+
---
|
|
1114
|
+
|
|
879
1115
|
### mediaProviderWireSchema
|
|
880
1116
|
|
|
881
1117
|
```ts
|
|
@@ -963,7 +1199,8 @@ const mediaModelInputSchema: ZodLazy<
|
|
|
963
1199
|
>;
|
|
964
1200
|
```
|
|
965
1201
|
|
|
966
|
-
Media's provider catalog: Workers AI images plus gateway image and
|
|
1202
|
+
Media's provider catalog: Workers AI images plus gateway image, video and audio
|
|
1203
|
+
models.
|
|
967
1204
|
|
|
968
1205
|
---
|
|
969
1206
|
|
|
@@ -1130,6 +1367,10 @@ const mediaVideoSchema: ZodLazy<ZodReadonly<ZodObject<{
|
|
|
1130
1367
|
p1080: "1080p";
|
|
1131
1368
|
p4k: "4k";
|
|
1132
1369
|
}>>>;
|
|
1370
|
+
audioReferences: ZodNullable<ZodReadonly<ZodObject<{
|
|
1371
|
+
max: ZodNumber;
|
|
1372
|
+
totalSeconds: ZodNumber;
|
|
1373
|
+
}, $strict>>>;
|
|
1133
1374
|
prices: ZodReadonly<ZodArray<ZodReadonly<ZodObject<{
|
|
1134
1375
|
resolution: ZodEnum<{
|
|
1135
1376
|
p480: ...;
|
|
@@ -1148,6 +1389,107 @@ Verified video parameters and provider costs, checked 2026-10-11.
|
|
|
1148
1389
|
|
|
1149
1390
|
---
|
|
1150
1391
|
|
|
1392
|
+
### mediaAudioModelIdSchema
|
|
1393
|
+
|
|
1394
|
+
```ts
|
|
1395
|
+
const mediaAudioModelIdSchema: ZodEnum<{
|
|
1396
|
+
multilingual: "elevenlabs/eleven-multilingual-v2";
|
|
1397
|
+
v3: "elevenlabs/eleven-v3";
|
|
1398
|
+
music: "elevenlabs/music-v2";
|
|
1399
|
+
}>;
|
|
1400
|
+
```
|
|
1401
|
+
|
|
1402
|
+
Verified ElevenLabs model identifiers on Cloudflare's Unified Billing, from the
|
|
1403
|
+
model pages under https://developers.cloudflare.com/ai/models/elevenlabs/
|
|
1404
|
+
(checked 2026-11-13). Cloudflare offers no sound-effects model. Eleven Flash
|
|
1405
|
+
v2.5 and Turbo v2.5 are listed there but a live Unified Billing call to Flash
|
|
1406
|
+
answered 403 code 2047 ("not available via unified billing. Please use BYOK"),
|
|
1407
|
+
so they are not offered. Multilingual v2 is the default voice model.
|
|
1408
|
+
|
|
1409
|
+
---
|
|
1410
|
+
|
|
1411
|
+
### mediaAudioVoiceSchema
|
|
1412
|
+
|
|
1413
|
+
```ts
|
|
1414
|
+
const mediaAudioVoiceSchema: ZodLazy<
|
|
1415
|
+
ZodReadonly<
|
|
1416
|
+
ZodObject<
|
|
1417
|
+
{
|
|
1418
|
+
id: ZodString;
|
|
1419
|
+
label: ZodString;
|
|
1420
|
+
},
|
|
1421
|
+
$strict
|
|
1422
|
+
>
|
|
1423
|
+
>
|
|
1424
|
+
>;
|
|
1425
|
+
```
|
|
1426
|
+
|
|
1427
|
+
One premade voice a speech model may speak with.
|
|
1428
|
+
|
|
1429
|
+
---
|
|
1430
|
+
|
|
1431
|
+
### mediaAudioSchema
|
|
1432
|
+
|
|
1433
|
+
```ts
|
|
1434
|
+
const mediaAudioSchema: ZodLazy<
|
|
1435
|
+
ZodReadonly<
|
|
1436
|
+
ZodObject<
|
|
1437
|
+
{
|
|
1438
|
+
provider: ZodLiteral<"elevenlabs">;
|
|
1439
|
+
mode: ZodEnum<{
|
|
1440
|
+
speech: "speech";
|
|
1441
|
+
music: "music";
|
|
1442
|
+
}>;
|
|
1443
|
+
voices: ZodReadonly<
|
|
1444
|
+
ZodArray<
|
|
1445
|
+
ZodLazy<
|
|
1446
|
+
ZodReadonly<
|
|
1447
|
+
ZodObject<
|
|
1448
|
+
{
|
|
1449
|
+
id: ZodString;
|
|
1450
|
+
label: ZodString;
|
|
1451
|
+
},
|
|
1452
|
+
$strict
|
|
1453
|
+
>
|
|
1454
|
+
>
|
|
1455
|
+
>
|
|
1456
|
+
>
|
|
1457
|
+
>;
|
|
1458
|
+
defaultVoiceId: ZodNullable<ZodString>;
|
|
1459
|
+
seconds: ZodNullable<
|
|
1460
|
+
ZodReadonly<
|
|
1461
|
+
ZodObject<
|
|
1462
|
+
{
|
|
1463
|
+
min: ZodNumber;
|
|
1464
|
+
max: ZodNumber;
|
|
1465
|
+
default: ZodNumber;
|
|
1466
|
+
},
|
|
1467
|
+
$strict
|
|
1468
|
+
>
|
|
1469
|
+
>
|
|
1470
|
+
>;
|
|
1471
|
+
milliunitsPerUnit: ZodNumber;
|
|
1472
|
+
},
|
|
1473
|
+
$strict
|
|
1474
|
+
>
|
|
1475
|
+
>
|
|
1476
|
+
>;
|
|
1477
|
+
```
|
|
1478
|
+
|
|
1479
|
+
Verified audio parameters and provider cost, checked 2026-11-13.
|
|
1480
|
+
|
|
1481
|
+
---
|
|
1482
|
+
|
|
1483
|
+
### AUDIO\_CHARACTER\_BLOCK
|
|
1484
|
+
|
|
1485
|
+
```ts
|
|
1486
|
+
const AUDIO_CHARACTER_BLOCK: 100 = 100;
|
|
1487
|
+
```
|
|
1488
|
+
|
|
1489
|
+
Characters one speech billing block covers.
|
|
1490
|
+
|
|
1491
|
+
---
|
|
1492
|
+
|
|
1151
1493
|
### MAX\_MEDIA\_PROMPT\_LENGTH
|
|
1152
1494
|
|
|
1153
1495
|
```ts
|
|
@@ -1168,6 +1510,7 @@ const mediaModelSchema: ZodReadonly<ZodObject<{
|
|
|
1168
1510
|
kind: ZodEnum<{
|
|
1169
1511
|
image: "image";
|
|
1170
1512
|
video: "video";
|
|
1513
|
+
audio: "audio";
|
|
1171
1514
|
}>;
|
|
1172
1515
|
tier: ZodEnum<{
|
|
1173
1516
|
draft: "draft";
|
|
@@ -1242,8 +1585,20 @@ const mediaModelSchema: ZodReadonly<ZodObject<{
|
|
|
1242
1585
|
referenceRoles: ZodReadonly<ZodArray<ZodEnum<...>>>;
|
|
1243
1586
|
maxReferenceImages: ZodNumber;
|
|
1244
1587
|
referenceResolutions: ZodReadonly<ZodArray<ZodEnum<...>>>;
|
|
1588
|
+
audioReferences: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1245
1589
|
prices: ZodReadonly<ZodArray<ZodReadonly<...>>>;
|
|
1246
1590
|
}, $strict>>>>;
|
|
1591
|
+
audio: ZodNullable<ZodLazy<ZodReadonly<ZodObject<{
|
|
1592
|
+
provider: ZodLiteral<"elevenlabs">;
|
|
1593
|
+
mode: ZodEnum<{
|
|
1594
|
+
speech: "speech";
|
|
1595
|
+
music: "music";
|
|
1596
|
+
}>;
|
|
1597
|
+
voices: ZodReadonly<ZodArray<ZodLazy<...>>>;
|
|
1598
|
+
defaultVoiceId: ZodNullable<ZodString>;
|
|
1599
|
+
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1600
|
+
milliunitsPerUnit: ZodNumber;
|
|
1601
|
+
}, $strict>>>>;
|
|
1247
1602
|
}, $strict>>;
|
|
1248
1603
|
```
|
|
1249
1604
|
|
|
@@ -1257,42 +1612,337 @@ Public wire grammar for a catalog entry returned by the Media owner.
|
|
|
1257
1612
|
const mediaModels: readonly MediaModel[] = models;
|
|
1258
1613
|
```
|
|
1259
1614
|
|
|
1260
|
-
The immutable image and
|
|
1615
|
+
The Fungi gateway provider's own immutable image, video and audio model catalog.
|
|
1261
1616
|
|
|
1262
1617
|
---
|
|
1263
1618
|
|
|
1264
|
-
###
|
|
1265
|
-
|
|
1266
|
-
```ts
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1619
|
+
### mediaCatalogueModelSchema
|
|
1620
|
+
|
|
1621
|
+
```ts
|
|
1622
|
+
const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
1623
|
+
id: ZodString;
|
|
1624
|
+
label: ZodString;
|
|
1625
|
+
kind: ZodEnum<{
|
|
1626
|
+
image: "image";
|
|
1627
|
+
video: "video";
|
|
1628
|
+
audio: "audio";
|
|
1629
|
+
}>;
|
|
1630
|
+
tier: ZodEnum<{
|
|
1631
|
+
draft: "draft";
|
|
1632
|
+
balanced: "balanced";
|
|
1633
|
+
premium: "premium";
|
|
1634
|
+
max: "max";
|
|
1635
|
+
}>;
|
|
1636
|
+
outputFormats: ZodReadonly<ZodArray<ZodEnum<{
|
|
1637
|
+
png: "png";
|
|
1638
|
+
jpeg: "jpeg";
|
|
1639
|
+
webp: "webp";
|
|
1640
|
+
}>>>;
|
|
1641
|
+
maxPromptLength: ZodNumber;
|
|
1642
|
+
input: ZodLazy<ZodReadonly<ZodObject<{
|
|
1643
|
+
transport: ZodEnum<{
|
|
1644
|
+
json: "json";
|
|
1645
|
+
multipart: "multipart";
|
|
1646
|
+
}>;
|
|
1647
|
+
dimensions: ZodEnum<{
|
|
1648
|
+
none: "none";
|
|
1649
|
+
own: "own";
|
|
1650
|
+
}>;
|
|
1651
|
+
maxDimension: ZodNullable<ZodNumber>;
|
|
1652
|
+
maxDimensionDocumented: ZodBoolean;
|
|
1653
|
+
defaultWidth: ZodNumber;
|
|
1654
|
+
defaultHeight: ZodNumber;
|
|
1655
|
+
steps: ZodEnum<{
|
|
1656
|
+
steps: "steps";
|
|
1657
|
+
num_steps: "num_steps";
|
|
1658
|
+
fixed: "fixed";
|
|
1659
|
+
}>;
|
|
1660
|
+
maxSteps: ZodNullable<ZodNumber>;
|
|
1661
|
+
defaultSteps: ZodNullable<ZodNumber>;
|
|
1662
|
+
referenceField: ZodNullable<ZodString>;
|
|
1663
|
+
maxReferences: ZodNumber;
|
|
1664
|
+
referenceDimension: ZodNullable<ZodNumber>;
|
|
1665
|
+
referenceFormat: ZodEnum<{
|
|
1666
|
+
png: "png";
|
|
1667
|
+
webp: "webp";
|
|
1668
|
+
}>;
|
|
1669
|
+
}, $strict>>>;
|
|
1670
|
+
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1671
|
+
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1672
|
+
provider: ZodLiteral<"elevenlabs">;
|
|
1673
|
+
mode: ZodEnum<{
|
|
1674
|
+
speech: "speech";
|
|
1675
|
+
music: "music";
|
|
1676
|
+
}>;
|
|
1677
|
+
voices: ZodReadonly<ZodArray<ZodLazy<...>>>;
|
|
1678
|
+
defaultVoiceId: ZodNullable<ZodString>;
|
|
1679
|
+
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1680
|
+
milliunitsPerUnit: ZodNumber;
|
|
1681
|
+
}, $strict>>>>;
|
|
1682
|
+
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1683
|
+
minSeconds: ZodNumber;
|
|
1684
|
+
maxSeconds: ZodNumber;
|
|
1685
|
+
defaultSeconds: ZodNumber;
|
|
1686
|
+
durations: ZodReadonly<ZodArray<ZodNumber>>;
|
|
1687
|
+
formats: ZodReadonly<ZodArray<ZodLazy<ZodReadonly<...>>>>;
|
|
1688
|
+
defaultResolution: ZodEnum<{
|
|
1689
|
+
p480: "480p";
|
|
1690
|
+
p720: "720p";
|
|
1691
|
+
p768: "768p";
|
|
1692
|
+
p1080: "1080p";
|
|
1693
|
+
p4k: "4k";
|
|
1694
|
+
}>;
|
|
1695
|
+
defaultAspectRatio: ZodEnum<{
|
|
1696
|
+
wide: "16:9";
|
|
1697
|
+
landscape: "4:3";
|
|
1698
|
+
square: "1:1";
|
|
1699
|
+
portrait: "3:4";
|
|
1700
|
+
tall: "9:16";
|
|
1701
|
+
ultrawide: "21:9";
|
|
1702
|
+
ultratall: "9:21";
|
|
1703
|
+
}>;
|
|
1704
|
+
supportsAudio: ZodBoolean;
|
|
1705
|
+
defaultGenerateAudio: ZodNullable<ZodBoolean>;
|
|
1706
|
+
referenceRoles: ZodReadonly<ZodArray<ZodEnum<{
|
|
1707
|
+
first: ...;
|
|
1708
|
+
last: ...;
|
|
1709
|
+
reference: ...;
|
|
1710
|
+
}>>>;
|
|
1711
|
+
maxReferenceImages: ZodNumber;
|
|
1712
|
+
referenceResolutions: ZodReadonly<ZodArray<ZodEnum<{
|
|
1713
|
+
p480: ...;
|
|
1714
|
+
p720: ...;
|
|
1715
|
+
p768: ...;
|
|
1716
|
+
p1080: ...;
|
|
1717
|
+
p4k: ...;
|
|
1718
|
+
}>>>;
|
|
1719
|
+
prices: ZodReadonly<ZodArray<ZodReadonly<ZodObject<..., ...>>>>;
|
|
1720
|
+
audioReferences: ZodDefault<ZodNullable<ZodReadonly<ZodObject<..., ...>>>>;
|
|
1721
|
+
provider: ZodEnum<{
|
|
1722
|
+
seedance: "seedance";
|
|
1723
|
+
veo: "veo";
|
|
1724
|
+
minimax: "minimax";
|
|
1725
|
+
host: "host";
|
|
1726
|
+
}>;
|
|
1727
|
+
}, $strict>>>;
|
|
1728
|
+
}, $strict>>;
|
|
1729
|
+
```
|
|
1730
|
+
|
|
1731
|
+
One catalogue entry. Same grammar as the gateway's wire entry, except that a
|
|
1732
|
+
video model may name `host` as its provider family: the injected provider owns
|
|
1733
|
+
that model's wire grammar and Darkroom builds no gateway request for it.
|
|
1734
|
+
|
|
1735
|
+
---
|
|
1736
|
+
|
|
1737
|
+
### mediaCatalogueSchema
|
|
1738
|
+
|
|
1739
|
+
```ts
|
|
1740
|
+
const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
1741
|
+
id: ZodString;
|
|
1742
|
+
label: ZodString;
|
|
1743
|
+
kind: ZodEnum<{
|
|
1744
|
+
image: "image";
|
|
1745
|
+
video: "video";
|
|
1746
|
+
audio: "audio";
|
|
1747
|
+
}>;
|
|
1748
|
+
tier: ZodEnum<{
|
|
1749
|
+
draft: "draft";
|
|
1750
|
+
balanced: "balanced";
|
|
1751
|
+
premium: "premium";
|
|
1752
|
+
max: "max";
|
|
1753
|
+
}>;
|
|
1754
|
+
outputFormats: ZodReadonly<ZodArray<ZodEnum<{
|
|
1755
|
+
png: "png";
|
|
1756
|
+
jpeg: "jpeg";
|
|
1757
|
+
webp: "webp";
|
|
1758
|
+
}>>>;
|
|
1759
|
+
maxPromptLength: ZodNumber;
|
|
1760
|
+
input: ZodLazy<ZodReadonly<ZodObject<{
|
|
1761
|
+
transport: ZodEnum<{
|
|
1762
|
+
json: ...;
|
|
1763
|
+
multipart: ...;
|
|
1764
|
+
}>;
|
|
1765
|
+
dimensions: ZodEnum<{
|
|
1766
|
+
none: ...;
|
|
1767
|
+
own: ...;
|
|
1768
|
+
}>;
|
|
1769
|
+
maxDimension: ZodNullable<ZodNumber>;
|
|
1770
|
+
maxDimensionDocumented: ZodBoolean;
|
|
1771
|
+
defaultWidth: ZodNumber;
|
|
1772
|
+
defaultHeight: ZodNumber;
|
|
1773
|
+
steps: ZodEnum<{
|
|
1774
|
+
steps: ...;
|
|
1775
|
+
num_steps: ...;
|
|
1776
|
+
fixed: ...;
|
|
1777
|
+
}>;
|
|
1778
|
+
maxSteps: ZodNullable<ZodNumber>;
|
|
1779
|
+
defaultSteps: ZodNullable<ZodNumber>;
|
|
1780
|
+
referenceField: ZodNullable<ZodString>;
|
|
1781
|
+
maxReferences: ZodNumber;
|
|
1782
|
+
referenceDimension: ZodNullable<ZodNumber>;
|
|
1783
|
+
referenceFormat: ZodEnum<{
|
|
1784
|
+
png: ...;
|
|
1785
|
+
webp: ...;
|
|
1786
|
+
}>;
|
|
1787
|
+
}, $strict>>>;
|
|
1788
|
+
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1789
|
+
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1790
|
+
provider: ZodLiteral<...>;
|
|
1791
|
+
mode: ZodEnum<...>;
|
|
1792
|
+
voices: ZodReadonly<...>;
|
|
1793
|
+
defaultVoiceId: ZodNullable<...>;
|
|
1794
|
+
seconds: ZodNullable<...>;
|
|
1795
|
+
milliunitsPerUnit: ZodNumber;
|
|
1796
|
+
}, $strict>>>>;
|
|
1797
|
+
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1798
|
+
minSeconds: ZodNumber;
|
|
1799
|
+
maxSeconds: ZodNumber;
|
|
1800
|
+
defaultSeconds: ZodNumber;
|
|
1801
|
+
durations: ZodReadonly<ZodArray<...>>;
|
|
1802
|
+
formats: ZodReadonly<ZodArray<...>>;
|
|
1803
|
+
defaultResolution: ZodEnum<{
|
|
1804
|
+
p480: ...;
|
|
1805
|
+
p720: ...;
|
|
1806
|
+
p768: ...;
|
|
1807
|
+
p1080: ...;
|
|
1808
|
+
p4k: ...;
|
|
1809
|
+
}>;
|
|
1810
|
+
defaultAspectRatio: ZodEnum<{
|
|
1811
|
+
wide: ...;
|
|
1812
|
+
landscape: ...;
|
|
1813
|
+
square: ...;
|
|
1814
|
+
portrait: ...;
|
|
1815
|
+
tall: ...;
|
|
1816
|
+
ultrawide: ...;
|
|
1817
|
+
ultratall: ...;
|
|
1818
|
+
}>;
|
|
1819
|
+
supportsAudio: ZodBoolean;
|
|
1820
|
+
defaultGenerateAudio: ZodNullable<ZodBoolean>;
|
|
1821
|
+
referenceRoles: ZodReadonly<ZodArray<...>>;
|
|
1822
|
+
maxReferenceImages: ZodNumber;
|
|
1823
|
+
referenceResolutions: ZodReadonly<ZodArray<...>>;
|
|
1824
|
+
prices: ZodReadonly<ZodArray<...>>;
|
|
1825
|
+
audioReferences: ZodDefault<ZodNullable<...>>;
|
|
1826
|
+
provider: ZodEnum<{
|
|
1827
|
+
seedance: ...;
|
|
1828
|
+
veo: ...;
|
|
1829
|
+
minimax: ...;
|
|
1830
|
+
host: ...;
|
|
1831
|
+
}>;
|
|
1832
|
+
}, $strict>>>;
|
|
1833
|
+
}, $strict>>>, ZodTransform<MediaCatalogue, Readonly<{
|
|
1834
|
+
id: string;
|
|
1835
|
+
label: string;
|
|
1836
|
+
kind: "image" | "video" | "audio";
|
|
1837
|
+
tier: "draft" | "balanced" | "premium" | "max";
|
|
1838
|
+
outputFormats: readonly ("png" | "jpeg" | "webp")[];
|
|
1839
|
+
maxPromptLength: number;
|
|
1840
|
+
input: Readonly<{
|
|
1841
|
+
transport: "json" | "multipart";
|
|
1842
|
+
dimensions: "none" | "own";
|
|
1843
|
+
maxDimension: number | null;
|
|
1844
|
+
maxDimensionDocumented: boolean;
|
|
1845
|
+
defaultWidth: number;
|
|
1846
|
+
defaultHeight: number;
|
|
1847
|
+
steps: "steps" | "num_steps" | "fixed";
|
|
1848
|
+
maxSteps: number | null;
|
|
1849
|
+
defaultSteps: number | null;
|
|
1850
|
+
referenceField: string | null;
|
|
1851
|
+
maxReferences: number;
|
|
1852
|
+
referenceDimension: number | null;
|
|
1853
|
+
referenceFormat: "png" | "webp";
|
|
1854
|
+
}>;
|
|
1855
|
+
sizes: readonly string[] | null;
|
|
1856
|
+
audio: | Readonly<{
|
|
1857
|
+
provider: "elevenlabs";
|
|
1858
|
+
mode: "music" | "speech";
|
|
1859
|
+
voices: readonly Readonly<{
|
|
1860
|
+
id: ...;
|
|
1861
|
+
label: ...;
|
|
1862
|
+
}>[];
|
|
1863
|
+
defaultVoiceId: string | null;
|
|
1864
|
+
seconds: | Readonly<{
|
|
1865
|
+
min: ...;
|
|
1866
|
+
max: ...;
|
|
1867
|
+
default: ...;
|
|
1868
|
+
}>
|
|
1869
|
+
| null;
|
|
1870
|
+
milliunitsPerUnit: number;
|
|
1871
|
+
}>
|
|
1872
|
+
| null;
|
|
1873
|
+
video: | Readonly<{
|
|
1874
|
+
minSeconds: number;
|
|
1875
|
+
maxSeconds: number;
|
|
1876
|
+
defaultSeconds: number;
|
|
1877
|
+
durations: readonly number[];
|
|
1878
|
+
formats: readonly Readonly<{
|
|
1879
|
+
resolution: ...;
|
|
1880
|
+
aspectRatio: ...;
|
|
1881
|
+
width: ...;
|
|
1882
|
+
height: ...;
|
|
1883
|
+
}>[];
|
|
1884
|
+
defaultResolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
1885
|
+
defaultAspectRatio: "16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
|
|
1886
|
+
supportsAudio: boolean;
|
|
1887
|
+
defaultGenerateAudio: boolean | null;
|
|
1888
|
+
referenceRoles: readonly ("first-frame" | "last-frame" | "reference")[];
|
|
1889
|
+
maxReferenceImages: number;
|
|
1890
|
+
referenceResolutions: readonly ("480p" | "720p" | "768p" | "1080p" | "4k")[];
|
|
1891
|
+
prices: readonly Readonly<{
|
|
1892
|
+
resolution: ...;
|
|
1893
|
+
silentMilliunitsPerSecond: ...;
|
|
1894
|
+
audioMilliunitsPerSecond: ...;
|
|
1895
|
+
}>[];
|
|
1896
|
+
audioReferences: | Readonly<{
|
|
1897
|
+
max: ...;
|
|
1898
|
+
totalSeconds: ...;
|
|
1899
|
+
}>
|
|
1900
|
+
| null;
|
|
1901
|
+
provider: "seedance" | "veo" | "minimax" | "host";
|
|
1902
|
+
}>
|
|
1903
|
+
| null;
|
|
1904
|
+
}>[]>>;
|
|
1905
|
+
```
|
|
1906
|
+
|
|
1907
|
+
Decode a host-supplied provider catalogue. Each entry is the same typed wire
|
|
1908
|
+
grammar the built-in catalogue uses; this adds the cross-field facts the
|
|
1909
|
+
validator relies on (unique ids, video metadata iff `kind` is video, defaults
|
|
1910
|
+
inside their own bounds).
|
|
1911
|
+
|
|
1912
|
+
---
|
|
1913
|
+
|
|
1914
|
+
### USD\_PER\_1K\_NEURONS
|
|
1915
|
+
|
|
1916
|
+
```ts
|
|
1917
|
+
const USD_PER_1K_NEURONS: 0.011 = 0.011;
|
|
1918
|
+
```
|
|
1919
|
+
|
|
1920
|
+
Published Workers AI image rate: $0.011 per 1,000 neurons.
|
|
1921
|
+
|
|
1922
|
+
## Functions
|
|
1923
|
+
|
|
1924
|
+
### estimateImageNeurons()
|
|
1925
|
+
|
|
1926
|
+
```ts
|
|
1927
|
+
function estimateImageNeurons(modelId, params): number;
|
|
1928
|
+
```
|
|
1929
|
+
|
|
1930
|
+
Estimate Workers AI neurons from a validated image request.
|
|
1931
|
+
|
|
1932
|
+
#### Parameters
|
|
1933
|
+
|
|
1934
|
+
| Parameter | Type |
|
|
1935
|
+
| --------- | ----------------------------- |
|
|
1936
|
+
| `modelId` | `string` |
|
|
1937
|
+
| `params` | [`ImageParams`](#imageparams) |
|
|
1938
|
+
|
|
1939
|
+
#### Returns
|
|
1940
|
+
|
|
1941
|
+
`number`
|
|
1942
|
+
|
|
1943
|
+
---
|
|
1944
|
+
|
|
1945
|
+
### estimateImageMilliunits()
|
|
1296
1946
|
|
|
1297
1947
|
```ts
|
|
1298
1948
|
function estimateImageMilliunits(modelId, params): number;
|
|
@@ -1313,29 +1963,70 @@ Quote the same estimate in milliunits (1 cent = 1,000 milliunits).
|
|
|
1313
1963
|
|
|
1314
1964
|
---
|
|
1315
1965
|
|
|
1966
|
+
### mediaSettingsInput()
|
|
1967
|
+
|
|
1968
|
+
```ts
|
|
1969
|
+
function mediaSettingsInput(settings): object;
|
|
1970
|
+
```
|
|
1971
|
+
|
|
1972
|
+
Mutable caller input for already-normalized settings, so they can be validated
|
|
1973
|
+
again.
|
|
1974
|
+
|
|
1975
|
+
#### Parameters
|
|
1976
|
+
|
|
1977
|
+
| Parameter | Type |
|
|
1978
|
+
| ---------- | ----------------------------------------------------- |
|
|
1979
|
+
| `settings` | [`MediaGenerationSettings`](#mediagenerationsettings) |
|
|
1980
|
+
|
|
1981
|
+
#### Returns
|
|
1982
|
+
|
|
1983
|
+
| Name | Type | Description |
|
|
1984
|
+
| ------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
1985
|
+
| `model` | `string` | Provider catalog model identifier. |
|
|
1986
|
+
| `prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
1987
|
+
| `width?` | `number` | Requested image width or nominal video selector; absent for audio. |
|
|
1988
|
+
| `height?` | `number` | Requested image height or nominal video selector; absent for audio. |
|
|
1989
|
+
| `steps?` | `number` | Model-specific inference step count. |
|
|
1990
|
+
| `durationSeconds?` | `number` | Requested video or music length in whole seconds. |
|
|
1991
|
+
| `voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
1992
|
+
| `resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
1993
|
+
| `aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Video aspect; must match the nominal width/height selector. |
|
|
1994
|
+
| `generateAudio?` | `boolean` | Video audio selection. |
|
|
1995
|
+
| `references?` | `object`[] | Host-authorized reference images. |
|
|
1996
|
+
| `audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
1997
|
+
|
|
1998
|
+
---
|
|
1999
|
+
|
|
1316
2000
|
### validateMediaGenerationSettings()
|
|
1317
2001
|
|
|
1318
2002
|
```ts
|
|
1319
|
-
function validateMediaGenerationSettings(
|
|
2003
|
+
function validateMediaGenerationSettings(
|
|
2004
|
+
raw,
|
|
2005
|
+
catalogue?,
|
|
2006
|
+
): MediaGenerationSettings;
|
|
1320
2007
|
```
|
|
1321
2008
|
|
|
1322
|
-
Validate caller settings
|
|
2009
|
+
Validate caller settings against `catalogue`, the active provider's model list
|
|
2010
|
+
(the Fungi gateway's by default), and apply that model's defaults.
|
|
1323
2011
|
|
|
1324
2012
|
#### Parameters
|
|
1325
2013
|
|
|
1326
|
-
| Parameter | Type
|
|
1327
|
-
| ---------------------- |
|
|
1328
|
-
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width
|
|
1329
|
-
| `raw.model` | `string`
|
|
1330
|
-
| `raw.prompt` | `string`
|
|
1331
|
-
| `raw.width
|
|
1332
|
-
| `raw.height
|
|
1333
|
-
| `raw.steps?` | `number`
|
|
1334
|
-
| `raw.durationSeconds?` | `number`
|
|
1335
|
-
| `raw.
|
|
1336
|
-
| `raw.
|
|
1337
|
-
| `raw.
|
|
1338
|
-
| `raw.
|
|
2014
|
+
| Parameter | Type | Default value | Description |
|
|
2015
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------- |
|
|
2016
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `voiceId?`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`: `object`[]; `audioReferences?`: `object`[]; \} | `undefined` | - |
|
|
2017
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2018
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2019
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2020
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2021
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2022
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2023
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2024
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2025
|
+
| `raw.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | `...` | Video aspect; must match the nominal width/height selector. |
|
|
2026
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2027
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2028
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
2029
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
1339
2030
|
|
|
1340
2031
|
#### Returns
|
|
1341
2032
|
|
|
@@ -1348,38 +2039,44 @@ Validate caller settings and apply retained model defaults.
|
|
|
1348
2039
|
```ts
|
|
1349
2040
|
function validateMediaGenerationSelection(
|
|
1350
2041
|
raw,
|
|
1351
|
-
|
|
2042
|
+
catalogue?,
|
|
2043
|
+
): Readonly<
|
|
2044
|
+
Omit<MediaGenerationSettings, "references" | "audioReferences"> & object
|
|
2045
|
+
>;
|
|
1352
2046
|
```
|
|
1353
2047
|
|
|
1354
2048
|
Validate selections without granting Computer authority.
|
|
1355
2049
|
|
|
1356
2050
|
#### Parameters
|
|
1357
2051
|
|
|
1358
|
-
| Parameter | Type
|
|
1359
|
-
| ---------------------- |
|
|
1360
|
-
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width
|
|
1361
|
-
| `raw.model` | `string`
|
|
1362
|
-
| `raw.prompt` | `string`
|
|
1363
|
-
| `raw.width
|
|
1364
|
-
| `raw.height
|
|
1365
|
-
| `raw.steps?` | `number`
|
|
1366
|
-
| `raw.durationSeconds?` | `number`
|
|
1367
|
-
| `raw.
|
|
1368
|
-
| `raw.
|
|
1369
|
-
| `raw.
|
|
1370
|
-
| `raw.
|
|
2052
|
+
| Parameter | Type | Default value | Description |
|
|
2053
|
+
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------- |
|
|
2054
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `voiceId?`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`: `object`[]; `audioReferences?`: `object`[]; \} | `undefined` | - |
|
|
2055
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2056
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2057
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2058
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2059
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2060
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2061
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2062
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2063
|
+
| `raw.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | `...` | Video aspect; must match the nominal width/height selector. |
|
|
2064
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2065
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2066
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips. |
|
|
2067
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
1371
2068
|
|
|
1372
2069
|
#### Returns
|
|
1373
2070
|
|
|
1374
2071
|
`Readonly`\<`Omit`\<[`MediaGenerationSettings`](#mediagenerationsettings),
|
|
1375
|
-
`"references"`\> & `object`\>
|
|
2072
|
+
`"references"` \| `"audioReferences"`\> & `object`\>
|
|
1376
2073
|
|
|
1377
2074
|
---
|
|
1378
2075
|
|
|
1379
2076
|
### validateMediaVideoSelection()
|
|
1380
2077
|
|
|
1381
2078
|
```ts
|
|
1382
|
-
function validateMediaVideoSelection(raw): MediaVideoSelection;
|
|
2079
|
+
function validateMediaVideoSelection(raw, catalogue?): MediaVideoSelection;
|
|
1383
2080
|
```
|
|
1384
2081
|
|
|
1385
2082
|
Validate supported model/size/duration/reference combinations before authority
|
|
@@ -1387,16 +2084,18 @@ or billing admission.
|
|
|
1387
2084
|
|
|
1388
2085
|
#### Parameters
|
|
1389
2086
|
|
|
1390
|
-
| Parameter | Type
|
|
1391
|
-
| ---------------------- |
|
|
1392
|
-
| `raw` | \{ `
|
|
1393
|
-
| `raw.
|
|
1394
|
-
| `raw.
|
|
1395
|
-
| `raw.
|
|
1396
|
-
| `raw.
|
|
1397
|
-
| `raw.
|
|
1398
|
-
| `raw.
|
|
1399
|
-
| `raw.
|
|
2087
|
+
| Parameter | Type | Default value | Description |
|
|
2088
|
+
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ----------------------------------------------------------------------------------------------------------------------------------- |
|
|
2089
|
+
| `raw` | \{ `prompt`: `string`; `resolution?`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `durationSeconds?`: `number`; `generateAudio?`: `boolean`; `references?`: `object`[]; `audioReferences?`: `object`[]; `model`: `string`; \} | `undefined` | - |
|
|
2090
|
+
| `raw.prompt` | `string` | `...` | Trimmed prompt; the selected model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2091
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Model-specific resolution, default 720p. |
|
|
2092
|
+
| `raw.aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | `...` | Model-specific aspect, default 16:9. |
|
|
2093
|
+
| `raw.durationSeconds?` | `number` | `...` | Whole seconds; Seedance 2.0 4–12, Seedance 2.5 4–30, Veo exactly 4/6/8, MiniMax H3 Max 5–15. |
|
|
2094
|
+
| `raw.generateAudio?` | `boolean` | `...` | Veo defaults true; Seedance omits the provider option when unset; MiniMax H3 Max has no audio field and refuses an explicit choice. |
|
|
2095
|
+
| `raw.references?` | `object`[] | `...` | Up to four references, with provider-specific roles and mode limits. |
|
|
2096
|
+
| `raw.audioReferences?` | `object`[] | `...` | Reference audio clips, for a model declaring `audioReferences` (Seedance 2.5: 10 clips, 30 seconds). |
|
|
2097
|
+
| `raw.model` | `string` | `...` | - |
|
|
2098
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
1400
2099
|
|
|
1401
2100
|
#### Returns
|
|
1402
2101
|
|
|
@@ -1410,6 +2109,7 @@ or billing admission.
|
|
|
1410
2109
|
function resolveMediaReferences(
|
|
1411
2110
|
settings,
|
|
1412
2111
|
reader,
|
|
2112
|
+
catalogue?,
|
|
1413
2113
|
): Promise<
|
|
1414
2114
|
readonly Readonly<{
|
|
1415
2115
|
bytes: Uint8Array;
|
|
@@ -1425,10 +2125,11 @@ Resolve only provider-accepted references through the caller's reader.
|
|
|
1425
2125
|
|
|
1426
2126
|
#### Parameters
|
|
1427
2127
|
|
|
1428
|
-
| Parameter
|
|
1429
|
-
|
|
|
1430
|
-
| `settings`
|
|
1431
|
-
| `reader`
|
|
2128
|
+
| Parameter | Type | Default value |
|
|
2129
|
+
| ----------- | ----------------------------------------------------- | ------------- |
|
|
2130
|
+
| `settings` | [`MediaGenerationSettings`](#mediagenerationsettings) | `undefined` |
|
|
2131
|
+
| `reader` | [`MediaReferenceReader`](#mediareferencereader) | `undefined` |
|
|
2132
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` |
|
|
1432
2133
|
|
|
1433
2134
|
#### Returns
|
|
1434
2135
|
|
|
@@ -1537,17 +2238,18 @@ Normalize all retained provider envelopes into bounded image bytes.
|
|
|
1537
2238
|
### estimateVideoMilliunits()
|
|
1538
2239
|
|
|
1539
2240
|
```ts
|
|
1540
|
-
function estimateVideoMilliunits(settings): number;
|
|
2241
|
+
function estimateVideoMilliunits(settings, catalogue?): number;
|
|
1541
2242
|
```
|
|
1542
2243
|
|
|
1543
|
-
Provider video cost from
|
|
2244
|
+
Provider video cost from `catalogue`, in milliunits (1 cent = 1,000).
|
|
1544
2245
|
Video-input references are unsupported.
|
|
1545
2246
|
|
|
1546
2247
|
#### Parameters
|
|
1547
2248
|
|
|
1548
|
-
| Parameter
|
|
1549
|
-
|
|
|
1550
|
-
| `settings`
|
|
2249
|
+
| Parameter | Type | Default value |
|
|
2250
|
+
| ----------- | ----------------------------------------------------- | ------------- |
|
|
2251
|
+
| `settings` | [`MediaVideoQuoteSettings`](#mediavideoquotesettings) | `undefined` |
|
|
2252
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` |
|
|
1551
2253
|
|
|
1552
2254
|
#### Returns
|
|
1553
2255
|
|
|
@@ -1555,13 +2257,34 @@ Video-input references are unsupported.
|
|
|
1555
2257
|
|
|
1556
2258
|
---
|
|
1557
2259
|
|
|
2260
|
+
### parseMediaCatalogue()
|
|
2261
|
+
|
|
2262
|
+
```ts
|
|
2263
|
+
function parseMediaCatalogue(raw): MediaCatalogue;
|
|
2264
|
+
```
|
|
2265
|
+
|
|
2266
|
+
Decode untrusted catalogue data, throwing a MediaSettingsError that names the
|
|
2267
|
+
first problem.
|
|
2268
|
+
|
|
2269
|
+
#### Parameters
|
|
2270
|
+
|
|
2271
|
+
| Parameter | Type |
|
|
2272
|
+
| --------- | --------- |
|
|
2273
|
+
| `raw` | `unknown` |
|
|
2274
|
+
|
|
2275
|
+
#### Returns
|
|
2276
|
+
|
|
2277
|
+
[`MediaCatalogue`](#mediacatalogue)
|
|
2278
|
+
|
|
2279
|
+
---
|
|
2280
|
+
|
|
1558
2281
|
### listMediaModels()
|
|
1559
2282
|
|
|
1560
2283
|
```ts
|
|
1561
2284
|
function listMediaModels(): readonly Readonly<{
|
|
1562
2285
|
id: string;
|
|
1563
2286
|
label: string;
|
|
1564
|
-
kind: "image" | "video";
|
|
2287
|
+
kind: "image" | "video" | "audio";
|
|
1565
2288
|
tier: "draft" | "balanced" | "premium" | "max";
|
|
1566
2289
|
outputFormats: readonly ("png" | "jpeg" | "webp")[];
|
|
1567
2290
|
maxPromptLength: number;
|
|
@@ -1603,22 +2326,41 @@ function listMediaModels(): readonly Readonly<{
|
|
|
1603
2326
|
referenceResolutions: readonly (
|
|
1604
2327
|
"480p" | "720p" | "768p" | "1080p" | "4k"
|
|
1605
2328
|
)[];
|
|
2329
|
+
audioReferences: Readonly<{
|
|
2330
|
+
max: number;
|
|
2331
|
+
totalSeconds: number;
|
|
2332
|
+
}> | null;
|
|
1606
2333
|
prices: readonly Readonly<{
|
|
1607
2334
|
resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
1608
2335
|
silentMilliunitsPerSecond: number;
|
|
1609
2336
|
audioMilliunitsPerSecond: number;
|
|
1610
2337
|
}>[];
|
|
1611
2338
|
}> | null;
|
|
2339
|
+
audio: Readonly<{
|
|
2340
|
+
provider: "elevenlabs";
|
|
2341
|
+
mode: "music" | "speech";
|
|
2342
|
+
voices: readonly Readonly<{
|
|
2343
|
+
id: string;
|
|
2344
|
+
label: string;
|
|
2345
|
+
}>[];
|
|
2346
|
+
defaultVoiceId: string | null;
|
|
2347
|
+
seconds: Readonly<{
|
|
2348
|
+
min: number;
|
|
2349
|
+
max: number;
|
|
2350
|
+
default: number;
|
|
2351
|
+
}> | null;
|
|
2352
|
+
milliunitsPerUnit: number;
|
|
2353
|
+
}> | null;
|
|
1612
2354
|
}>[];
|
|
1613
2355
|
```
|
|
1614
2356
|
|
|
1615
|
-
List
|
|
2357
|
+
List the gateway provider's models in catalog order.
|
|
1616
2358
|
|
|
1617
2359
|
#### Returns
|
|
1618
2360
|
|
|
1619
2361
|
readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; `kind`: `"image"` \|
|
|
1620
|
-
`"video"`; `tier`: `"draft"` \| `"balanced"` \| `"premium"` \|
|
|
1621
|
-
`outputFormats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2362
|
+
`"video"` \| `"audio"`; `tier`: `"draft"` \| `"balanced"` \| `"premium"` \|
|
|
2363
|
+
`"max"`; `outputFormats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
1622
2364
|
`maxPromptLength`: `number`; `input`: `Readonly`\<\{ `transport`: `"json"` \|
|
|
1623
2365
|
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
1624
2366
|
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
@@ -1638,21 +2380,44 @@ readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; `kind`: `"image"` \|
|
|
|
1638
2380
|
`boolean`; `defaultGenerateAudio`: `boolean` \| `null`; `referenceRoles`:
|
|
1639
2381
|
readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
1640
2382
|
`maxReferenceImages`: `number`; `referenceResolutions`: readonly (`"480p"` \|
|
|
1641
|
-
`"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`)[]; `
|
|
1642
|
-
`Readonly`\<\{ `
|
|
1643
|
-
`
|
|
1644
|
-
`
|
|
2383
|
+
`"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`)[]; `audioReferences`: \|
|
|
2384
|
+
`Readonly`\<\{ `max`: `number`; `totalSeconds`: `number`; \}\> \| `null`;
|
|
2385
|
+
`prices`: readonly `Readonly`\<\{ `resolution`: `"480p"` \| `"720p"` \| `"768p"`
|
|
2386
|
+
\| `"1080p"` \| `"4k"`; `silentMilliunitsPerSecond`: `number`;
|
|
2387
|
+
`audioMilliunitsPerSecond`: `number`; \}\>[]; \}\> \| `null`; `audio`: \|
|
|
2388
|
+
`Readonly`\<\{ `provider`: `"elevenlabs"`; `mode`: `"music"` \| `"speech"`;
|
|
2389
|
+
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2390
|
+
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2391
|
+
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2392
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; \}\>[]
|
|
1645
2393
|
|
|
1646
2394
|
---
|
|
1647
2395
|
|
|
1648
|
-
###
|
|
2396
|
+
### listPictureMediaModels()
|
|
1649
2397
|
|
|
1650
2398
|
```ts
|
|
1651
|
-
function
|
|
2399
|
+
function listPictureMediaModels(): readonly MediaPictureModel[];
|
|
2400
|
+
```
|
|
2401
|
+
|
|
2402
|
+
The gateway models Apps and browsers list and pick from: pictures and video. The
|
|
2403
|
+
Agar and Prints catalog decoders know no `audio` kind yet, and one unknown row
|
|
2404
|
+
fails the whole list, so audio models are generated by id until the Prints audio
|
|
2405
|
+
UI lands and lists them.
|
|
2406
|
+
|
|
2407
|
+
#### Returns
|
|
2408
|
+
|
|
2409
|
+
readonly [`MediaPictureModel`](#mediapicturemodel)[]
|
|
2410
|
+
|
|
2411
|
+
---
|
|
2412
|
+
|
|
2413
|
+
### getGatewayModel()
|
|
2414
|
+
|
|
2415
|
+
```ts
|
|
2416
|
+
function getGatewayModel(id):
|
|
1652
2417
|
| Readonly<{
|
|
1653
2418
|
id: string;
|
|
1654
2419
|
label: string;
|
|
1655
|
-
kind: "image" | "video";
|
|
2420
|
+
kind: "image" | "video" | "audio";
|
|
1656
2421
|
tier: "draft" | "balanced" | "premium" | "max";
|
|
1657
2422
|
outputFormats: readonly ("png" | "jpeg" | "webp")[];
|
|
1658
2423
|
maxPromptLength: number;
|
|
@@ -1695,17 +2460,37 @@ function getMediaModel(id):
|
|
|
1695
2460
|
referenceResolutions: readonly (
|
|
1696
2461
|
"480p" | "720p" | "768p" | "1080p" | "4k"
|
|
1697
2462
|
)[];
|
|
2463
|
+
audioReferences: Readonly<{
|
|
2464
|
+
max: number;
|
|
2465
|
+
totalSeconds: number;
|
|
2466
|
+
}> | null;
|
|
1698
2467
|
prices: readonly Readonly<{
|
|
1699
2468
|
resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
1700
2469
|
silentMilliunitsPerSecond: number;
|
|
1701
2470
|
audioMilliunitsPerSecond: number;
|
|
1702
2471
|
}>[];
|
|
1703
2472
|
}> | null;
|
|
2473
|
+
audio: Readonly<{
|
|
2474
|
+
provider: "elevenlabs";
|
|
2475
|
+
mode: "music" | "speech";
|
|
2476
|
+
voices: readonly Readonly<{
|
|
2477
|
+
id: string;
|
|
2478
|
+
label: string;
|
|
2479
|
+
}>[];
|
|
2480
|
+
defaultVoiceId: string | null;
|
|
2481
|
+
seconds: Readonly<{
|
|
2482
|
+
min: number;
|
|
2483
|
+
max: number;
|
|
2484
|
+
default: number;
|
|
2485
|
+
}> | null;
|
|
2486
|
+
milliunitsPerUnit: number;
|
|
2487
|
+
}> | null;
|
|
1704
2488
|
}>
|
|
1705
2489
|
| undefined;
|
|
1706
2490
|
```
|
|
1707
2491
|
|
|
1708
|
-
Find a model
|
|
2492
|
+
Find a model in the Fungi gateway's own catalogue; gateway-internal code never
|
|
2493
|
+
sees a custom provider's models.
|
|
1709
2494
|
|
|
1710
2495
|
#### Parameters
|
|
1711
2496
|
|
|
@@ -1716,8 +2501,8 @@ Find a model by provider identifier, returning undefined when it is absent.
|
|
|
1716
2501
|
#### Returns
|
|
1717
2502
|
|
|
1718
2503
|
\| `Readonly`\<\{ `id`: `string`; `label`: `string`; `kind`: `"image"` \|
|
|
1719
|
-
`"video"`; `tier`: `"draft"` \| `"balanced"` \| `"premium"` \|
|
|
1720
|
-
`outputFormats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2504
|
+
`"video"` \| `"audio"`; `tier`: `"draft"` \| `"balanced"` \| `"premium"` \|
|
|
2505
|
+
`"max"`; `outputFormats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
1721
2506
|
`maxPromptLength`: `number`; `input`: `Readonly`\<\{ `transport`: `"json"` \|
|
|
1722
2507
|
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
1723
2508
|
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
@@ -1737,10 +2522,146 @@ Find a model by provider identifier, returning undefined when it is absent.
|
|
|
1737
2522
|
`boolean`; `defaultGenerateAudio`: `boolean` \| `null`; `referenceRoles`:
|
|
1738
2523
|
readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
1739
2524
|
`maxReferenceImages`: `number`; `referenceResolutions`: readonly (`"480p"` \|
|
|
1740
|
-
`"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`)[]; `
|
|
1741
|
-
`Readonly`\<\{ `
|
|
1742
|
-
`
|
|
1743
|
-
`
|
|
2525
|
+
`"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`)[]; `audioReferences`: \|
|
|
2526
|
+
`Readonly`\<\{ `max`: `number`; `totalSeconds`: `number`; \}\> \| `null`;
|
|
2527
|
+
`prices`: readonly `Readonly`\<\{ `resolution`: `"480p"` \| `"720p"` \| `"768p"`
|
|
2528
|
+
\| `"1080p"` \| `"4k"`; `silentMilliunitsPerSecond`: `number`;
|
|
2529
|
+
`audioMilliunitsPerSecond`: `number`; \}\>[]; \}\> \| `null`; `audio`: \|
|
|
2530
|
+
`Readonly`\<\{ `provider`: `"elevenlabs"`; `mode`: `"music"` \| `"speech"`;
|
|
2531
|
+
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2532
|
+
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2533
|
+
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2534
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; \}\> \| `undefined`
|
|
2535
|
+
|
|
2536
|
+
---
|
|
2537
|
+
|
|
2538
|
+
### getMediaModel()
|
|
2539
|
+
|
|
2540
|
+
```ts
|
|
2541
|
+
function getMediaModel(
|
|
2542
|
+
id,
|
|
2543
|
+
catalogue?,
|
|
2544
|
+
):
|
|
2545
|
+
| Readonly<{
|
|
2546
|
+
id: string;
|
|
2547
|
+
label: string;
|
|
2548
|
+
kind: "image" | "video" | "audio";
|
|
2549
|
+
tier: "draft" | "balanced" | "premium" | "max";
|
|
2550
|
+
outputFormats: readonly ("png" | "jpeg" | "webp")[];
|
|
2551
|
+
maxPromptLength: number;
|
|
2552
|
+
input: Readonly<{
|
|
2553
|
+
transport: "json" | "multipart";
|
|
2554
|
+
dimensions: "none" | "own";
|
|
2555
|
+
maxDimension: number | null;
|
|
2556
|
+
maxDimensionDocumented: boolean;
|
|
2557
|
+
defaultWidth: number;
|
|
2558
|
+
defaultHeight: number;
|
|
2559
|
+
steps: "steps" | "num_steps" | "fixed";
|
|
2560
|
+
maxSteps: number | null;
|
|
2561
|
+
defaultSteps: number | null;
|
|
2562
|
+
referenceField: string | null;
|
|
2563
|
+
maxReferences: number;
|
|
2564
|
+
referenceDimension: number | null;
|
|
2565
|
+
referenceFormat: "png" | "webp";
|
|
2566
|
+
}>;
|
|
2567
|
+
sizes: readonly string[] | null;
|
|
2568
|
+
audio: Readonly<{
|
|
2569
|
+
provider: "elevenlabs";
|
|
2570
|
+
mode: "music" | "speech";
|
|
2571
|
+
voices: readonly Readonly<{
|
|
2572
|
+
id: string;
|
|
2573
|
+
label: string;
|
|
2574
|
+
}>[];
|
|
2575
|
+
defaultVoiceId: string | null;
|
|
2576
|
+
seconds: Readonly<{
|
|
2577
|
+
min: number;
|
|
2578
|
+
max: number;
|
|
2579
|
+
default: number;
|
|
2580
|
+
}> | null;
|
|
2581
|
+
milliunitsPerUnit: number;
|
|
2582
|
+
}> | null;
|
|
2583
|
+
video: Readonly<{
|
|
2584
|
+
minSeconds: number;
|
|
2585
|
+
maxSeconds: number;
|
|
2586
|
+
defaultSeconds: number;
|
|
2587
|
+
durations: readonly number[];
|
|
2588
|
+
formats: readonly Readonly<{
|
|
2589
|
+
resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
2590
|
+
aspectRatio:
|
|
2591
|
+
"16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
|
|
2592
|
+
width: number;
|
|
2593
|
+
height: number;
|
|
2594
|
+
}>[];
|
|
2595
|
+
defaultResolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
2596
|
+
defaultAspectRatio:
|
|
2597
|
+
"16:9" | "4:3" | "1:1" | "3:4" | "9:16" | "21:9" | "9:21";
|
|
2598
|
+
supportsAudio: boolean;
|
|
2599
|
+
defaultGenerateAudio: boolean | null;
|
|
2600
|
+
referenceRoles: readonly ("first-frame" | "last-frame" | "reference")[];
|
|
2601
|
+
maxReferenceImages: number;
|
|
2602
|
+
referenceResolutions: readonly (
|
|
2603
|
+
"480p" | "720p" | "768p" | "1080p" | "4k"
|
|
2604
|
+
)[];
|
|
2605
|
+
prices: readonly Readonly<{
|
|
2606
|
+
resolution: "480p" | "720p" | "768p" | "1080p" | "4k";
|
|
2607
|
+
silentMilliunitsPerSecond: number;
|
|
2608
|
+
audioMilliunitsPerSecond: number;
|
|
2609
|
+
}>[];
|
|
2610
|
+
audioReferences: Readonly<{
|
|
2611
|
+
max: number;
|
|
2612
|
+
totalSeconds: number;
|
|
2613
|
+
}> | null;
|
|
2614
|
+
provider: "seedance" | "veo" | "minimax" | "host";
|
|
2615
|
+
}> | null;
|
|
2616
|
+
}>
|
|
2617
|
+
| undefined;
|
|
2618
|
+
```
|
|
2619
|
+
|
|
2620
|
+
Find a model in `catalogue` (the gateway's by default), or undefined when
|
|
2621
|
+
absent.
|
|
2622
|
+
|
|
2623
|
+
#### Parameters
|
|
2624
|
+
|
|
2625
|
+
| Parameter | Type | Default value |
|
|
2626
|
+
| ----------- | ----------------------------------- | ------------- |
|
|
2627
|
+
| `id` | `string` | `undefined` |
|
|
2628
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` |
|
|
2629
|
+
|
|
2630
|
+
#### Returns
|
|
2631
|
+
|
|
2632
|
+
\| `Readonly`\<\{ `id`: `string`; `label`: `string`; `kind`: `"image"` \|
|
|
2633
|
+
`"video"` \| `"audio"`; `tier`: `"draft"` \| `"balanced"` \| `"premium"` \|
|
|
2634
|
+
`"max"`; `outputFormats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2635
|
+
`maxPromptLength`: `number`; `input`: `Readonly`\<\{ `transport`: `"json"` \|
|
|
2636
|
+
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
2637
|
+
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
2638
|
+
`defaultHeight`: `number`; `steps`: `"steps"` \| `"num_steps"` \| `"fixed"`;
|
|
2639
|
+
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`;
|
|
2640
|
+
`referenceField`: `string` \| `null`; `maxReferences`: `number`;
|
|
2641
|
+
`referenceDimension`: `number` \| `null`; `referenceFormat`: `"png"` \|
|
|
2642
|
+
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `audio`: \|
|
|
2643
|
+
`Readonly`\<\{ `provider`: `"elevenlabs"`; `mode`: `"music"` \| `"speech"`;
|
|
2644
|
+
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2645
|
+
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2646
|
+
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2647
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `video`: \| `Readonly`\<\{
|
|
2648
|
+
`minSeconds`: `number`; `maxSeconds`: `number`; `defaultSeconds`: `number`;
|
|
2649
|
+
`durations`: readonly `number`[]; `formats`: readonly `Readonly`\<\{
|
|
2650
|
+
`resolution`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`;
|
|
2651
|
+
`aspectRatio`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"`
|
|
2652
|
+
\| `"9:21"`; `width`: `number`; `height`: `number`; \}\>[]; `defaultResolution`:
|
|
2653
|
+
`"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`; `defaultAspectRatio`:
|
|
2654
|
+
`"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`;
|
|
2655
|
+
`supportsAudio`: `boolean`; `defaultGenerateAudio`: `boolean` \| `null`;
|
|
2656
|
+
`referenceRoles`: readonly (`"first-frame"` \| `"last-frame"` \|
|
|
2657
|
+
`"reference"`)[]; `maxReferenceImages`: `number`; `referenceResolutions`:
|
|
2658
|
+
readonly (`"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`)[]; `prices`:
|
|
2659
|
+
readonly `Readonly`\<\{ `resolution`: `"480p"` \| `"720p"` \| `"768p"` \|
|
|
2660
|
+
`"1080p"` \| `"4k"`; `silentMilliunitsPerSecond`: `number`;
|
|
2661
|
+
`audioMilliunitsPerSecond`: `number`; \}\>[]; `audioReferences`: \|
|
|
2662
|
+
`Readonly`\<\{ `max`: `number`; `totalSeconds`: `number`; \}\> \| `null`;
|
|
2663
|
+
`provider`: `"seedance"` \| `"veo"` \| `"minimax"` \| `"host"`; \}\> \| `null`;
|
|
2664
|
+
\}\> \| `undefined`
|
|
1744
2665
|
|
|
1745
2666
|
---
|
|
1746
2667
|
|