@fungi.computer/darkroom 0.5.12 → 0.7.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 +129 -0
- package/dist/app-media-contracts.d.ts +4 -0
- package/dist/browser-failure.d.ts +2 -0
- package/dist/browser-failure.js +2 -0
- package/dist/cloudflare/provider.js +3 -3
- 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 +8 -2
- package/dist/gateway-models.js +35 -10
- package/dist/gateway-wire.d.ts +1 -0
- package/dist/gateway-wire.js +2 -0
- package/dist/index.d.ts +50 -12
- package/dist/index.js +33 -23
- package/dist/media-binding.d.ts +3 -0
- package/dist/media-binding.js +3 -3
- package/dist/media-generation.js +9 -5
- package/dist/media-operation-contract.d.ts +3 -1
- package/dist/media-operation-do.d.ts +13 -2
- package/dist/media-operation-do.js +26 -1
- package/dist/media-operation-owner.d.ts +8 -0
- package/dist/media-operation-owner.js +8 -5
- package/dist/media-operation.js +2 -2
- package/dist/media-quote.d.ts +14 -0
- package/dist/media-quote.js +17 -0
- package/dist/model-catalog.d.ts +438 -5
- package/dist/model-catalog.js +232 -30
- package/dist/reference-image-size.d.ts +4 -3
- package/dist/reference-image-size.js +9 -9
- package/dist/server.d.ts +17 -1
- package/dist/server.js +44 -6
- package/docs/api/app-media-contracts.md +4 -0
- package/docs/api/browser.md +4 -2
- package/docs/api/cloudflare.md +53 -0
- package/docs/api/index.md +464 -55
- package/docs/api/server.md +214 -22
- package/package.json +2 -2
package/docs/api/server.md
CHANGED
|
@@ -10,6 +10,74 @@
|
|
|
10
10
|
|
|
11
11
|
## Classes
|
|
12
12
|
|
|
13
|
+
### DailyMediaMeter
|
|
14
|
+
|
|
15
|
+
A UTC-day total of admitted media cost, kept in one Durable Object's SQLite.
|
|
16
|
+
Every statement runs inside one synchronous transaction, so two concurrent
|
|
17
|
+
admits near the limit are serialized by the object and cannot both pass. Holds
|
|
18
|
+
are keyed by the durable operation id, so a retried admit never counts twice. A
|
|
19
|
+
hold that is never settled stays counted until its day ends.
|
|
20
|
+
|
|
21
|
+
#### Constructors
|
|
22
|
+
|
|
23
|
+
##### Constructor
|
|
24
|
+
|
|
25
|
+
```ts
|
|
26
|
+
new DailyMediaMeter(storage, now?): DailyMediaMeter;
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
###### Parameters
|
|
30
|
+
|
|
31
|
+
| Parameter | Type | Default value |
|
|
32
|
+
| --------- | --------------------------------------------------- | ------------- |
|
|
33
|
+
| `storage` | [`DailyMediaMeterStorage`](#dailymediameterstorage) | `undefined` |
|
|
34
|
+
| `now` | () => `number` | `Date.now` |
|
|
35
|
+
|
|
36
|
+
###### Returns
|
|
37
|
+
|
|
38
|
+
[`DailyMediaMeter`](#dailymediameter)
|
|
39
|
+
|
|
40
|
+
#### Methods
|
|
41
|
+
|
|
42
|
+
##### admit()
|
|
43
|
+
|
|
44
|
+
```ts
|
|
45
|
+
admit(input): boolean;
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
Hold `costMilliunits` for this operation unless the day's total would exceed the
|
|
49
|
+
limit.
|
|
50
|
+
|
|
51
|
+
###### Parameters
|
|
52
|
+
|
|
53
|
+
| Parameter | Type |
|
|
54
|
+
| --------- | ----------------------------------------------------------------------------------------------------- |
|
|
55
|
+
| `input` | `Readonly`\<\{ `operationId`: `string`; `costMilliunits`: `number`; `limitMilliunits`: `number`; \}\> |
|
|
56
|
+
|
|
57
|
+
###### Returns
|
|
58
|
+
|
|
59
|
+
`boolean`
|
|
60
|
+
|
|
61
|
+
##### settle()
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
settle(input): void;
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Keep the hold when media was delivered; release it when nothing was.
|
|
68
|
+
|
|
69
|
+
###### Parameters
|
|
70
|
+
|
|
71
|
+
| Parameter | Type |
|
|
72
|
+
| --------- | -------------------------------------------------------------------- |
|
|
73
|
+
| `input` | `Readonly`\<\{ `operationId`: `string`; `delivered`: `boolean`; \}\> |
|
|
74
|
+
|
|
75
|
+
###### Returns
|
|
76
|
+
|
|
77
|
+
`void`
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
13
81
|
### MediaExecutionError
|
|
14
82
|
|
|
15
83
|
A bounded stage marker for failures that cross the Media HTTP boundary.
|
|
@@ -802,6 +870,39 @@ Release preparation or refused admission so the same request can retry.
|
|
|
802
870
|
|
|
803
871
|
## Type Aliases
|
|
804
872
|
|
|
873
|
+
### DailyMediaMeterStorage
|
|
874
|
+
|
|
875
|
+
```ts
|
|
876
|
+
type DailyMediaMeterStorage = Readonly<{
|
|
877
|
+
sql: Readonly<{
|
|
878
|
+
exec: (
|
|
879
|
+
query,
|
|
880
|
+
...bindings
|
|
881
|
+
) => Readonly<{
|
|
882
|
+
toArray: () => readonly unknown[];
|
|
883
|
+
}>;
|
|
884
|
+
}>;
|
|
885
|
+
transactionSync: <T>(body) => T;
|
|
886
|
+
}>;
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
The Durable Object storage slice the meter owns tables in.
|
|
890
|
+
|
|
891
|
+
---
|
|
892
|
+
|
|
893
|
+
### DailyMediaMeterPort
|
|
894
|
+
|
|
895
|
+
```ts
|
|
896
|
+
type DailyMediaMeterPort = Readonly<{
|
|
897
|
+
dailyAdmit: (input) => Promise<boolean> | boolean;
|
|
898
|
+
dailySettle: (input) => Promise<void> | void;
|
|
899
|
+
}>;
|
|
900
|
+
```
|
|
901
|
+
|
|
902
|
+
RPC surface of the Durable Object that owns one Oyster's daily media total.
|
|
903
|
+
|
|
904
|
+
---
|
|
905
|
+
|
|
805
906
|
### MediaFailureStage
|
|
806
907
|
|
|
807
908
|
```ts
|
|
@@ -835,7 +936,8 @@ Private cause plus an independently decoded, safe provider diagnostic.
|
|
|
835
936
|
### MediaBillingRefusalCode
|
|
836
937
|
|
|
837
938
|
```ts
|
|
838
|
-
type MediaBillingRefusalCode =
|
|
939
|
+
type MediaBillingRefusalCode =
|
|
940
|
+
"insufficient_credits" | "denied" | "daily_limit_reached";
|
|
839
941
|
```
|
|
840
942
|
|
|
841
943
|
Why the host's billing owner refused to admit a new generation.
|
|
@@ -1086,6 +1188,7 @@ Retained output projection, or a terminal spent format refusal.
|
|
|
1086
1188
|
```ts
|
|
1087
1189
|
type MediaOperationHooks = Readonly<{
|
|
1088
1190
|
namespace?: () => string | null;
|
|
1191
|
+
catalogue?: () => MediaCatalogue;
|
|
1089
1192
|
}>;
|
|
1090
1193
|
```
|
|
1091
1194
|
|
|
@@ -1463,6 +1566,16 @@ Delete the owner-selected object key.
|
|
|
1463
1566
|
|
|
1464
1567
|
---
|
|
1465
1568
|
|
|
1569
|
+
### MediaQuote
|
|
1570
|
+
|
|
1571
|
+
```ts
|
|
1572
|
+
type MediaQuote = Readonly<MediaUnits & object>;
|
|
1573
|
+
```
|
|
1574
|
+
|
|
1575
|
+
The provider cost of one exact generation request, before any billing policy.
|
|
1576
|
+
|
|
1577
|
+
---
|
|
1578
|
+
|
|
1466
1579
|
### MediaScope
|
|
1467
1580
|
|
|
1468
1581
|
```ts
|
|
@@ -1505,6 +1618,14 @@ type MediaServiceHost = Readonly<{
|
|
|
1505
1618
|
readReference?: (reference, model) => Promise<MediaReferenceBytes>;
|
|
1506
1619
|
}>;
|
|
1507
1620
|
onFailure?: (error) => Response | undefined;
|
|
1621
|
+
}> &
|
|
1622
|
+
| Readonly<{
|
|
1623
|
+
catalogue?: undefined;
|
|
1624
|
+
estimate?: undefined;
|
|
1625
|
+
}>
|
|
1626
|
+
| Readonly<{
|
|
1627
|
+
catalogue: MediaCatalogue;
|
|
1628
|
+
estimate: (settings, references) => number;
|
|
1508
1629
|
}> &
|
|
1509
1630
|
| Readonly<{
|
|
1510
1631
|
metering: "unmetered";
|
|
@@ -1630,6 +1751,7 @@ const mediaVideoBindingInputSchema: ZodObject<{
|
|
|
1630
1751
|
libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
|
|
1631
1752
|
settings: ZodLazy<ZodObject<{
|
|
1632
1753
|
model: ZodEnum<{
|
|
1754
|
+
seedance25: "bytedance/seedance-2.5";
|
|
1633
1755
|
seedance: "bytedance/seedance-2.0";
|
|
1634
1756
|
seedanceFast: "bytedance/seedance-2.0-fast";
|
|
1635
1757
|
seedanceMini: "bytedance/seedance-2.0-mini";
|
|
@@ -1715,6 +1837,7 @@ const mediaBindingGenerationSchema: ZodDiscriminatedUnion<[ZodObject<{
|
|
|
1715
1837
|
libraryPath: ZodString & ZodType<string, string, $ZodTypeInternals<string, string>>;
|
|
1716
1838
|
settings: ZodLazy<ZodObject<{
|
|
1717
1839
|
model: ZodEnum<{
|
|
1840
|
+
seedance25: "bytedance/seedance-2.5";
|
|
1718
1841
|
seedance: "bytedance/seedance-2.0";
|
|
1719
1842
|
seedanceFast: "bytedance/seedance-2.0-fast";
|
|
1720
1843
|
seedanceMini: "bytedance/seedance-2.0-mini";
|
|
@@ -2019,19 +2142,41 @@ Quote the catalog defaults through the exact estimator used before dispatch.
|
|
|
2019
2142
|
|
|
2020
2143
|
---
|
|
2021
2144
|
|
|
2145
|
+
### createDailyMediaMetering()
|
|
2146
|
+
|
|
2147
|
+
```ts
|
|
2148
|
+
function createDailyMediaMetering(meter, limitMilliunits): MediaMetering;
|
|
2149
|
+
```
|
|
2150
|
+
|
|
2151
|
+
`MediaMetering` that enforces one exact daily limit through the owning object.
|
|
2152
|
+
|
|
2153
|
+
#### Parameters
|
|
2154
|
+
|
|
2155
|
+
| Parameter | Type |
|
|
2156
|
+
| ----------------- | --------------------------------------------- |
|
|
2157
|
+
| `meter` | [`DailyMediaMeterPort`](#dailymediameterport) |
|
|
2158
|
+
| `limitMilliunits` | `number` |
|
|
2159
|
+
|
|
2160
|
+
#### Returns
|
|
2161
|
+
|
|
2162
|
+
[`MediaMetering`](#mediametering)
|
|
2163
|
+
|
|
2164
|
+
---
|
|
2165
|
+
|
|
2022
2166
|
### mediaUnits()
|
|
2023
2167
|
|
|
2024
2168
|
```ts
|
|
2025
|
-
function mediaUnits(settings): MediaUnits;
|
|
2169
|
+
function mediaUnits(settings, catalogue?): MediaUnits;
|
|
2026
2170
|
```
|
|
2027
2171
|
|
|
2028
2172
|
Billing units for validated settings; video bills its requested length.
|
|
2029
2173
|
|
|
2030
2174
|
#### Parameters
|
|
2031
2175
|
|
|
2032
|
-
| Parameter
|
|
2033
|
-
|
|
|
2034
|
-
| `settings`
|
|
2176
|
+
| Parameter | Type | Default value |
|
|
2177
|
+
| ----------- | ------------------------------------------------------------- | ------------- |
|
|
2178
|
+
| `settings` | [`MediaGenerationSettings`](index.md#mediagenerationsettings) | `undefined` |
|
|
2179
|
+
| `catalogue` | [`MediaCatalogue`](index.md#mediacatalogue) | `mediaModels` |
|
|
2035
2180
|
|
|
2036
2181
|
#### Returns
|
|
2037
2182
|
|
|
@@ -2077,6 +2222,7 @@ function parseMediaBindingCall(raw):
|
|
|
2077
2222
|
libraryPath: string;
|
|
2078
2223
|
settings: {
|
|
2079
2224
|
model:
|
|
2225
|
+
| "bytedance/seedance-2.5"
|
|
2080
2226
|
| "bytedance/seedance-2.0"
|
|
2081
2227
|
| "bytedance/seedance-2.0-fast"
|
|
2082
2228
|
| "bytedance/seedance-2.0-mini"
|
|
@@ -2119,14 +2265,14 @@ Parsing and model refusal stay shared; authorization remains host-owned.
|
|
|
2119
2265
|
\| `"9:16"` \| `"21:9"` \| `"9:21"`; `generateAudio?`: `boolean`; `references?`:
|
|
2120
2266
|
`object`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \|
|
|
2121
2267
|
`"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`:
|
|
2122
|
-
`string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.
|
|
2123
|
-
`"bytedance/seedance-2.0
|
|
2124
|
-
`"
|
|
2125
|
-
`string`; `resolution?`: `"480p"` \| `"720p"`
|
|
2126
|
-
|
|
2127
|
-
`"21:9"` \| `"9:21"`; `durationSeconds?`:
|
|
2128
|
-
`references?`: `object`[]; \}; \}; \};
|
|
2129
|
-
`"refused"`; `result`: `JSONType`; \}\>
|
|
2268
|
+
`string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \|
|
|
2269
|
+
`"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \|
|
|
2270
|
+
`"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"`
|
|
2271
|
+
\| `"minimax/h3-max"`; `prompt`: `string`; `resolution?`: `"480p"` \| `"720p"`
|
|
2272
|
+
\| `"768p"` \| `"1080p"` \| `"4k"`; `aspectRatio?`: `"16:9"` \| `"4:3"` \|
|
|
2273
|
+
`"1:1"` \| `"3:4"` \| `"9:16"` \| `"21:9"` \| `"9:21"`; `durationSeconds?`:
|
|
2274
|
+
`number`; `generateAudio?`: `boolean`; `references?`: `object`[]; \}; \}; \};
|
|
2275
|
+
\}\> \| `Readonly`\<\{ `kind`: `"refused"`; `result`: `JSONType`; \}\>
|
|
2130
2276
|
|
|
2131
2277
|
---
|
|
2132
2278
|
|
|
@@ -2140,10 +2286,10 @@ Choose the same fixed filename on both hosts without a recursive App lookup.
|
|
|
2140
2286
|
|
|
2141
2287
|
#### Parameters
|
|
2142
2288
|
|
|
2143
|
-
| Parameter | Type
|
|
2144
|
-
| ------------ |
|
|
2145
|
-
| `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `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`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `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`[]; \}; \} |
|
|
2146
|
-
| `computerId` | `string`
|
|
2289
|
+
| Parameter | Type |
|
|
2290
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2291
|
+
| `input` | \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `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`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `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`[]; \}; \} |
|
|
2292
|
+
| `computerId` | `string` |
|
|
2147
2293
|
|
|
2148
2294
|
#### Returns
|
|
2149
2295
|
|
|
@@ -2161,11 +2307,11 @@ Decode bounded service replies once for both MEDIA host bindings.
|
|
|
2161
2307
|
|
|
2162
2308
|
#### Parameters
|
|
2163
2309
|
|
|
2164
|
-
| Parameter | Type
|
|
2165
|
-
| ------------ |
|
|
2166
|
-
| `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `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`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `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`[]; \}; \}; \} |
|
|
2167
|
-
| `computerId` | `string`
|
|
2168
|
-
| `response` | `Response`
|
|
2310
|
+
| Parameter | Type |
|
|
2311
|
+
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
2312
|
+
| `input` | \| \{ `operation`: `"models"`; `input`: `Record`\<`string`, `never`\>; \} \| \{ `operation`: `"generate"`; `input`: \| \{ `kind`: `"image"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `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`[]; `steps?`: `number`; \}; `outputFormat?`: `"png"` \| `"jpeg"` \| `"webp"`; \} \| \{ `kind`: `"video"`; `requestId`: `string`; `libraryPath`: `string`; `settings`: \{ `model`: \| `"bytedance/seedance-2.5"` \| `"bytedance/seedance-2.0"` \| `"bytedance/seedance-2.0-fast"` \| `"bytedance/seedance-2.0-mini"` \| `"google/veo-3.1"` \| `"google/veo-3.1-fast"` \| `"minimax/h3-max"`; `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`[]; \}; \}; \} |
|
|
2313
|
+
| `computerId` | `string` |
|
|
2314
|
+
| `response` | `Response` |
|
|
2169
2315
|
|
|
2170
2316
|
#### Returns
|
|
2171
2317
|
|
|
@@ -2173,6 +2319,52 @@ Decode bounded service replies once for both MEDIA host bindings.
|
|
|
2173
2319
|
|
|
2174
2320
|
---
|
|
2175
2321
|
|
|
2322
|
+
### quoteMediaGeneration()
|
|
2323
|
+
|
|
2324
|
+
```ts
|
|
2325
|
+
function quoteMediaGeneration(
|
|
2326
|
+
raw,
|
|
2327
|
+
references,
|
|
2328
|
+
): Promise<
|
|
2329
|
+
Readonly<
|
|
2330
|
+
Readonly<{
|
|
2331
|
+
unit: "image" | "video_second";
|
|
2332
|
+
units: number;
|
|
2333
|
+
}> &
|
|
2334
|
+
object
|
|
2335
|
+
>
|
|
2336
|
+
>;
|
|
2337
|
+
```
|
|
2338
|
+
|
|
2339
|
+
Quote one exact request: the same settings validation, reference reads,
|
|
2340
|
+
estimator and billing units a generation uses at admission, run without
|
|
2341
|
+
dispatching anything. A host applies its billing policy to this per unit, the
|
|
2342
|
+
way its metering does, so the number matches the charge.
|
|
2343
|
+
|
|
2344
|
+
#### Parameters
|
|
2345
|
+
|
|
2346
|
+
| Parameter | Type | Description |
|
|
2347
|
+
| ---------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------- |
|
|
2348
|
+
| `raw` | \{ `model`: `string`; `prompt`: `string`; `width`: `number`; `height`: `number`; `steps?`: `number`; `durationSeconds?`: `number`; `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`[]; \} | - |
|
|
2349
|
+
| `raw.model` | `string` | Provider catalog model identifier. |
|
|
2350
|
+
| `raw.prompt` | `string` | Generation prompt; each model's `maxPromptLength` is enforced on top of this ceiling. |
|
|
2351
|
+
| `raw.width` | `number` | Requested image width or nominal video selector, not decoded MP4 dimensions. |
|
|
2352
|
+
| `raw.height` | `number` | Requested image height or nominal video selector, not decoded MP4 dimensions. |
|
|
2353
|
+
| `raw.steps?` | `number` | Model-specific inference step count. |
|
|
2354
|
+
| `raw.durationSeconds?` | `number` | Requested video length in whole seconds. |
|
|
2355
|
+
| `raw.resolution?` | `"480p"` \| `"720p"` \| `"768p"` \| `"1080p"` \| `"4k"` | Video resolution; must match the nominal width/height selector. |
|
|
2356
|
+
| `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. |
|
|
2357
|
+
| `raw.generateAudio?` | `boolean` | Video audio selection. |
|
|
2358
|
+
| `raw.references?` | `object`[] | Host-authorized reference images. |
|
|
2359
|
+
| `references` | [`MediaReferenceReader`](index.md#mediareferencereader) | - |
|
|
2360
|
+
|
|
2361
|
+
#### Returns
|
|
2362
|
+
|
|
2363
|
+
`Promise`\<`Readonly`\<`Readonly`\<\{ `unit`: `"image"` \| `"video_second"`;
|
|
2364
|
+
`units`: `number`; \}\> & `object`\>\>
|
|
2365
|
+
|
|
2366
|
+
---
|
|
2367
|
+
|
|
2176
2368
|
### generateMedia()
|
|
2177
2369
|
|
|
2178
2370
|
```ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fungi.computer/darkroom",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "Levi <levi@technomancy.dev>",
|
|
5
5
|
"description": "Media generation, durable output retention and provenance with host-owned authority and billing",
|
|
6
6
|
"type": "module",
|
|
@@ -59,7 +59,7 @@
|
|
|
59
59
|
"exifreader": "4.46.0",
|
|
60
60
|
"@fungi.computer/ts-webp": "0.1.6",
|
|
61
61
|
"@xmldom/xmldom": "0.9.12",
|
|
62
|
-
"@fungi.computer/agar": "0.
|
|
62
|
+
"@fungi.computer/agar": "0.13.0",
|
|
63
63
|
"@fungi.computer/capnweb": "0.12.0-fungi.0"
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|