@pollinations/cli 0.1.87 → 0.1.88

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 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.87",
17
+ version: "0.1.88",
18
18
  description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
19
19
  type: "module",
20
20
  bin: {
@@ -2048,6 +2048,7 @@ import { Command as Command9 } from "commander";
2048
2048
 
2049
2049
  // src/lib/estimate.ts
2050
2050
  init_api();
2051
+ init_config();
2051
2052
  init_output();
2052
2053
  function estimateMediaCost(model, req) {
2053
2054
  const pricing = model.pricing ?? {};
@@ -2103,12 +2104,19 @@ function estimateMediaCost(model, req) {
2103
2104
  }
2104
2105
  var round = (n) => Number(n.toPrecision(4));
2105
2106
  async function printEstimate(modelName, req) {
2106
- const models2 = await gen("/image/models").catch(
2107
- (err) => fail("Failed to fetch model pricing", err)
2108
- );
2109
- const model = models2.find(
2110
- (m) => m.name === modelName || m.aliases?.includes(modelName)
2111
- );
2107
+ const findModel = async (apiKey) => {
2108
+ const models2 = await gen("/image/models", {
2109
+ apiKey
2110
+ }).catch((err) => fail("Failed to fetch model pricing", err));
2111
+ return models2.find(
2112
+ (model2) => model2.name === modelName || model2.aliases?.includes(modelName)
2113
+ );
2114
+ };
2115
+ let model = await findModel("");
2116
+ if (!model) {
2117
+ const apiKey = resolveApiKey();
2118
+ if (apiKey) model = await findModel(apiKey);
2119
+ }
2112
2120
  if (!model)
2113
2121
  fail(
2114
2122
  `Unknown ${req.kind} model: ${modelName}. Run: polli models --type ${req.kind}`