@fungi.computer/darkroom 0.9.1 → 0.10.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 +111 -31
- package/dist/app-media-contracts.d.ts +85 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/cloudflare/provider.d.ts +4 -4
- package/dist/cloudflare/provider.js +20 -9
- package/dist/cloudflare/r2-destination.d.ts +48 -0
- package/dist/cloudflare/r2-destination.js +46 -0
- package/dist/cloudflare.d.ts +1 -0
- package/dist/cloudflare.js +1 -0
- package/dist/gateway-models.d.ts +44 -9
- package/dist/gateway-models.js +52 -20
- package/dist/index.d.ts +6 -2
- package/dist/index.js +64 -38
- package/dist/media-binding.d.ts +3 -0
- package/dist/media-content-type.d.ts +5 -0
- package/dist/media-content-type.js +49 -0
- package/dist/media-operation-owner.js +35 -2
- package/dist/media-path.d.ts +3 -0
- package/dist/media-path.js +7 -0
- package/dist/media-run-lifetime.d.ts +5 -0
- package/dist/media-run-lifetime.js +5 -0
- package/dist/model-catalog.d.ts +201 -0
- package/dist/model-catalog.js +220 -9
- package/dist/reference-read.d.ts +24 -0
- package/dist/reference-read.js +26 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +5 -5
- package/docs/api/app-media-contracts.md +43 -0
- package/docs/api/browser.md +15 -4
- package/docs/api/cloudflare.md +109 -0
- package/docs/api/index.md +292 -56
- package/docs/api/server.md +123 -52
- package/package.json +2 -2
package/docs/api/index.md
CHANGED
|
@@ -218,6 +218,7 @@ type MediaGenerationSettings = Readonly<{
|
|
|
218
218
|
height?: number;
|
|
219
219
|
steps?: number;
|
|
220
220
|
durationSeconds?: number;
|
|
221
|
+
targetMegapixels?: number;
|
|
221
222
|
voiceId?: string;
|
|
222
223
|
resolution?: MediaVideoResolution;
|
|
223
224
|
aspectRatio?: MediaVideoAspectRatio;
|
|
@@ -654,6 +655,36 @@ Immutable audio capability and price metadata.
|
|
|
654
655
|
|
|
655
656
|
---
|
|
656
657
|
|
|
658
|
+
### MediaTransformOperation
|
|
659
|
+
|
|
660
|
+
```ts
|
|
661
|
+
type MediaTransformOperation = z.output<typeof mediaTransformOperationSchema>;
|
|
662
|
+
```
|
|
663
|
+
|
|
664
|
+
A source-image operation.
|
|
665
|
+
|
|
666
|
+
---
|
|
667
|
+
|
|
668
|
+
### MediaTransform
|
|
669
|
+
|
|
670
|
+
```ts
|
|
671
|
+
type MediaTransform = z.output<typeof mediaTransformSchema>;
|
|
672
|
+
```
|
|
673
|
+
|
|
674
|
+
Immutable source-image operation facts.
|
|
675
|
+
|
|
676
|
+
---
|
|
677
|
+
|
|
678
|
+
### MediaBillingUnit
|
|
679
|
+
|
|
680
|
+
```ts
|
|
681
|
+
type MediaBillingUnit = z.output<typeof mediaBillingUnitSchema>;
|
|
682
|
+
```
|
|
683
|
+
|
|
684
|
+
The unit a model's generations are billed in.
|
|
685
|
+
|
|
686
|
+
---
|
|
687
|
+
|
|
657
688
|
### MediaModelInput
|
|
658
689
|
|
|
659
690
|
```ts
|
|
@@ -822,6 +853,7 @@ const mediaGenerationSettingsSchema: ZodObject<
|
|
|
822
853
|
height: ZodOptional<ZodNumber>;
|
|
823
854
|
steps: ZodOptional<ZodNumber>;
|
|
824
855
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
856
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
825
857
|
voiceId: ZodOptional<ZodString>;
|
|
826
858
|
resolution: ZodOptional<
|
|
827
859
|
ZodEnum<{
|
|
@@ -893,6 +925,7 @@ const mediaGenerationSelectionSchema: ZodObject<
|
|
|
893
925
|
height: ZodOptional<ZodNumber>;
|
|
894
926
|
steps: ZodOptional<ZodNumber>;
|
|
895
927
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
928
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
896
929
|
voiceId: ZodOptional<ZodString>;
|
|
897
930
|
resolution: ZodOptional<
|
|
898
931
|
ZodEnum<{
|
|
@@ -1484,6 +1517,70 @@ Structural ceiling for any prompt on the wire. Each model's own
|
|
|
1484
1517
|
|
|
1485
1518
|
---
|
|
1486
1519
|
|
|
1520
|
+
### mediaTransformOperationSchema
|
|
1521
|
+
|
|
1522
|
+
```ts
|
|
1523
|
+
const mediaTransformOperationSchema: ZodEnum<{
|
|
1524
|
+
remove_background: "remove_background";
|
|
1525
|
+
upscale: "upscale";
|
|
1526
|
+
}>;
|
|
1527
|
+
```
|
|
1528
|
+
|
|
1529
|
+
What a source-image operation does to its one reference image. Both write a new
|
|
1530
|
+
image and never touch the source.
|
|
1531
|
+
|
|
1532
|
+
---
|
|
1533
|
+
|
|
1534
|
+
### mediaTransformSchema
|
|
1535
|
+
|
|
1536
|
+
```ts
|
|
1537
|
+
const mediaTransformSchema: ZodLazy<ZodReadonly<ZodObject<{
|
|
1538
|
+
operation: ZodEnum<{
|
|
1539
|
+
remove_background: "remove_background";
|
|
1540
|
+
upscale: "upscale";
|
|
1541
|
+
}>;
|
|
1542
|
+
source: ZodReadonly<ZodObject<{
|
|
1543
|
+
formats: ZodReadonly<ZodArray<ZodEnum<{
|
|
1544
|
+
png: ...;
|
|
1545
|
+
jpeg: ...;
|
|
1546
|
+
webp: ...;
|
|
1547
|
+
}>>>;
|
|
1548
|
+
maxBytes: ZodNumber;
|
|
1549
|
+
maxPixels: ZodNumber;
|
|
1550
|
+
}, $strict>>;
|
|
1551
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1552
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1553
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<ZodObject<{
|
|
1554
|
+
megapixels: ZodNumber;
|
|
1555
|
+
milliunits: ZodNumber;
|
|
1556
|
+
}, $strict>>>>;
|
|
1557
|
+
}, $strict>>>;
|
|
1558
|
+
```
|
|
1559
|
+
|
|
1560
|
+
Facts of a catalog entry that edits one source image rather than generating from
|
|
1561
|
+
a prompt. The source limits are Botanical's own conservative bounds, not
|
|
1562
|
+
Cloudflare's: neither model page publishes an input size limit.
|
|
1563
|
+
|
|
1564
|
+
---
|
|
1565
|
+
|
|
1566
|
+
### mediaBillingUnitSchema
|
|
1567
|
+
|
|
1568
|
+
```ts
|
|
1569
|
+
const mediaBillingUnitSchema: ZodEnum<{
|
|
1570
|
+
image: "image";
|
|
1571
|
+
video_second: "video_second";
|
|
1572
|
+
audio_second: "audio_second";
|
|
1573
|
+
audio_character_block: "audio_character_block";
|
|
1574
|
+
}>;
|
|
1575
|
+
```
|
|
1576
|
+
|
|
1577
|
+
What one generation bills: whole images, whole seconds of video or music, or
|
|
1578
|
+
blocks of [AUDIO\_CHARACTER\_BLOCK](#audio_character_block) speech characters
|
|
1579
|
+
(so a per-character provider rate is marked up once per block, not rounded up
|
|
1580
|
+
per character).
|
|
1581
|
+
|
|
1582
|
+
---
|
|
1583
|
+
|
|
1487
1584
|
### mediaModelSchema
|
|
1488
1585
|
|
|
1489
1586
|
```ts
|
|
@@ -1582,6 +1679,26 @@ const mediaModelSchema: ZodReadonly<ZodObject<{
|
|
|
1582
1679
|
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1583
1680
|
milliunitsPerUnit: ZodNumber;
|
|
1584
1681
|
}, $strict>>>>;
|
|
1682
|
+
billingUnit: ZodEnum<{
|
|
1683
|
+
image: "image";
|
|
1684
|
+
video_second: "video_second";
|
|
1685
|
+
audio_second: "audio_second";
|
|
1686
|
+
audio_character_block: "audio_character_block";
|
|
1687
|
+
}>;
|
|
1688
|
+
transform: ZodNullable<ZodLazy<ZodReadonly<ZodObject<{
|
|
1689
|
+
operation: ZodEnum<{
|
|
1690
|
+
remove_background: "remove_background";
|
|
1691
|
+
upscale: "upscale";
|
|
1692
|
+
}>;
|
|
1693
|
+
source: ZodReadonly<ZodObject<{
|
|
1694
|
+
formats: ...;
|
|
1695
|
+
maxBytes: ...;
|
|
1696
|
+
maxPixels: ...;
|
|
1697
|
+
}, $strict>>;
|
|
1698
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1699
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1700
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<...>>>;
|
|
1701
|
+
}, $strict>>>>;
|
|
1585
1702
|
}, $strict>>;
|
|
1586
1703
|
```
|
|
1587
1704
|
|
|
@@ -1651,6 +1768,12 @@ const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
|
1651
1768
|
}>;
|
|
1652
1769
|
}, $strict>>>;
|
|
1653
1770
|
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1771
|
+
billingUnit: ZodOptional<ZodEnum<{
|
|
1772
|
+
image: "image";
|
|
1773
|
+
video_second: "video_second";
|
|
1774
|
+
audio_second: "audio_second";
|
|
1775
|
+
audio_character_block: "audio_character_block";
|
|
1776
|
+
}>>;
|
|
1654
1777
|
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1655
1778
|
provider: ZodLiteral<"elevenlabs">;
|
|
1656
1779
|
mode: ZodEnum<{
|
|
@@ -1662,6 +1785,20 @@ const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
|
1662
1785
|
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1663
1786
|
milliunitsPerUnit: ZodNumber;
|
|
1664
1787
|
}, $strict>>>>;
|
|
1788
|
+
transform: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1789
|
+
operation: ZodEnum<{
|
|
1790
|
+
remove_background: "remove_background";
|
|
1791
|
+
upscale: "upscale";
|
|
1792
|
+
}>;
|
|
1793
|
+
source: ZodReadonly<ZodObject<{
|
|
1794
|
+
formats: ...;
|
|
1795
|
+
maxBytes: ...;
|
|
1796
|
+
maxPixels: ...;
|
|
1797
|
+
}, $strict>>;
|
|
1798
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1799
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1800
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<...>>>;
|
|
1801
|
+
}, $strict>>>>;
|
|
1665
1802
|
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1666
1803
|
minSeconds: ZodNumber;
|
|
1667
1804
|
maxSeconds: ZodNumber;
|
|
@@ -1769,6 +1906,12 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1769
1906
|
}>;
|
|
1770
1907
|
}, $strict>>>;
|
|
1771
1908
|
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1909
|
+
billingUnit: ZodOptional<ZodEnum<{
|
|
1910
|
+
image: "image";
|
|
1911
|
+
video_second: "video_second";
|
|
1912
|
+
audio_second: "audio_second";
|
|
1913
|
+
audio_character_block: "audio_character_block";
|
|
1914
|
+
}>>;
|
|
1772
1915
|
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1773
1916
|
provider: ZodLiteral<...>;
|
|
1774
1917
|
mode: ZodEnum<...>;
|
|
@@ -1777,6 +1920,13 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1777
1920
|
seconds: ZodNullable<...>;
|
|
1778
1921
|
milliunitsPerUnit: ZodNumber;
|
|
1779
1922
|
}, $strict>>>>;
|
|
1923
|
+
transform: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1924
|
+
operation: ZodEnum<...>;
|
|
1925
|
+
source: ZodReadonly<...>;
|
|
1926
|
+
defaultMegapixels: ZodNullable<...>;
|
|
1927
|
+
milliunits: ZodNullable<...>;
|
|
1928
|
+
sizes: ZodReadonly<...>;
|
|
1929
|
+
}, $strict>>>>;
|
|
1780
1930
|
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1781
1931
|
minSeconds: ZodNumber;
|
|
1782
1932
|
maxSeconds: ZodNumber;
|
|
@@ -1836,6 +1986,7 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1836
1986
|
referenceFormat: "png" | "webp";
|
|
1837
1987
|
}>;
|
|
1838
1988
|
sizes: readonly string[] | null;
|
|
1989
|
+
billingUnit?: "image" | "video_second" | "audio_second" | "audio_character_block";
|
|
1839
1990
|
audio: | Readonly<{
|
|
1840
1991
|
provider: "elevenlabs";
|
|
1841
1992
|
mode: "music" | "speech";
|
|
@@ -1853,6 +2004,21 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1853
2004
|
milliunitsPerUnit: number;
|
|
1854
2005
|
}>
|
|
1855
2006
|
| null;
|
|
2007
|
+
transform: | Readonly<{
|
|
2008
|
+
operation: "remove_background" | "upscale";
|
|
2009
|
+
source: Readonly<{
|
|
2010
|
+
formats: readonly ...[];
|
|
2011
|
+
maxBytes: number;
|
|
2012
|
+
maxPixels: number;
|
|
2013
|
+
}>;
|
|
2014
|
+
defaultMegapixels: number | null;
|
|
2015
|
+
milliunits: number | null;
|
|
2016
|
+
sizes: readonly Readonly<{
|
|
2017
|
+
megapixels: ...;
|
|
2018
|
+
milliunits: ...;
|
|
2019
|
+
}>[];
|
|
2020
|
+
}>
|
|
2021
|
+
| null;
|
|
1856
2022
|
video: | Readonly<{
|
|
1857
2023
|
minSeconds: number;
|
|
1858
2024
|
maxSeconds: number;
|
|
@@ -1963,20 +2129,21 @@ again.
|
|
|
1963
2129
|
|
|
1964
2130
|
#### Returns
|
|
1965
2131
|
|
|
1966
|
-
| Name
|
|
1967
|
-
|
|
|
1968
|
-
| `model`
|
|
1969
|
-
| `prompt`
|
|
1970
|
-
| `width?`
|
|
1971
|
-
| `height?`
|
|
1972
|
-
| `steps?`
|
|
1973
|
-
| `durationSeconds?`
|
|
1974
|
-
| `
|
|
1975
|
-
| `
|
|
1976
|
-
| `
|
|
1977
|
-
| `
|
|
1978
|
-
| `
|
|
1979
|
-
| `
|
|
2132
|
+
| Name | Type | Description |
|
|
2133
|
+
| ------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
2134
|
+
| `model` | `string` | Provider catalog model identifier. |
|
|
2135
|
+
| `prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2136
|
+
| `width?` | `number` | Requested image width or nominal video selector; absent for audio. |
|
|
2137
|
+
| `height?` | `number` | Requested image height or nominal video selector; absent for audio. |
|
|
2138
|
+
| `steps?` | `number` | Model-specific inference step count. |
|
|
2139
|
+
| `durationSeconds?` | `number` | Requested video or music length in whole seconds. |
|
|
2140
|
+
| `targetMegapixels?` | `number` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2141
|
+
| `voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2142
|
+
| `resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
2143
|
+
| `aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Video aspect; must match the nominal width/height selector. |
|
|
2144
|
+
| `generateAudio?` | `boolean` | Video audio selection. |
|
|
2145
|
+
| `references?` | `object`[] | Host-authorized reference images. |
|
|
2146
|
+
| `audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
1980
2147
|
|
|
1981
2148
|
---
|
|
1982
2149
|
|
|
@@ -1994,22 +2161,23 @@ Validate caller settings against `catalogue`, the active provider's model list
|
|
|
1994
2161
|
|
|
1995
2162
|
#### Parameters
|
|
1996
2163
|
|
|
1997
|
-
| Parameter
|
|
1998
|
-
|
|
|
1999
|
-
| `raw`
|
|
2000
|
-
| `raw.model`
|
|
2001
|
-
| `raw.prompt`
|
|
2002
|
-
| `raw.width?`
|
|
2003
|
-
| `raw.height?`
|
|
2004
|
-
| `raw.steps?`
|
|
2005
|
-
| `raw.durationSeconds?`
|
|
2006
|
-
| `raw.
|
|
2007
|
-
| `raw.
|
|
2008
|
-
| `raw.
|
|
2009
|
-
| `raw.
|
|
2010
|
-
| `raw.
|
|
2011
|
-
| `raw.
|
|
2012
|
-
| `
|
|
2164
|
+
| Parameter | Type | Default value | Description |
|
|
2165
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------- |
|
|
2166
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `targetMegapixels?`: `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` | - |
|
|
2167
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2168
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2169
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2170
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2171
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2172
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2173
|
+
| `raw.targetMegapixels?` | `number` | `...` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2174
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2175
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2176
|
+
| `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. |
|
|
2177
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2178
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2179
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
2180
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
2013
2181
|
|
|
2014
2182
|
#### Returns
|
|
2015
2183
|
|
|
@@ -2032,22 +2200,23 @@ Validate selections without granting Computer authority.
|
|
|
2032
2200
|
|
|
2033
2201
|
#### Parameters
|
|
2034
2202
|
|
|
2035
|
-
| Parameter
|
|
2036
|
-
|
|
|
2037
|
-
| `raw`
|
|
2038
|
-
| `raw.model`
|
|
2039
|
-
| `raw.prompt`
|
|
2040
|
-
| `raw.width?`
|
|
2041
|
-
| `raw.height?`
|
|
2042
|
-
| `raw.steps?`
|
|
2043
|
-
| `raw.durationSeconds?`
|
|
2044
|
-
| `raw.
|
|
2045
|
-
| `raw.
|
|
2046
|
-
| `raw.
|
|
2047
|
-
| `raw.
|
|
2048
|
-
| `raw.
|
|
2049
|
-
| `raw.
|
|
2050
|
-
| `
|
|
2203
|
+
| Parameter | Type | Default value | Description |
|
|
2204
|
+
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------- |
|
|
2205
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `targetMegapixels?`: `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` | - |
|
|
2206
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2207
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2208
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2209
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2210
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2211
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2212
|
+
| `raw.targetMegapixels?` | `number` | `...` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2213
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2214
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2215
|
+
| `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. |
|
|
2216
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2217
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2218
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips. |
|
|
2219
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
2051
2220
|
|
|
2052
2221
|
#### Returns
|
|
2053
2222
|
|
|
@@ -2334,6 +2503,22 @@ function listMediaModels(): readonly Readonly<{
|
|
|
2334
2503
|
}> | null;
|
|
2335
2504
|
milliunitsPerUnit: number;
|
|
2336
2505
|
}> | null;
|
|
2506
|
+
billingUnit:
|
|
2507
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2508
|
+
transform: Readonly<{
|
|
2509
|
+
operation: "remove_background" | "upscale";
|
|
2510
|
+
source: Readonly<{
|
|
2511
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2512
|
+
maxBytes: number;
|
|
2513
|
+
maxPixels: number;
|
|
2514
|
+
}>;
|
|
2515
|
+
defaultMegapixels: number | null;
|
|
2516
|
+
milliunits: number | null;
|
|
2517
|
+
sizes: readonly Readonly<{
|
|
2518
|
+
megapixels: number;
|
|
2519
|
+
milliunits: number;
|
|
2520
|
+
}>[];
|
|
2521
|
+
}> | null;
|
|
2337
2522
|
}>[];
|
|
2338
2523
|
```
|
|
2339
2524
|
|
|
@@ -2372,7 +2557,13 @@ readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
|
2372
2557
|
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2373
2558
|
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2374
2559
|
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2375
|
-
`milliunitsPerUnit`: `number`; \}\> \| `null`;
|
|
2560
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `billingUnit`: `"image"` \|
|
|
2561
|
+
`"video_second"` \| `"audio_second"` \| `"audio_character_block"`; `transform`:
|
|
2562
|
+
\| `Readonly`\<\{ `operation`: `"remove_background"` \| `"upscale"`; `source`:
|
|
2563
|
+
`Readonly`\<\{ `formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2564
|
+
`maxBytes`: `number`; `maxPixels`: `number`; \}\>; `defaultMegapixels`: `number`
|
|
2565
|
+
\| `null`; `milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{
|
|
2566
|
+
`megapixels`: `number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; \}\>[]
|
|
2376
2567
|
|
|
2377
2568
|
---
|
|
2378
2569
|
|
|
@@ -2451,6 +2642,22 @@ function getGatewayModel(id):
|
|
|
2451
2642
|
}> | null;
|
|
2452
2643
|
milliunitsPerUnit: number;
|
|
2453
2644
|
}> | null;
|
|
2645
|
+
billingUnit:
|
|
2646
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2647
|
+
transform: Readonly<{
|
|
2648
|
+
operation: "remove_background" | "upscale";
|
|
2649
|
+
source: Readonly<{
|
|
2650
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2651
|
+
maxBytes: number;
|
|
2652
|
+
maxPixels: number;
|
|
2653
|
+
}>;
|
|
2654
|
+
defaultMegapixels: number | null;
|
|
2655
|
+
milliunits: number | null;
|
|
2656
|
+
sizes: readonly Readonly<{
|
|
2657
|
+
megapixels: number;
|
|
2658
|
+
milliunits: number;
|
|
2659
|
+
}>[];
|
|
2660
|
+
}> | null;
|
|
2454
2661
|
}>
|
|
2455
2662
|
| undefined;
|
|
2456
2663
|
```
|
|
@@ -2497,7 +2704,14 @@ readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
|
2497
2704
|
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2498
2705
|
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2499
2706
|
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2500
|
-
`milliunitsPerUnit`: `number`; \}\> \| `null`;
|
|
2707
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `billingUnit`: `"image"` \|
|
|
2708
|
+
`"video_second"` \| `"audio_second"` \| `"audio_character_block"`; `transform`:
|
|
2709
|
+
\| `Readonly`\<\{ `operation`: `"remove_background"` \| `"upscale"`; `source`:
|
|
2710
|
+
`Readonly`\<\{ `formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2711
|
+
`maxBytes`: `number`; `maxPixels`: `number`; \}\>; `defaultMegapixels`: `number`
|
|
2712
|
+
\| `null`; `milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{
|
|
2713
|
+
`megapixels`: `number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; \}\> \|
|
|
2714
|
+
`undefined`
|
|
2501
2715
|
|
|
2502
2716
|
---
|
|
2503
2717
|
|
|
@@ -2531,6 +2745,8 @@ function getMediaModel(
|
|
|
2531
2745
|
referenceFormat: "png" | "webp";
|
|
2532
2746
|
}>;
|
|
2533
2747
|
sizes: readonly string[] | null;
|
|
2748
|
+
billingUnit?:
|
|
2749
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2534
2750
|
audio: Readonly<{
|
|
2535
2751
|
provider: "elevenlabs";
|
|
2536
2752
|
mode: "music" | "speech";
|
|
@@ -2546,6 +2762,20 @@ function getMediaModel(
|
|
|
2546
2762
|
}> | null;
|
|
2547
2763
|
milliunitsPerUnit: number;
|
|
2548
2764
|
}> | null;
|
|
2765
|
+
transform: Readonly<{
|
|
2766
|
+
operation: "remove_background" | "upscale";
|
|
2767
|
+
source: Readonly<{
|
|
2768
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2769
|
+
maxBytes: number;
|
|
2770
|
+
maxPixels: number;
|
|
2771
|
+
}>;
|
|
2772
|
+
defaultMegapixels: number | null;
|
|
2773
|
+
milliunits: number | null;
|
|
2774
|
+
sizes: readonly Readonly<{
|
|
2775
|
+
megapixels: number;
|
|
2776
|
+
milliunits: number;
|
|
2777
|
+
}>[];
|
|
2778
|
+
}> | null;
|
|
2549
2779
|
video: Readonly<{
|
|
2550
2780
|
minSeconds: number;
|
|
2551
2781
|
maxSeconds: number;
|
|
@@ -2605,14 +2835,20 @@ absent.
|
|
|
2605
2835
|
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`;
|
|
2606
2836
|
`referenceField`: `string` \| `null`; `maxReferences`: `number`;
|
|
2607
2837
|
`referenceDimension`: `number` \| `null`; `referenceFormat`: `"png"` \|
|
|
2608
|
-
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `
|
|
2609
|
-
`
|
|
2610
|
-
`
|
|
2611
|
-
`
|
|
2612
|
-
|
|
2613
|
-
`
|
|
2614
|
-
`
|
|
2615
|
-
`
|
|
2838
|
+
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `billingUnit?`:
|
|
2839
|
+
`"image"` \| `"video_second"` \| `"audio_second"` \| `"audio_character_block"`;
|
|
2840
|
+
`audio`: \| `Readonly`\<\{ `provider`: `"elevenlabs"`; `mode`: `"music"` \|
|
|
2841
|
+
`"speech"`; `voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`;
|
|
2842
|
+
\}\>[]; `defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{
|
|
2843
|
+
`min`: `number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2844
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `transform`: \| `Readonly`\<\{
|
|
2845
|
+
`operation`: `"remove_background"` \| `"upscale"`; `source`: `Readonly`\<\{
|
|
2846
|
+
`formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[]; `maxBytes`: `number`;
|
|
2847
|
+
`maxPixels`: `number`; \}\>; `defaultMegapixels`: `number` \| `null`;
|
|
2848
|
+
`milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{ `megapixels`:
|
|
2849
|
+
`number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; `video`: \|
|
|
2850
|
+
`Readonly`\<\{ `minSeconds`: `number`; `maxSeconds`: `number`; `defaultSeconds`:
|
|
2851
|
+
`number`; `durations`: readonly `number`[]; `formats`: readonly `Readonly`\<\{
|
|
2616
2852
|
`resolution`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`;
|
|
2617
2853
|
`aspectRatio`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"`
|
|
2618
2854
|
\| `"9:21"`; `width`: `number`; `height`: `number`; \}\>[]; `defaultResolution`:
|