@pollinations/cli 0.1.34 → 0.1.36
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/dist/index.js +20 -6
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var init_package = __esm({
|
|
|
14
14
|
"package.json"() {
|
|
15
15
|
package_default = {
|
|
16
16
|
name: "@pollinations/cli",
|
|
17
|
-
version: "0.1.
|
|
17
|
+
version: "0.1.36",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -1041,7 +1041,6 @@ async function generateSimple(text, opts) {
|
|
|
1041
1041
|
if (opts.voice) params.set("voice", opts.voice);
|
|
1042
1042
|
if (opts.format !== "mp3") params.set("response_format", opts.format);
|
|
1043
1043
|
if (opts.model) params.set("model", opts.model);
|
|
1044
|
-
if (opts.speed) params.set("speed", opts.speed);
|
|
1045
1044
|
if (opts.duration) params.set("duration", opts.duration);
|
|
1046
1045
|
if (opts.instrumental) params.set("instrumental", "true");
|
|
1047
1046
|
if (opts.seed) params.set("seed", opts.seed);
|
|
@@ -1084,7 +1083,7 @@ Examples:
|
|
|
1084
1083
|
echo "the sky today" | polli gen audio --voice callum --play
|
|
1085
1084
|
polli gen audio --model elevenmusic --duration 30 "lofi beats" --output song.mp3
|
|
1086
1085
|
`
|
|
1087
|
-
).argument("[text]", "Text to speak (or pipe via stdin)").option("--voice <voice>", "Voice name (default: the model's own)").option("--format <fmt>", "mp3/opus/aac/flac/wav", "mp3").option("--model <model>", "Audio model").option("--
|
|
1086
|
+
).argument("[text]", "Text to speak (or pipe via stdin)").option("--voice <voice>", "Voice name (default: the model's own)").option("--format <fmt>", "mp3/opus/aac/flac/wav", "mp3").option("--model <model>", "Audio model").option("--duration <n>", "Music duration in seconds (elevenmusic)").option("--instrumental", "Instrumental only (elevenmusic)").option("--seed <n>", "Seed for deterministic output").option("--output <path>", "Save to file").option("--play", "Play the audio after saving (platform player)").option(
|
|
1088
1087
|
"--timestamps",
|
|
1089
1088
|
"Also save character-level timing as JSON next to the audio"
|
|
1090
1089
|
).action(async (textArg, opts) => {
|
|
@@ -2055,7 +2054,9 @@ var applyWithSnapshot = (ctx, id, paths, apply) => {
|
|
|
2055
2054
|
throw error;
|
|
2056
2055
|
}
|
|
2057
2056
|
for (const path of paths) {
|
|
2058
|
-
snapshot.files[path]
|
|
2057
|
+
const file = snapshot.files[path];
|
|
2058
|
+
if (!existing?.complete || contentHash(rollback[path].before) === file.afterHash)
|
|
2059
|
+
file.afterHash = contentHash(readTextIfExists(path));
|
|
2059
2060
|
}
|
|
2060
2061
|
snapshot.complete = true;
|
|
2061
2062
|
writeSnapshot(ctx, id, paths, snapshot);
|
|
@@ -5258,6 +5259,7 @@ function modelBody(opts, includeRequired) {
|
|
|
5258
5259
|
if (opts.requiredSafety !== void 0) {
|
|
5259
5260
|
body.requiredSafetyFeatures = String(opts.requiredSafety).trim() === "none" ? [] : commaSeparatedList(opts.requiredSafety);
|
|
5260
5261
|
}
|
|
5262
|
+
if (opts.streaming === false) body.advertised = { streaming: false };
|
|
5261
5263
|
if (includeRequired) {
|
|
5262
5264
|
for (const required of ["name", "title"]) {
|
|
5263
5265
|
if (!body[required]) {
|
|
@@ -5364,6 +5366,9 @@ var create3 = addPriceOptions(
|
|
|
5364
5366
|
).option(
|
|
5365
5367
|
"--image-pricing <mode>",
|
|
5366
5368
|
"Image billing: request (per image, default) or tokens"
|
|
5369
|
+
).option(
|
|
5370
|
+
"--no-streaming",
|
|
5371
|
+
"Text endpoint has no SSE (`my-models test` reports streaming: false); stream: true calls get the whole answer at once"
|
|
5367
5372
|
)
|
|
5368
5373
|
).action(async (opts) => {
|
|
5369
5374
|
const key = requireKey();
|
|
@@ -6090,6 +6095,15 @@ import { createReadStream, existsSync as existsSync7, statSync as statSync2 } fr
|
|
|
6090
6095
|
import { basename as basename5 } from "path";
|
|
6091
6096
|
import { Command as Command24 } from "commander";
|
|
6092
6097
|
init_output();
|
|
6098
|
+
var encodeExtValue = (value) => encodeURIComponent(value).replace(
|
|
6099
|
+
/['()*]/g,
|
|
6100
|
+
(char) => `%${char.charCodeAt(0).toString(16).toUpperCase()}`
|
|
6101
|
+
);
|
|
6102
|
+
var HEADER_SAFE = /^[\x20-\x7e\xa0-\xff]*$/;
|
|
6103
|
+
var fileNameHeaders = (name) => ({
|
|
6104
|
+
"Content-Disposition": `attachment; filename*=UTF-8''${encodeExtValue(name)}`,
|
|
6105
|
+
...HEADER_SAFE.test(name) && { "X-File-Name": name }
|
|
6106
|
+
});
|
|
6093
6107
|
var uploadCommand = new Command24("upload").description(
|
|
6094
6108
|
"Upload a local file to media.pollinations.ai and print its public URL"
|
|
6095
6109
|
).argument("<file>", "Path to the local file to upload").action(async (file) => {
|
|
@@ -6106,7 +6120,7 @@ var uploadCommand = new Command24("upload").description(
|
|
|
6106
6120
|
Authorization: `Bearer ${key}`,
|
|
6107
6121
|
"Content-Type": mime,
|
|
6108
6122
|
"Content-Length": String(size),
|
|
6109
|
-
|
|
6123
|
+
...fileNameHeaders(basename5(file))
|
|
6110
6124
|
},
|
|
6111
6125
|
body: createReadStream(file),
|
|
6112
6126
|
duplex: "half"
|
|
@@ -6155,7 +6169,7 @@ function resolveKeyIds(keys, requested) {
|
|
|
6155
6169
|
});
|
|
6156
6170
|
}
|
|
6157
6171
|
function tokensIn(r) {
|
|
6158
|
-
return (r.input_text_tokens ?? 0) + (r.input_cached_tokens ?? 0) + (r.input_audio_tokens ?? 0) + (r.input_image_tokens ?? 0);
|
|
6172
|
+
return (r.input_text_tokens ?? 0) + (r.input_cached_tokens ?? 0) + (r.input_cache_write_tokens ?? 0) + (r.input_audio_tokens ?? 0) + (r.input_image_tokens ?? 0);
|
|
6159
6173
|
}
|
|
6160
6174
|
function filterDailyRows(rows, keyIds, models2) {
|
|
6161
6175
|
let out = rows;
|