@flatkey-ai/cli 0.1.19 → 0.1.21
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 +29 -0
- package/package.json +1 -1
- package/src/cli.js +13 -6
package/README.md
CHANGED
|
@@ -92,6 +92,12 @@ flatkey image generate \
|
|
|
92
92
|
-o cover.png
|
|
93
93
|
```
|
|
94
94
|
|
|
95
|
+
Upload a local image and get a temporary signed URL:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
flatkey image upload --file ./reference.png
|
|
99
|
+
```
|
|
100
|
+
|
|
95
101
|
### Generate Video
|
|
96
102
|
|
|
97
103
|
```bash
|
|
@@ -106,6 +112,27 @@ flatkey video generate \
|
|
|
106
112
|
Video ratios: `16:9`, `9:16`, `4:3`, `3:4`, `21:9`, `1:1`.
|
|
107
113
|
Video resolutions: `480p`, `720p`, `1080p`.
|
|
108
114
|
|
|
115
|
+
Local reference images are uploaded through Flatkey temporary media first:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
flatkey video generate \
|
|
119
|
+
--model Seedance2.0-pro \
|
|
120
|
+
--prompt "a sleepy kitten, soft window light" \
|
|
121
|
+
--image ./reference.png \
|
|
122
|
+
-o kitten.mp4
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
First/last frame:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
flatkey video generate \
|
|
129
|
+
--model Seedance2.0-pro \
|
|
130
|
+
--prompt "slow camera push-in" \
|
|
131
|
+
--first-frame ./first.png \
|
|
132
|
+
--last-frame ./last.png \
|
|
133
|
+
-o transition.mp4
|
|
134
|
+
```
|
|
135
|
+
|
|
109
136
|
### Generate Audio
|
|
110
137
|
|
|
111
138
|
Text to speech:
|
|
@@ -196,6 +223,8 @@ Agent rules:
|
|
|
196
223
|
- Prefer `FLATKEY_API_KEY`.
|
|
197
224
|
- Always pass `--json` for machine-readable output.
|
|
198
225
|
- Use `--output` / `-o` when the generated file path matters.
|
|
226
|
+
- Use `flatkey image upload --file <path>` for a temporary signed image URL.
|
|
227
|
+
- Use `--image`, `--first-frame`, or `--last-frame` to pass local images into video generation.
|
|
199
228
|
- Call `flatkey models --json` before choosing a model.
|
|
200
229
|
- Call `flatkey audio voices --json` before choosing a TTS `voice_id`.
|
|
201
230
|
- Use `--dry-run` to inspect request shape without spending credits.
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -15,7 +15,7 @@ const COMMANDS = new Set([
|
|
|
15
15
|
]);
|
|
16
16
|
|
|
17
17
|
const GROUP_ACTIONS = new Set(["audio", "auth", "image", "text", "video"]);
|
|
18
|
-
const GLOBAL_OPTIONS = new Set(["api_key", "base_url", "dry_run", "help", "json", "output", "out"]);
|
|
18
|
+
const GLOBAL_OPTIONS = new Set(["api_key", "base_url", "console_url", "dry_run", "help", "json", "output", "out"]);
|
|
19
19
|
const REPEATABLE_OPTIONS = new Set(["image", "image_url", "video_url"]);
|
|
20
20
|
const COMMAND_OPTIONS = {
|
|
21
21
|
"audio generate": new Set(["model", "prompt", "similarity_boost", "stability", "style", "voice_id"]),
|
|
@@ -414,14 +414,14 @@ async function handleImageUpload(command, deps) {
|
|
|
414
414
|
env: deps.env ?? process.env,
|
|
415
415
|
configDir: deps.configDir,
|
|
416
416
|
});
|
|
417
|
-
const {
|
|
418
|
-
|
|
417
|
+
const { consoleOrigin } = await resolveOrigins({
|
|
418
|
+
consoleUrl: command.options.console_url,
|
|
419
419
|
env: deps.env ?? process.env,
|
|
420
420
|
configDir: deps.configDir,
|
|
421
421
|
});
|
|
422
422
|
const response = await uploadTempMediaImage({
|
|
423
423
|
apiKey,
|
|
424
|
-
baseUrl:
|
|
424
|
+
baseUrl: consoleOrigin,
|
|
425
425
|
file: await readFile(await expandHomePath(file)),
|
|
426
426
|
filename: basename(file),
|
|
427
427
|
fetch: deps.fetch,
|
|
@@ -467,8 +467,14 @@ async function handleGenerate(command, deps) {
|
|
|
467
467
|
env: deps.env ?? process.env,
|
|
468
468
|
configDir: deps.configDir,
|
|
469
469
|
});
|
|
470
|
-
const { routerOrigin } = await resolveOrigins({
|
|
470
|
+
const { routerOrigin, consoleOrigin } = await resolveOrigins({
|
|
471
471
|
baseUrl: command.options.base_url,
|
|
472
|
+
consoleUrl: command.options.console_url,
|
|
473
|
+
env: deps.env ?? process.env,
|
|
474
|
+
configDir: deps.configDir,
|
|
475
|
+
});
|
|
476
|
+
const { consoleOrigin: tempMediaBaseUrl } = await resolveOrigins({
|
|
477
|
+
consoleUrl: command.options.console_url,
|
|
472
478
|
env: deps.env ?? process.env,
|
|
473
479
|
configDir: deps.configDir,
|
|
474
480
|
});
|
|
@@ -476,6 +482,7 @@ async function handleGenerate(command, deps) {
|
|
|
476
482
|
...command.options,
|
|
477
483
|
apiKey,
|
|
478
484
|
baseUrl: routerOrigin,
|
|
485
|
+
tempMediaBaseUrl: tempMediaBaseUrl ?? consoleOrigin,
|
|
479
486
|
env: deps.env ?? process.env,
|
|
480
487
|
fetch: deps.fetch,
|
|
481
488
|
};
|
|
@@ -560,7 +567,7 @@ async function uploadLocalImage(file, options, deps) {
|
|
|
560
567
|
const { readFile } = await import("node:fs/promises");
|
|
561
568
|
const response = await deps.uploadTempMediaImage({
|
|
562
569
|
apiKey: options.apiKey,
|
|
563
|
-
baseUrl: options.baseUrl,
|
|
570
|
+
baseUrl: options.tempMediaBaseUrl ?? options.baseUrl,
|
|
564
571
|
file: await readFile(await expandHomePath(file)),
|
|
565
572
|
filename: basename(file),
|
|
566
573
|
fetch: options.fetch,
|