@fungi.computer/darkroom 0.9.2 → 0.11.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 +130 -6
- package/dist/app-media-contracts.d.ts +104 -0
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +1 -0
- package/dist/cloudflare/provider.d.ts +5 -4
- package/dist/cloudflare/provider.js +20 -9
- package/dist/cloudflare/r2-destination.d.ts +50 -0
- package/dist/cloudflare/r2-destination.js +59 -0
- package/dist/cloudflare.d.ts +3 -2
- 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 +12 -2
- package/dist/index.js +81 -38
- package/dist/media-binding.d.ts +6 -0
- package/dist/media-content-type.d.ts +5 -0
- package/dist/media-content-type.js +49 -0
- package/dist/media-generation.js +2 -0
- package/dist/media-operation-contract.d.ts +13 -1
- package/dist/media-operation-do.d.ts +6 -0
- package/dist/media-operation-do.js +37 -2
- package/dist/media-operation-owner.d.ts +93 -5
- package/dist/media-operation-owner.js +250 -46
- package/dist/media-operation-storage.d.ts +18 -4
- package/dist/media-operation.js +30 -4
- 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/media-written.d.ts +22 -0
- package/dist/media-written.js +20 -0
- package/dist/model-catalog.d.ts +226 -0
- package/dist/model-catalog.js +254 -9
- package/dist/provenance.d.ts +5 -1
- package/dist/provenance.js +2 -1
- package/dist/reference-read.d.ts +24 -0
- package/dist/reference-read.js +26 -0
- package/dist/server.d.ts +58 -2
- package/dist/server.js +49 -5
- package/docs/api/app-media-contracts.md +49 -0
- package/docs/api/browser.md +15 -4
- package/docs/api/cloudflare.md +254 -5
- package/docs/api/index.md +346 -62
- package/docs/api/server.md +524 -66
- package/package.json +2 -2
package/docs/api/index.md
CHANGED
|
@@ -217,7 +217,9 @@ type MediaGenerationSettings = Readonly<{
|
|
|
217
217
|
width?: number;
|
|
218
218
|
height?: number;
|
|
219
219
|
steps?: number;
|
|
220
|
+
guidance?: number;
|
|
220
221
|
durationSeconds?: number;
|
|
222
|
+
targetMegapixels?: number;
|
|
221
223
|
voiceId?: string;
|
|
222
224
|
resolution?: MediaVideoResolution;
|
|
223
225
|
aspectRatio?: MediaVideoAspectRatio;
|
|
@@ -430,6 +432,7 @@ type MediaJsonBody = Readonly<{
|
|
|
430
432
|
height?: number;
|
|
431
433
|
steps?: number;
|
|
432
434
|
num_steps?: number;
|
|
435
|
+
guidance?: number;
|
|
433
436
|
}>;
|
|
434
437
|
```
|
|
435
438
|
|
|
@@ -654,6 +657,36 @@ Immutable audio capability and price metadata.
|
|
|
654
657
|
|
|
655
658
|
---
|
|
656
659
|
|
|
660
|
+
### MediaTransformOperation
|
|
661
|
+
|
|
662
|
+
```ts
|
|
663
|
+
type MediaTransformOperation = z.output<typeof mediaTransformOperationSchema>;
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
A source-image operation.
|
|
667
|
+
|
|
668
|
+
---
|
|
669
|
+
|
|
670
|
+
### MediaTransform
|
|
671
|
+
|
|
672
|
+
```ts
|
|
673
|
+
type MediaTransform = z.output<typeof mediaTransformSchema>;
|
|
674
|
+
```
|
|
675
|
+
|
|
676
|
+
Immutable source-image operation facts.
|
|
677
|
+
|
|
678
|
+
---
|
|
679
|
+
|
|
680
|
+
### MediaBillingUnit
|
|
681
|
+
|
|
682
|
+
```ts
|
|
683
|
+
type MediaBillingUnit = z.output<typeof mediaBillingUnitSchema>;
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
The unit a model's generations are billed in.
|
|
687
|
+
|
|
688
|
+
---
|
|
689
|
+
|
|
657
690
|
### MediaModelInput
|
|
658
691
|
|
|
659
692
|
```ts
|
|
@@ -821,7 +854,9 @@ const mediaGenerationSettingsSchema: ZodObject<
|
|
|
821
854
|
width: ZodOptional<ZodNumber>;
|
|
822
855
|
height: ZodOptional<ZodNumber>;
|
|
823
856
|
steps: ZodOptional<ZodNumber>;
|
|
857
|
+
guidance: ZodOptional<ZodNumber>;
|
|
824
858
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
859
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
825
860
|
voiceId: ZodOptional<ZodString>;
|
|
826
861
|
resolution: ZodOptional<
|
|
827
862
|
ZodEnum<{
|
|
@@ -892,7 +927,9 @@ const mediaGenerationSelectionSchema: ZodObject<
|
|
|
892
927
|
width: ZodOptional<ZodNumber>;
|
|
893
928
|
height: ZodOptional<ZodNumber>;
|
|
894
929
|
steps: ZodOptional<ZodNumber>;
|
|
930
|
+
guidance: ZodOptional<ZodNumber>;
|
|
895
931
|
durationSeconds: ZodOptional<ZodNumber>;
|
|
932
|
+
targetMegapixels: ZodOptional<ZodNumber>;
|
|
896
933
|
voiceId: ZodOptional<ZodString>;
|
|
897
934
|
resolution: ZodOptional<
|
|
898
935
|
ZodEnum<{
|
|
@@ -1168,6 +1205,20 @@ const mediaModelInputSchema: ZodLazy<
|
|
|
1168
1205
|
}>;
|
|
1169
1206
|
maxSteps: ZodNullable<ZodNumber>;
|
|
1170
1207
|
defaultSteps: ZodNullable<ZodNumber>;
|
|
1208
|
+
guidance: ZodDefault<
|
|
1209
|
+
ZodNullable<
|
|
1210
|
+
ZodReadonly<
|
|
1211
|
+
ZodObject<
|
|
1212
|
+
{
|
|
1213
|
+
min: ZodNumber;
|
|
1214
|
+
max: ZodNumber;
|
|
1215
|
+
default: ZodNumber;
|
|
1216
|
+
},
|
|
1217
|
+
$strict
|
|
1218
|
+
>
|
|
1219
|
+
>
|
|
1220
|
+
>
|
|
1221
|
+
>;
|
|
1171
1222
|
referenceField: ZodNullable<ZodString>;
|
|
1172
1223
|
maxReferences: ZodNumber;
|
|
1173
1224
|
referenceDimension: ZodNullable<ZodNumber>;
|
|
@@ -1484,6 +1535,70 @@ Structural ceiling for any prompt on the wire. Each model's own
|
|
|
1484
1535
|
|
|
1485
1536
|
---
|
|
1486
1537
|
|
|
1538
|
+
### mediaTransformOperationSchema
|
|
1539
|
+
|
|
1540
|
+
```ts
|
|
1541
|
+
const mediaTransformOperationSchema: ZodEnum<{
|
|
1542
|
+
remove_background: "remove_background";
|
|
1543
|
+
upscale: "upscale";
|
|
1544
|
+
}>;
|
|
1545
|
+
```
|
|
1546
|
+
|
|
1547
|
+
What a source-image operation does to its one reference image. Both write a new
|
|
1548
|
+
image and never touch the source.
|
|
1549
|
+
|
|
1550
|
+
---
|
|
1551
|
+
|
|
1552
|
+
### mediaTransformSchema
|
|
1553
|
+
|
|
1554
|
+
```ts
|
|
1555
|
+
const mediaTransformSchema: ZodLazy<ZodReadonly<ZodObject<{
|
|
1556
|
+
operation: ZodEnum<{
|
|
1557
|
+
remove_background: "remove_background";
|
|
1558
|
+
upscale: "upscale";
|
|
1559
|
+
}>;
|
|
1560
|
+
source: ZodReadonly<ZodObject<{
|
|
1561
|
+
formats: ZodReadonly<ZodArray<ZodEnum<{
|
|
1562
|
+
png: ...;
|
|
1563
|
+
jpeg: ...;
|
|
1564
|
+
webp: ...;
|
|
1565
|
+
}>>>;
|
|
1566
|
+
maxBytes: ZodNumber;
|
|
1567
|
+
maxPixels: ZodNumber;
|
|
1568
|
+
}, $strict>>;
|
|
1569
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1570
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1571
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<ZodObject<{
|
|
1572
|
+
megapixels: ZodNumber;
|
|
1573
|
+
milliunits: ZodNumber;
|
|
1574
|
+
}, $strict>>>>;
|
|
1575
|
+
}, $strict>>>;
|
|
1576
|
+
```
|
|
1577
|
+
|
|
1578
|
+
Facts of a catalog entry that edits one source image rather than generating from
|
|
1579
|
+
a prompt. The source limits are Botanical's own conservative bounds, not
|
|
1580
|
+
Cloudflare's: neither model page publishes an input size limit.
|
|
1581
|
+
|
|
1582
|
+
---
|
|
1583
|
+
|
|
1584
|
+
### mediaBillingUnitSchema
|
|
1585
|
+
|
|
1586
|
+
```ts
|
|
1587
|
+
const mediaBillingUnitSchema: ZodEnum<{
|
|
1588
|
+
image: "image";
|
|
1589
|
+
video_second: "video_second";
|
|
1590
|
+
audio_second: "audio_second";
|
|
1591
|
+
audio_character_block: "audio_character_block";
|
|
1592
|
+
}>;
|
|
1593
|
+
```
|
|
1594
|
+
|
|
1595
|
+
What one generation bills: whole images, whole seconds of video or music, or
|
|
1596
|
+
blocks of [AUDIO\_CHARACTER\_BLOCK](#audio_character_block) speech characters
|
|
1597
|
+
(so a per-character provider rate is marked up once per block, not rounded up
|
|
1598
|
+
per character).
|
|
1599
|
+
|
|
1600
|
+
---
|
|
1601
|
+
|
|
1487
1602
|
### mediaModelSchema
|
|
1488
1603
|
|
|
1489
1604
|
```ts
|
|
@@ -1527,6 +1642,7 @@ const mediaModelSchema: ZodReadonly<ZodObject<{
|
|
|
1527
1642
|
}>;
|
|
1528
1643
|
maxSteps: ZodNullable<ZodNumber>;
|
|
1529
1644
|
defaultSteps: ZodNullable<ZodNumber>;
|
|
1645
|
+
guidance: ZodDefault<ZodNullable<ZodReadonly<ZodObject<..., ...>>>>;
|
|
1530
1646
|
referenceField: ZodNullable<ZodString>;
|
|
1531
1647
|
maxReferences: ZodNumber;
|
|
1532
1648
|
referenceDimension: ZodNullable<ZodNumber>;
|
|
@@ -1582,6 +1698,26 @@ const mediaModelSchema: ZodReadonly<ZodObject<{
|
|
|
1582
1698
|
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1583
1699
|
milliunitsPerUnit: ZodNumber;
|
|
1584
1700
|
}, $strict>>>>;
|
|
1701
|
+
billingUnit: ZodEnum<{
|
|
1702
|
+
image: "image";
|
|
1703
|
+
video_second: "video_second";
|
|
1704
|
+
audio_second: "audio_second";
|
|
1705
|
+
audio_character_block: "audio_character_block";
|
|
1706
|
+
}>;
|
|
1707
|
+
transform: ZodNullable<ZodLazy<ZodReadonly<ZodObject<{
|
|
1708
|
+
operation: ZodEnum<{
|
|
1709
|
+
remove_background: "remove_background";
|
|
1710
|
+
upscale: "upscale";
|
|
1711
|
+
}>;
|
|
1712
|
+
source: ZodReadonly<ZodObject<{
|
|
1713
|
+
formats: ...;
|
|
1714
|
+
maxBytes: ...;
|
|
1715
|
+
maxPixels: ...;
|
|
1716
|
+
}, $strict>>;
|
|
1717
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1718
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1719
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<...>>>;
|
|
1720
|
+
}, $strict>>>>;
|
|
1585
1721
|
}, $strict>>;
|
|
1586
1722
|
```
|
|
1587
1723
|
|
|
@@ -1642,6 +1778,7 @@ const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
|
1642
1778
|
}>;
|
|
1643
1779
|
maxSteps: ZodNullable<ZodNumber>;
|
|
1644
1780
|
defaultSteps: ZodNullable<ZodNumber>;
|
|
1781
|
+
guidance: ZodDefault<ZodNullable<ZodReadonly<ZodObject<..., ...>>>>;
|
|
1645
1782
|
referenceField: ZodNullable<ZodString>;
|
|
1646
1783
|
maxReferences: ZodNumber;
|
|
1647
1784
|
referenceDimension: ZodNullable<ZodNumber>;
|
|
@@ -1651,6 +1788,12 @@ const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
|
1651
1788
|
}>;
|
|
1652
1789
|
}, $strict>>>;
|
|
1653
1790
|
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1791
|
+
billingUnit: ZodOptional<ZodEnum<{
|
|
1792
|
+
image: "image";
|
|
1793
|
+
video_second: "video_second";
|
|
1794
|
+
audio_second: "audio_second";
|
|
1795
|
+
audio_character_block: "audio_character_block";
|
|
1796
|
+
}>>;
|
|
1654
1797
|
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1655
1798
|
provider: ZodLiteral<"elevenlabs">;
|
|
1656
1799
|
mode: ZodEnum<{
|
|
@@ -1662,6 +1805,20 @@ const mediaCatalogueModelSchema: ZodReadonly<ZodObject<{
|
|
|
1662
1805
|
seconds: ZodNullable<ZodReadonly<ZodObject<..., ...>>>;
|
|
1663
1806
|
milliunitsPerUnit: ZodNumber;
|
|
1664
1807
|
}, $strict>>>>;
|
|
1808
|
+
transform: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1809
|
+
operation: ZodEnum<{
|
|
1810
|
+
remove_background: "remove_background";
|
|
1811
|
+
upscale: "upscale";
|
|
1812
|
+
}>;
|
|
1813
|
+
source: ZodReadonly<ZodObject<{
|
|
1814
|
+
formats: ...;
|
|
1815
|
+
maxBytes: ...;
|
|
1816
|
+
maxPixels: ...;
|
|
1817
|
+
}, $strict>>;
|
|
1818
|
+
defaultMegapixels: ZodNullable<ZodNumber>;
|
|
1819
|
+
milliunits: ZodNullable<ZodNumber>;
|
|
1820
|
+
sizes: ZodReadonly<ZodArray<ZodReadonly<...>>>;
|
|
1821
|
+
}, $strict>>>>;
|
|
1665
1822
|
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1666
1823
|
minSeconds: ZodNumber;
|
|
1667
1824
|
maxSeconds: ZodNumber;
|
|
@@ -1760,6 +1917,7 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1760
1917
|
}>;
|
|
1761
1918
|
maxSteps: ZodNullable<ZodNumber>;
|
|
1762
1919
|
defaultSteps: ZodNullable<ZodNumber>;
|
|
1920
|
+
guidance: ZodDefault<ZodNullable<...>>;
|
|
1763
1921
|
referenceField: ZodNullable<ZodString>;
|
|
1764
1922
|
maxReferences: ZodNumber;
|
|
1765
1923
|
referenceDimension: ZodNullable<ZodNumber>;
|
|
@@ -1769,6 +1927,12 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1769
1927
|
}>;
|
|
1770
1928
|
}, $strict>>>;
|
|
1771
1929
|
sizes: ZodNullable<ZodReadonly<ZodArray<ZodString>>>;
|
|
1930
|
+
billingUnit: ZodOptional<ZodEnum<{
|
|
1931
|
+
image: "image";
|
|
1932
|
+
video_second: "video_second";
|
|
1933
|
+
audio_second: "audio_second";
|
|
1934
|
+
audio_character_block: "audio_character_block";
|
|
1935
|
+
}>>;
|
|
1772
1936
|
audio: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1773
1937
|
provider: ZodLiteral<...>;
|
|
1774
1938
|
mode: ZodEnum<...>;
|
|
@@ -1777,6 +1941,13 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1777
1941
|
seconds: ZodNullable<...>;
|
|
1778
1942
|
milliunitsPerUnit: ZodNumber;
|
|
1779
1943
|
}, $strict>>>>;
|
|
1944
|
+
transform: ZodDefault<ZodNullable<ZodReadonly<ZodObject<{
|
|
1945
|
+
operation: ZodEnum<...>;
|
|
1946
|
+
source: ZodReadonly<...>;
|
|
1947
|
+
defaultMegapixels: ZodNullable<...>;
|
|
1948
|
+
milliunits: ZodNullable<...>;
|
|
1949
|
+
sizes: ZodReadonly<...>;
|
|
1950
|
+
}, $strict>>>>;
|
|
1780
1951
|
video: ZodNullable<ZodReadonly<ZodObject<{
|
|
1781
1952
|
minSeconds: ZodNumber;
|
|
1782
1953
|
maxSeconds: ZodNumber;
|
|
@@ -1830,12 +2001,19 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1830
2001
|
steps: "steps" | "num_steps" | "fixed";
|
|
1831
2002
|
maxSteps: number | null;
|
|
1832
2003
|
defaultSteps: number | null;
|
|
2004
|
+
guidance: | Readonly<{
|
|
2005
|
+
min: number;
|
|
2006
|
+
max: number;
|
|
2007
|
+
default: number;
|
|
2008
|
+
}>
|
|
2009
|
+
| null;
|
|
1833
2010
|
referenceField: string | null;
|
|
1834
2011
|
maxReferences: number;
|
|
1835
2012
|
referenceDimension: number | null;
|
|
1836
2013
|
referenceFormat: "png" | "webp";
|
|
1837
2014
|
}>;
|
|
1838
2015
|
sizes: readonly string[] | null;
|
|
2016
|
+
billingUnit?: "image" | "video_second" | "audio_second" | "audio_character_block";
|
|
1839
2017
|
audio: | Readonly<{
|
|
1840
2018
|
provider: "elevenlabs";
|
|
1841
2019
|
mode: "music" | "speech";
|
|
@@ -1853,6 +2031,21 @@ const mediaCatalogueSchema: ZodPipe<ZodArray<ZodReadonly<ZodObject<{
|
|
|
1853
2031
|
milliunitsPerUnit: number;
|
|
1854
2032
|
}>
|
|
1855
2033
|
| null;
|
|
2034
|
+
transform: | Readonly<{
|
|
2035
|
+
operation: "remove_background" | "upscale";
|
|
2036
|
+
source: Readonly<{
|
|
2037
|
+
formats: readonly ...[];
|
|
2038
|
+
maxBytes: number;
|
|
2039
|
+
maxPixels: number;
|
|
2040
|
+
}>;
|
|
2041
|
+
defaultMegapixels: number | null;
|
|
2042
|
+
milliunits: number | null;
|
|
2043
|
+
sizes: readonly Readonly<{
|
|
2044
|
+
megapixels: ...;
|
|
2045
|
+
milliunits: ...;
|
|
2046
|
+
}>[];
|
|
2047
|
+
}>
|
|
2048
|
+
| null;
|
|
1856
2049
|
video: | Readonly<{
|
|
1857
2050
|
minSeconds: number;
|
|
1858
2051
|
maxSeconds: number;
|
|
@@ -1963,20 +2156,22 @@ again.
|
|
|
1963
2156
|
|
|
1964
2157
|
#### Returns
|
|
1965
2158
|
|
|
1966
|
-
| Name
|
|
1967
|
-
|
|
|
1968
|
-
| `model`
|
|
1969
|
-
| `prompt`
|
|
1970
|
-
| `width?`
|
|
1971
|
-
| `height?`
|
|
1972
|
-
| `steps?`
|
|
1973
|
-
| `
|
|
1974
|
-
| `
|
|
1975
|
-
| `
|
|
1976
|
-
| `
|
|
1977
|
-
| `
|
|
1978
|
-
| `
|
|
1979
|
-
| `
|
|
2159
|
+
| Name | Type | Description |
|
|
2160
|
+
| ------------------- | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------- |
|
|
2161
|
+
| `model` | `string` | Provider catalog model identifier. |
|
|
2162
|
+
| `prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2163
|
+
| `width?` | `number` | Requested image width or nominal video selector; absent for audio. |
|
|
2164
|
+
| `height?` | `number` | Requested image height or nominal video selector; absent for audio. |
|
|
2165
|
+
| `steps?` | `number` | Model-specific inference step count. |
|
|
2166
|
+
| `guidance?` | `number` | Prompt guidance; models without a catalog guidance range refuse it. |
|
|
2167
|
+
| `durationSeconds?` | `number` | Requested video or music length in whole seconds. |
|
|
2168
|
+
| `targetMegapixels?` | `number` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2169
|
+
| `voiceId?` | `string` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2170
|
+
| `resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
2171
|
+
| `aspectRatio?` | `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"` | Video aspect; must match the nominal width/height selector. |
|
|
2172
|
+
| `generateAudio?` | `boolean` | Video audio selection. |
|
|
2173
|
+
| `references?` | `object`[] | Host-authorized reference images. |
|
|
2174
|
+
| `audioReferences?` | `object`[] | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
1980
2175
|
|
|
1981
2176
|
---
|
|
1982
2177
|
|
|
@@ -1994,22 +2189,24 @@ Validate caller settings against `catalogue`, the active provider's model list
|
|
|
1994
2189
|
|
|
1995
2190
|
#### Parameters
|
|
1996
2191
|
|
|
1997
|
-
| Parameter
|
|
1998
|
-
|
|
|
1999
|
-
| `raw`
|
|
2000
|
-
| `raw.model`
|
|
2001
|
-
| `raw.prompt`
|
|
2002
|
-
| `raw.width?`
|
|
2003
|
-
| `raw.height?`
|
|
2004
|
-
| `raw.steps?`
|
|
2005
|
-
| `raw.
|
|
2006
|
-
| `raw.
|
|
2007
|
-
| `raw.
|
|
2008
|
-
| `raw.
|
|
2009
|
-
| `raw.
|
|
2010
|
-
| `raw.
|
|
2011
|
-
| `raw.
|
|
2012
|
-
| `
|
|
2192
|
+
| Parameter | Type | Default value | Description |
|
|
2193
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------------- |
|
|
2194
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `guidance?`: `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` | - |
|
|
2195
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2196
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2197
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2198
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2199
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2200
|
+
| `raw.guidance?` | `number` | `...` | Prompt guidance; models without a catalog guidance range refuse it. |
|
|
2201
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2202
|
+
| `raw.targetMegapixels?` | `number` | `...` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2203
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2204
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2205
|
+
| `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. |
|
|
2206
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2207
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2208
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips; only a model declaring `audioReferences` takes them. |
|
|
2209
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
2013
2210
|
|
|
2014
2211
|
#### Returns
|
|
2015
2212
|
|
|
@@ -2032,22 +2229,24 @@ Validate selections without granting Computer authority.
|
|
|
2032
2229
|
|
|
2033
2230
|
#### Parameters
|
|
2034
2231
|
|
|
2035
|
-
| Parameter
|
|
2036
|
-
|
|
|
2037
|
-
| `raw`
|
|
2038
|
-
| `raw.model`
|
|
2039
|
-
| `raw.prompt`
|
|
2040
|
-
| `raw.width?`
|
|
2041
|
-
| `raw.height?`
|
|
2042
|
-
| `raw.steps?`
|
|
2043
|
-
| `raw.
|
|
2044
|
-
| `raw.
|
|
2045
|
-
| `raw.
|
|
2046
|
-
| `raw.
|
|
2047
|
-
| `raw.
|
|
2048
|
-
| `raw.
|
|
2049
|
-
| `raw.
|
|
2050
|
-
| `
|
|
2232
|
+
| Parameter | Type | Default value | Description |
|
|
2233
|
+
| ----------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------------------------------------------------------------------------- |
|
|
2234
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width?`: `number`; `height?`: `number`; `steps?`: `number`; `guidance?`: `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` | - |
|
|
2235
|
+
| `raw.model` | `string` | `...` | Provider catalog model identifier. |
|
|
2236
|
+
| `raw.prompt` | `string` | `...` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2237
|
+
| `raw.width?` | `number` | `...` | Requested image width or nominal video selector; absent for audio. |
|
|
2238
|
+
| `raw.height?` | `number` | `...` | Requested image height or nominal video selector; absent for audio. |
|
|
2239
|
+
| `raw.steps?` | `number` | `...` | Model-specific inference step count. |
|
|
2240
|
+
| `raw.guidance?` | `number` | `...` | Prompt guidance; models without a catalog guidance range refuse it. |
|
|
2241
|
+
| `raw.durationSeconds?` | `number` | `...` | Requested video or music length in whole seconds. |
|
|
2242
|
+
| `raw.targetMegapixels?` | `number` | `...` | Upscale only: the output size in megapixels, one of the model's offered sizes. |
|
|
2243
|
+
| `raw.voiceId?` | `string` | `...` | Speech models only: a premade voice from the catalog; the default when omitted. |
|
|
2244
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | `...` | Video resolution; must match the nominal width/height selector. |
|
|
2245
|
+
| `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. |
|
|
2246
|
+
| `raw.generateAudio?` | `boolean` | `...` | Video audio selection. |
|
|
2247
|
+
| `raw.references?` | `object`[] | `...` | Host-authorized reference images. |
|
|
2248
|
+
| `raw.audioReferences?` | `object`[] | `...` | Host-authorized reference audio clips. |
|
|
2249
|
+
| `catalogue` | [`MediaCatalogue`](#mediacatalogue) | `mediaModels` | - |
|
|
2051
2250
|
|
|
2052
2251
|
#### Returns
|
|
2053
2252
|
|
|
@@ -2281,6 +2480,11 @@ function listMediaModels(): readonly Readonly<{
|
|
|
2281
2480
|
steps: "steps" | "num_steps" | "fixed";
|
|
2282
2481
|
maxSteps: number | null;
|
|
2283
2482
|
defaultSteps: number | null;
|
|
2483
|
+
guidance: Readonly<{
|
|
2484
|
+
min: number;
|
|
2485
|
+
max: number;
|
|
2486
|
+
default: number;
|
|
2487
|
+
}> | null;
|
|
2284
2488
|
referenceField: string | null;
|
|
2285
2489
|
maxReferences: number;
|
|
2286
2490
|
referenceDimension: number | null;
|
|
@@ -2334,6 +2538,22 @@ function listMediaModels(): readonly Readonly<{
|
|
|
2334
2538
|
}> | null;
|
|
2335
2539
|
milliunitsPerUnit: number;
|
|
2336
2540
|
}> | null;
|
|
2541
|
+
billingUnit:
|
|
2542
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2543
|
+
transform: Readonly<{
|
|
2544
|
+
operation: "remove_background" | "upscale";
|
|
2545
|
+
source: Readonly<{
|
|
2546
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2547
|
+
maxBytes: number;
|
|
2548
|
+
maxPixels: number;
|
|
2549
|
+
}>;
|
|
2550
|
+
defaultMegapixels: number | null;
|
|
2551
|
+
milliunits: number | null;
|
|
2552
|
+
sizes: readonly Readonly<{
|
|
2553
|
+
megapixels: number;
|
|
2554
|
+
milliunits: number;
|
|
2555
|
+
}>[];
|
|
2556
|
+
}> | null;
|
|
2337
2557
|
}>[];
|
|
2338
2558
|
```
|
|
2339
2559
|
|
|
@@ -2348,8 +2568,9 @@ readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; `kind`: `"image"` \|
|
|
|
2348
2568
|
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
2349
2569
|
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
2350
2570
|
`defaultHeight`: `number`; `steps`: `"steps"` \| `"num_steps"` \| `"fixed"`;
|
|
2351
|
-
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`;
|
|
2352
|
-
`
|
|
2571
|
+
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`; `guidance`:
|
|
2572
|
+
\| `Readonly`\<\{ `min`: `number`; `max`: `number`; `default`: `number`; \}\> \|
|
|
2573
|
+
`null`; `referenceField`: `string` \| `null`; `maxReferences`: `number`;
|
|
2353
2574
|
`referenceDimension`: `number` \| `null`; `referenceFormat`: `"png"` \|
|
|
2354
2575
|
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `video`: \|
|
|
2355
2576
|
`Readonly`\<\{ `minSeconds`: `number`; `maxSeconds`: `number`; `defaultSeconds`:
|
|
@@ -2372,7 +2593,13 @@ readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
|
2372
2593
|
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2373
2594
|
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2374
2595
|
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2375
|
-
`milliunitsPerUnit`: `number`; \}\> \| `null`;
|
|
2596
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `billingUnit`: `"image"` \|
|
|
2597
|
+
`"video_second"` \| `"audio_second"` \| `"audio_character_block"`; `transform`:
|
|
2598
|
+
\| `Readonly`\<\{ `operation`: `"remove_background"` \| `"upscale"`; `source`:
|
|
2599
|
+
`Readonly`\<\{ `formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2600
|
+
`maxBytes`: `number`; `maxPixels`: `number`; \}\>; `defaultMegapixels`: `number`
|
|
2601
|
+
\| `null`; `milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{
|
|
2602
|
+
`megapixels`: `number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; \}\>[]
|
|
2376
2603
|
|
|
2377
2604
|
---
|
|
2378
2605
|
|
|
@@ -2397,6 +2624,11 @@ function getGatewayModel(id):
|
|
|
2397
2624
|
steps: "steps" | "num_steps" | "fixed";
|
|
2398
2625
|
maxSteps: number | null;
|
|
2399
2626
|
defaultSteps: number | null;
|
|
2627
|
+
guidance: Readonly<{
|
|
2628
|
+
min: number;
|
|
2629
|
+
max: number;
|
|
2630
|
+
default: number;
|
|
2631
|
+
}> | null;
|
|
2400
2632
|
referenceField: string | null;
|
|
2401
2633
|
maxReferences: number;
|
|
2402
2634
|
referenceDimension: number | null;
|
|
@@ -2451,6 +2683,22 @@ function getGatewayModel(id):
|
|
|
2451
2683
|
}> | null;
|
|
2452
2684
|
milliunitsPerUnit: number;
|
|
2453
2685
|
}> | null;
|
|
2686
|
+
billingUnit:
|
|
2687
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2688
|
+
transform: Readonly<{
|
|
2689
|
+
operation: "remove_background" | "upscale";
|
|
2690
|
+
source: Readonly<{
|
|
2691
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2692
|
+
maxBytes: number;
|
|
2693
|
+
maxPixels: number;
|
|
2694
|
+
}>;
|
|
2695
|
+
defaultMegapixels: number | null;
|
|
2696
|
+
milliunits: number | null;
|
|
2697
|
+
sizes: readonly Readonly<{
|
|
2698
|
+
megapixels: number;
|
|
2699
|
+
milliunits: number;
|
|
2700
|
+
}>[];
|
|
2701
|
+
}> | null;
|
|
2454
2702
|
}>
|
|
2455
2703
|
| undefined;
|
|
2456
2704
|
```
|
|
@@ -2473,8 +2721,9 @@ sees a custom provider's models.
|
|
|
2473
2721
|
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
2474
2722
|
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
2475
2723
|
`defaultHeight`: `number`; `steps`: `"steps"` \| `"num_steps"` \| `"fixed"`;
|
|
2476
|
-
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`;
|
|
2477
|
-
`
|
|
2724
|
+
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`; `guidance`:
|
|
2725
|
+
\| `Readonly`\<\{ `min`: `number`; `max`: `number`; `default`: `number`; \}\> \|
|
|
2726
|
+
`null`; `referenceField`: `string` \| `null`; `maxReferences`: `number`;
|
|
2478
2727
|
`referenceDimension`: `number` \| `null`; `referenceFormat`: `"png"` \|
|
|
2479
2728
|
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `video`: \|
|
|
2480
2729
|
`Readonly`\<\{ `minSeconds`: `number`; `maxSeconds`: `number`; `defaultSeconds`:
|
|
@@ -2497,7 +2746,14 @@ readonly (`"first-frame"` \| `"last-frame"` \| `"reference"`)[];
|
|
|
2497
2746
|
`voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`; \}\>[];
|
|
2498
2747
|
`defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{ `min`:
|
|
2499
2748
|
`number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2500
|
-
`milliunitsPerUnit`: `number`; \}\> \| `null`;
|
|
2749
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `billingUnit`: `"image"` \|
|
|
2750
|
+
`"video_second"` \| `"audio_second"` \| `"audio_character_block"`; `transform`:
|
|
2751
|
+
\| `Readonly`\<\{ `operation`: `"remove_background"` \| `"upscale"`; `source`:
|
|
2752
|
+
`Readonly`\<\{ `formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[];
|
|
2753
|
+
`maxBytes`: `number`; `maxPixels`: `number`; \}\>; `defaultMegapixels`: `number`
|
|
2754
|
+
\| `null`; `milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{
|
|
2755
|
+
`megapixels`: `number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; \}\> \|
|
|
2756
|
+
`undefined`
|
|
2501
2757
|
|
|
2502
2758
|
---
|
|
2503
2759
|
|
|
@@ -2525,12 +2781,19 @@ function getMediaModel(
|
|
|
2525
2781
|
steps: "steps" | "num_steps" | "fixed";
|
|
2526
2782
|
maxSteps: number | null;
|
|
2527
2783
|
defaultSteps: number | null;
|
|
2784
|
+
guidance: Readonly<{
|
|
2785
|
+
min: number;
|
|
2786
|
+
max: number;
|
|
2787
|
+
default: number;
|
|
2788
|
+
}> | null;
|
|
2528
2789
|
referenceField: string | null;
|
|
2529
2790
|
maxReferences: number;
|
|
2530
2791
|
referenceDimension: number | null;
|
|
2531
2792
|
referenceFormat: "png" | "webp";
|
|
2532
2793
|
}>;
|
|
2533
2794
|
sizes: readonly string[] | null;
|
|
2795
|
+
billingUnit?:
|
|
2796
|
+
"image" | "video_second" | "audio_second" | "audio_character_block";
|
|
2534
2797
|
audio: Readonly<{
|
|
2535
2798
|
provider: "elevenlabs";
|
|
2536
2799
|
mode: "music" | "speech";
|
|
@@ -2546,6 +2809,20 @@ function getMediaModel(
|
|
|
2546
2809
|
}> | null;
|
|
2547
2810
|
milliunitsPerUnit: number;
|
|
2548
2811
|
}> | null;
|
|
2812
|
+
transform: Readonly<{
|
|
2813
|
+
operation: "remove_background" | "upscale";
|
|
2814
|
+
source: Readonly<{
|
|
2815
|
+
formats: readonly ("png" | "jpeg" | "webp")[];
|
|
2816
|
+
maxBytes: number;
|
|
2817
|
+
maxPixels: number;
|
|
2818
|
+
}>;
|
|
2819
|
+
defaultMegapixels: number | null;
|
|
2820
|
+
milliunits: number | null;
|
|
2821
|
+
sizes: readonly Readonly<{
|
|
2822
|
+
megapixels: number;
|
|
2823
|
+
milliunits: number;
|
|
2824
|
+
}>[];
|
|
2825
|
+
}> | null;
|
|
2549
2826
|
video: Readonly<{
|
|
2550
2827
|
minSeconds: number;
|
|
2551
2828
|
maxSeconds: number;
|
|
@@ -2602,17 +2879,24 @@ absent.
|
|
|
2602
2879
|
`"multipart"`; `dimensions`: `"none"` \| `"own"`; `maxDimension`: `number` \|
|
|
2603
2880
|
`null`; `maxDimensionDocumented`: `boolean`; `defaultWidth`: `number`;
|
|
2604
2881
|
`defaultHeight`: `number`; `steps`: `"steps"` \| `"num_steps"` \| `"fixed"`;
|
|
2605
|
-
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`;
|
|
2606
|
-
`
|
|
2882
|
+
`maxSteps`: `number` \| `null`; `defaultSteps`: `number` \| `null`; `guidance`:
|
|
2883
|
+
\| `Readonly`\<\{ `min`: `number`; `max`: `number`; `default`: `number`; \}\> \|
|
|
2884
|
+
`null`; `referenceField`: `string` \| `null`; `maxReferences`: `number`;
|
|
2607
2885
|
`referenceDimension`: `number` \| `null`; `referenceFormat`: `"png"` \|
|
|
2608
|
-
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `
|
|
2609
|
-
`
|
|
2610
|
-
`
|
|
2611
|
-
`
|
|
2612
|
-
|
|
2613
|
-
`
|
|
2614
|
-
`
|
|
2615
|
-
`
|
|
2886
|
+
`"webp"`; \}\>; `sizes`: readonly `string`[] \| `null`; `billingUnit?`:
|
|
2887
|
+
`"image"` \| `"video_second"` \| `"audio_second"` \| `"audio_character_block"`;
|
|
2888
|
+
`audio`: \| `Readonly`\<\{ `provider`: `"elevenlabs"`; `mode`: `"music"` \|
|
|
2889
|
+
`"speech"`; `voices`: readonly `Readonly`\<\{ `id`: `string`; `label`: `string`;
|
|
2890
|
+
\}\>[]; `defaultVoiceId`: `string` \| `null`; `seconds`: \| `Readonly`\<\{
|
|
2891
|
+
`min`: `number`; `max`: `number`; `default`: `number`; \}\> \| `null`;
|
|
2892
|
+
`milliunitsPerUnit`: `number`; \}\> \| `null`; `transform`: \| `Readonly`\<\{
|
|
2893
|
+
`operation`: `"remove_background"` \| `"upscale"`; `source`: `Readonly`\<\{
|
|
2894
|
+
`formats`: readonly (`"png"` \| `"jpeg"` \| `"webp"`)[]; `maxBytes`: `number`;
|
|
2895
|
+
`maxPixels`: `number`; \}\>; `defaultMegapixels`: `number` \| `null`;
|
|
2896
|
+
`milliunits`: `number` \| `null`; `sizes`: readonly `Readonly`\<\{ `megapixels`:
|
|
2897
|
+
`number`; `milliunits`: `number`; \}\>[]; \}\> \| `null`; `video`: \|
|
|
2898
|
+
`Readonly`\<\{ `minSeconds`: `number`; `maxSeconds`: `number`; `defaultSeconds`:
|
|
2899
|
+
`number`; `durations`: readonly `number`[]; `formats`: readonly `Readonly`\<\{
|
|
2616
2900
|
`resolution`: `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"`;
|
|
2617
2901
|
`aspectRatio`: `"16:9"` \| `"4:3"` \| `"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"`
|
|
2618
2902
|
\| `"9:21"`; `width`: `number`; `height`: `number`; \}\>[]; `defaultResolution`:
|