@pollinations/cli 0.1.13 → 0.1.15

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
@@ -243,11 +243,19 @@ function printAgents(agents) {
243
243
  agents.map((agent) => ({
244
244
  id: chalk2.dim(agent.id),
245
245
  name: agent.name,
246
- base_model: agent.baseModel,
246
+ type: agent.type,
247
+ base_model: agent.type === "prompt_agent" ? agent.baseModel : "-",
247
248
  visibility: agent.visibility,
248
- pollinations_tools: agent.mcpServers.includes("pollinations") ? "yes" : "no"
249
+ pollinations_tools: agent.type === "prompt_agent" ? agent.mcpServers.includes("pollinations") ? "yes" : "no" : "built in"
249
250
  })),
250
- ["id", "name", "base_model", "visibility", "pollinations_tools"]
251
+ [
252
+ "id",
253
+ "name",
254
+ "type",
255
+ "base_model",
256
+ "visibility",
257
+ "pollinations_tools"
258
+ ]
251
259
  );
252
260
  }
253
261
  var list = new Command("list").description("List agents owned by your account").action(async () => {
@@ -280,13 +288,12 @@ var get = new Command("get").description("Get an agent owned by your account").a
280
288
  process.exit(1);
281
289
  }
282
290
  });
283
- var create = new Command("create").description("Create a prompt agent").requiredOption(
291
+ var create = new Command("create").description("Create a managed agent").requiredOption(
284
292
  "--config <file>",
285
293
  "JSON agent config file sent directly to the API"
286
- ).requiredOption("--name <name>", "Callable model name").requiredOption("--title <title>", "Display title shown in the catalog").option("--description <text>", "Agent description", "").option(
294
+ ).option("--name <name>", "Prompt-agent callable model name").option("--title <title>", "Prompt-agent catalog title").option("--description <text>", "Prompt-agent description").option(
287
295
  "--visibility <visibility>",
288
- "Agent visibility: private (default) or public",
289
- "private"
296
+ "Agent visibility: private (default) or public"
290
297
  ).action(async (opts) => {
291
298
  const key = requireKey();
292
299
  try {
@@ -349,7 +356,25 @@ var remove = new Command("delete").description("Delete an agent and its model re
349
356
  process.exit(1);
350
357
  }
351
358
  });
352
- var agentsCommand = new Command("agents").description("Manage prompt agents").addCommand(list).addCommand(get).addCommand(create).addCommand(update).addCommand(remove);
359
+ var sync = new Command("sync").description("Deploy the latest revision of a code agent").argument("<id>", "Agent id").action(async (id) => {
360
+ try {
361
+ const result7 = await gen(`/account/agents/${encodeURIComponent(id)}/sync`, {
362
+ method: "POST"
363
+ });
364
+ if (getOutputMode() === "json") printResult(result7);
365
+ else {
366
+ printSuccess(
367
+ result7.updated ? `Agent deployed at ${result7.deployedCommitSha}` : `Agent already uses ${result7.deployedCommitSha}`
368
+ );
369
+ }
370
+ } catch (error) {
371
+ printError(
372
+ `Failed to sync agent: ${error instanceof Error ? error.message : "unknown"}`
373
+ );
374
+ process.exit(1);
375
+ }
376
+ });
377
+ var agentsCommand = new Command("agents").description("Manage agents").addCommand(list).addCommand(get).addCommand(create).addCommand(update).addCommand(sync).addCommand(remove);
353
378
 
354
379
  // src/commands/auth.ts
355
380
  import { Command as Command2, Option } from "commander";
@@ -1276,13 +1301,9 @@ function createGenCommand() {
1276
1301
  import { homedir as homedir2 } from "os";
1277
1302
  import { Command as Command12 } from "commander";
1278
1303
 
1279
- // src/harnesses/dsh.ts
1304
+ // src/harnesses/bloom.ts
1280
1305
  import { join as join4 } from "path";
1281
1306
  import { parseEnv } from "util";
1282
- import { isMap, isSeq, parseDocument, Scalar } from "yaml";
1283
-
1284
- // SKILL.md?raw
1285
- var SKILL_default = '---\nname: polli\ndescription: Generate images, text, audio, video, and transcribe speech via the Pollinations API using the polli CLI. Use when asked to generate media, call pollinations.ai, check pollen balance, list models, manage API keys, inspect quests, manage agents or my-models, or run polli commands.\nallowed-tools: Bash(polli *)\n---\n\n# polli \u2014 Pollinations CLI\n\nThin wrapper around `gen.pollinations.ai`. Generates images, text, audio, video; transcribes speech; manages API keys, usage, quests, agents, and invite-only my-models.\n\nIf `polli` is not installed, run `npm i -g @pollinations/cli@latest` (provides the `polli` binary).\n\n## When to use this skill\n\n- User asks to **generate an image / text / audio / video** via pollinations\n- User mentions **polli, pollinations, pollen, pollinations.ai**\n- User wants to **transcribe speech** or run TTS\n- User asks about their **pollen balance, usage, or API keys**\n- User wants to **browse or filter available models**\n- User wants to inspect **quests** or manage invite-only **my-models**\n- User wants to create or update a hosted prompt **agent**\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Store an existing key | `printf \'%s\' "$POLLINATIONS_API_KEY" \\| polli auth login --with-token` |\n| Generate image | `polli gen image "<prompt>" --output out.png` |\n| Generate text | `polli gen text "<prompt>"` |\n| Text with stdin as context | `echo "<ctx>" \\| polli gen text "<question>"` |\n| Describe an image (vision) | `polli gen text "what is this?" --image <url>` |\n| One-shot TTS | `polli gen audio "<text>" --output speech.mp3` |\n| Speak out loud | `polli gen audio "<text>" --play` (uses `afplay` on macOS; `ffplay`/`mpv`/`mpg123` on Linux) |\n| Generate video | `polli gen video "<prompt>" --output out.mp4` |\n| Transcribe audio | `polli gen transcribe path/to.mp3` |\n| Upload a local file | `polli upload path/to.png` (prints public URL) |\n| List all models | `polli models` |\n| Filter models by type | `polli models --type image` |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`, max 90) |\n| List your quests + claim state | `polli quests` (filters: `--open --claimable --claimed --coming-soon`) |\n| Manage prompt agents | `polli agents list` |\n| Manage invite-only community models | `polli my-models list` |\n| Connect a coding harness to Pollinations | `polli harness <dsh\\|opencode\\|openclaw\\|pi\\|prime> on` (available adapters: `polli harness --help`) |\n| Machine-readable output | append `--json` to any command |\n\n## Setup\n\nOne-time: `polli auth login` (device-flow; creates a key with `profile`, `usage`, and `keys`). To store an existing key, run\n`printf \'%s\' "$POLLINATIONS_API_KEY" | polli auth login --with-token`. Verify\nwith `polli auth status`.\nOverride the stored key for a single command with `--key <key>`.\n\n## Recipes\n\n### Generate an image to a file\n```bash\npolli gen image "a fox reading a book, studio ghibli style" --output fox.png\n```\nDefaults: `zimage`, 1024x1024. Pick a different model with `--model flux` (see `polli models --type image`). For edits / img2img, pass one or more `--image <url>` flags \u2014 **must be public http(s) URLs**, local paths are rejected client-side. **Only models that list `"image"` in `input_modalities` actually consume the flag** \u2014 `flux` and `zimage` are text-only and will silently ignore `--image`. Find i2i-capable models with `polli models --type image --json | jq -r \'.[] | select(.input_modalities | contains(["image"])) | .name\'` (common choices: `nanobanana`, `kontext`, `p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe).\n\n### Upload a local file to get a public URL\n```bash\nURL=$(polli upload cat.png)\npolli gen image "make the cat purple" --image "$URL" --output purple.png\n```\n`polli upload <file>` posts a multipart upload to `media.pollinations.ai` (100MB max; 30-day lifecycle, refreshed by GETs once the object is at least 15 days old). Each upload receives a unique id. Human mode: URL on stdout and id/size/contentType on stderr. `--json`: full upload response on stdout. The returned URL is public (no auth to fetch) and works anywhere `--image` is accepted \u2014 `gen image`, `gen video`, etc.\n\n### Generate text\n```bash\npolli gen text "summarize the three laws of robotics"\n```\nSave to file: `--output summary.txt`. Use `--system "<msg>"` to set system prompt. For reasoning models, pass `--reasoning low|medium|high` to control reasoning effort. **Only send `--reasoning` to models where `reasoning: true`** in `polli models --type text --json` \u2014 the flag is not validated client-side, and non-reasoning models may silently accept it (openai), ignore it, or return a 400 (mistral).\n\n### Describe an image with a vision model\n```bash\nURL=$(polli upload selfie.jpg)\npolli gen text "turn this person into a cartoon pet in one playful sentence" --image "$URL"\n```\n`gen text --image <url...>` attaches one or more **public https URLs** as an OpenAI-style multimodal message \u2014 repeatable for multi-image prompts. Local paths aren\'t supported; run them through `polli upload` first (see the upload recipe above). **Only text models with `"image"` in `input_modalities` actually read the image** \u2014 filter with `polli models --type text --json | jq -r \'.[] | select(.input_modalities | index("image")) | .name\'`. Non-vision models silently ignore the attachment. Good defaults: `openai`, `gemini`, `claude`.\n\n### Pipe stdin as context into text generation\n```bash\ncat README.md | polli gen text "what does this project do?"\n```\nstdin becomes context; the positional argument is the question.\n\n### Interactive chat session\n```bash\npolli gen chat --model openai --system "you are a terse assistant"\n```\nSlash commands inside the session: `/exit`, `/clear`, `/save <path>`.\n\n### Text-to-speech\n```bash\npolli gen audio "hello world" --voice nova --output hello.mp3\necho "long script" | polli gen audio --voice nova --output out.mp3\n```\nDefault voice is `sage`. To discover the full live voice list, use the model registry: `polli models --type audio --json | jq -r \'.[].voices[]?\'` \u2014 each audio model entry includes its `voices[]` array. Format defaults to mp3; `--format opus|aac|flac|wav` to change. Accepts stdin (same as `gen text`). Add `--play` to save and then play the audio back (handy for narration/demos). Playback starts after the file is fully written, and the command blocks until playback finishes \u2014 if you want fire-and-forget, wrap in a subshell: `( polli gen audio "..." --play & )`. Player on macOS: `afplay`; on Linux it tries `ffplay`, then `mpv`, then `mpg123` in that order.\n\n### Generate music (elevenmusic)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenmusic --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (eleven-sfx)\n```bash\npolli gen audio "thunderclap with heavy rain" --model eleven-sfx --duration 5 --output thunder.mp3\n```\nText-to-sound-effect via ElevenLabs (aliases: `sfx`, `sound-effects`). `--duration` 0.5\u201330s (omit to let the model pick). Billed per second of output (~$0.004/s, capped at $0.12 for a full 30s).\n\n### Multilingual TTS (eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model multilingual-v2 --voice rachel --output fr.mp3\n```\nStable, lifelike TTS across 29 languages (aliases: `multilingual-v2`, `eleven-v2`) \u2014 a non-alpha alternative to the default v3.\n\n### Generate video\n```bash\npolli gen video "a spacecraft landing on mars" --model wan-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model wan-fast` at ~$0.01/sec, **fixed 5-second output** (any `--duration` value is ignored \u2014 you always pay for and receive 5 sec). For image-to-video, pass `--image <url>` with a **public HTTPS URL** (local file paths and 404/rate-limited hosts will fail with a server error).\n\n**Flag support varies per model and is not enforced client-side.** `--duration`, `--aspect-ratio`, and `--audio` are forwarded to the server but may be silently ignored \u2014 verified on `wan-fast` where duration is locked to 5s, `--aspect-ratio 9:16` still returns 16:9, and `--audio` produces no audio track. Always inspect the output (`file`, `ffprobe`) before trusting a flag worked. Check `polli models --type video --json` for per-model capabilities.\n\n**Video is not tracked by `--stats`.** `polli models --type video --stats` returns empty \u2014 the stats pipe only records text/image/audio events. To compare video models, fall back to `polli models --type video --json` and look at price/description fields.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `whisper` (default), `scribe`, `universal-2`, `universal-3.5-pro`. Accepts common audio formats (mp3, wav, m4a, flac, ogg); non-audio input (e.g. a `.txt` file) returns a clear `400 invalid_request_error: extension "txt" not supported` \u2014 no need to pre-validate with `file`. Default output is the plain transcript on stdout as a single line (pipe-friendly). Use `--json` for structured output: **whisper** and **AssemblyAI** return timing data when requested through the API; **scribe** returns only `{text: "..."}` \u2014 use whisper or AssemblyAI if you need timing data. `--language <ISO-639-1>` (e.g. `en`, `fr`) is an optional hint that can improve accuracy for non-English or accented speech.\n\n### Discover models\n```bash\npolli models --type text # text models only\npolli models --type image --verbose # with context length / pricing\npolli models --stats # health + avg latency + err% (60m default)\npolli models --stats --window 5 # last 5 minutes only\n```\nUse `--stats` before choosing a model. **Caveat**: the `err%` column counts **5xx only** \u2014 a model can show `0.0%` while having massive 4xx rates (auth, validation, etc.). For the full picture use `--stats --json` and read `errors_4xx`, `errors_5xx`, `latency_p95_ms`.\n\n**Pricing fields are per-token, not per-request.** `completionImageTokens: 0.000008` means each output image-token costs that much \u2014 a single 1024x1024 image from `gptimage` lands at ~$0.008, not $0.000008. Flat-priced image models (`flux`, `zimage`) expose `completionImageTokens` as the whole-image price because they emit exactly one "token" per image. When in doubt, make one call and read the true cost from `polli usage --history --limit 5 --json`.\n\n### Check usage and balance\n```bash\npolli usage # current pollen balance\npolli usage --history # recent individual requests\npolli usage --daily # daily cost summary\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window, max 90\npolli quests # your quests + claim state (open/claimable/claimed/coming)\npolli quests --claimable # only rewards ready to claim\n```\n**History is eventually consistent** \u2014 a request you just made may not appear for 30\u201360s. When matching costs to freshly-generated media, use `--limit 50` and filter by timestamp, and retry if the expected entry is missing. `polli usage --json` returns `{"pollen": <number>}` \u2014 the current balance only; use `--history --json` or `--daily --json` for cost breakdowns.\n\n### Manage my-models\n```bash\npolli my-models list\npolli my-models models --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY"\npolli my-models create --name my-model --title "My Model" --api chat_completions --url https://api.example.com/v1/chat/completions --bearer-token "$UPSTREAM_KEY" --upstream-model gpt-4.1-mini --required-safety privacy,secrets,sexual,violence,shield\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model flux\npolli my-models update <id> --description "Updated description"\npolli my-models update <id> --paid-only # only accept Paid Pollen; --no-paid-only reverts\npolli my-models update <id> --required-safety privacy,secrets,sexual,violence,shield\npolli my-models delete <id>\n```\n`my-models` manages owned community text, image, and transcription models. Any account can create private models; `communityEndpointsAllowed: true` is required only to publish them. API keys require `account:keys`. Use `account:usage` for narrow read-only usage and `polli quests`; use both permissions when a client needs both read-only account state and admin operations. Quest claiming is dashboard-only; `polli quests` is read-only and account-aware.\n\n### Register an image my-model\n```bash\npolli my-models test --modality image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --model image-v1\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --input-modalities text,image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model image-v1\n```\nTest before creating. The probe reports the pricing mode it detected and the input modalities it found, including whether the endpoint accepts image edits; pass those back as `--input-modalities text,image` to advertise edit support. `polli my-models list` shows them in the `inputs` column.\n\nTwo billing modes: `--image-pricing request` charges `--completion-image-price` per generated image, while `--image-pricing tokens` bills returned token usage per 1M through `--prompt-text-price`, `--prompt-image-price`, and `--completion-image-price`.\n\nPrices only apply to `--visibility public` models. A private model is owner-only and always free, so every price flag above is stored as `0` until you publish \u2014 and making a published model private clears its prices again.\n\n`--modality` is fixed at creation \u2014 `update` cannot change it.\n\n### Manage agents\n\n```bash\npolli agents list\npolli agents get <id>\npolli agents create --config agent.json --name my-agent --title "My Agent"\npolli agents update <id> --config agent.json\npolli agents delete <id>\n```\nThe config file contains `systemPrompt`, `baseModel`, and optional `mcpServers`; create also requires `--name` and `--title` for the callable model listing. Use server IDs from the MCP catalog. Updates replace the complete agent configuration.\n\nCreating an agent also creates its callable model listing. Managed agents are text-only and free, with no fallbacks or per-user RPM. Deleting the agent also deletes its model listing. See [Publish an Agent](https://github.com/pollinations/pollinations/blob/main/BUILD_YOUR_OWN_AGENT.md).\n\n### Manage API keys\n```bash\npolli keys list # list all keys on the account\npolli keys info # details about the CURRENTLY AUTHENTICATED key only (takes no id)\npolli keys create --name "my-bot" --type secret --budget 1000 --permissions profile usage # scoped key\npolli keys create --name "my-app" --type publishable --redirect-uri https://app.example/callback --earnings\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--permissions <perms...>` scopes what the new key can do on the account (e.g. `profile usage` lets it call `polli --key <new> usage`). **Without `--permissions`, new scoped keys can generate media but cannot read account state** \u2014 `polli --key <new> usage` will 403. `"keys"` is auto-stripped from the list so a scoped key can never mint further keys. Existing keys with `account:keys` can manage my-models where that invite-only feature is enabled, but still need `account:usage` for read-only account state. Publishable app keys default developer earnings off; pass `--earnings` to enable them. To inspect a specific key other than the current one, use `polli keys list --json | jq \'.[] | select(.id == "<id>")\'`. `keys info` is intentionally scoped to the caller\'s own key.\n\n### Connect a coding harness\n```bash\npolli harness --help # supported harnesses\npolli harness dsh on # login if needed, mint key "polli-harness-dsh", write provider + default model\npolli harness dsh on --model kimi # any tool-calling text model from `polli models`\npolli harness dsh on --no-mcp # configure the provider and skill without MCP tools\npolli harness dsh off # restore the config backed up before "on"\npolli harness opencode on # enable the Pollinations OpenCode plugin\npolli harness opencode off # remove the plugin setup and stored key\npolli harness pi on # login if needed, mint key "polli-harness-pi", configure Pi with Pollinations\npolli harness pi on --model kimi # any tool-calling text model from `polli models`\npolli harness pi off # restore the Pi config backed up before "on"\npolli harness openclaw on # login if needed, mint key "polli-harness-openclaw", add provider + Polli skill\npolli harness openclaw off # remove the Pollinations provider, key, and skill\n```\nEach adapter checks that its harness can be launched before login, key creation, or configuration. DSH\'s official launch uses `npx`, so its adapter checks for `npx`; OpenCode, OpenClaw, and Pi require their installed commands.\n\nThe DSH adapter globally configures the Pollinations provider, hosted Pollinations MCP, and this skill under `$DSH_HOME` (default `~/.dsh`). OpenCode enables the existing Pollinations plugin and stores its dedicated key in the plugin config. OpenClaw adds a `pollinations` provider to `~/.openclaw/openclaw.json`, stores a dedicated key in `env.vars`, and installs this skill under `~/.openclaw/skills/polli/`. Pi writes `~/.pi/agent/models.json`, `auth.json`, and `settings.json`, and installs this skill under `~/.pi/agent/skills/polli/`. Guide: `polli docs` section "Coding Harnesses".\n\n### Read API docs\n```bash\npolli docs # full llm.txt reference\npolli docs /v1/chat/completions # filter to one endpoint\npolli docs --open # open in browser\n```\n\n## Output contract\n\n- **Default (human mode):** varies by command \u2014 most emit `key: value` pairs or tab-separated tables with a header row. Exceptions: `gen text` prints the full response to stdout; `gen transcribe` prints the transcript as plain text; `gen chat` runs an interactive REPL. Status/progress messages go to stderr, so pipes stay clean.\n- **`--json`:** every command emits machine-parseable JSON to stdout; all human messages go to stderr. **Always prefer `--json` when piping into `jq` or parsing** \u2014 it\'s the only shape with a stable contract.\n- **Exit codes:** 0 on success, non-zero on auth failure, rate limit, network error, or invalid args. Error messages go to stderr.\n\n## Agent operating rules\n\n1. **Run `polli auth status` first** if you don\'t know whether the user is logged in. Fail fast with a clear "run `polli auth login`" message if not.\n2. **Prefer `--json`** whenever you\'ll parse the output. Never grep human-formatted tables.\n3. **Don\'t hardcode model IDs.** Fetch the live list with `polli models --type <type>`. Model availability changes.\n4. **Before picking a model for production use, check `polli models --stats`.** Rule of thumb for "healthy": `err%` \u2264 5, `avg` latency in a reasonable range for the modality (standard text <5s, image <10s, video <60s), and `requests` high enough to be statistically meaningful (ignore rows with <10 requests \u2014 noise). **Filter by capability first, then optimize by health** \u2014 e.g. for a reasoning task, narrow to models where `reasoning: true` (via `polli models --type text --json`), *then* cross-reference against `--stats` output. The healthiest model overall may not support the capability you need. **Reasoning models are inherently slower \u2014 expect 5\u201350s, not <5s**; when picking among them, prioritize low `err%` and request count over raw latency, and compare latency only within the reasoning-capable subset.\n5. **Always pass `--output <path>`** for `gen image`, `gen audio`, `gen video` \u2014 otherwise the file lands in the current directory with a default name.\n6. **For stdin-as-context** on `gen text`, pipe the context and pass the question as the positional argument: `cat file | polli gen text "question about the file"`.\n7. **For exact flag lists, run `polli <cmd> --help` or `polli gen <cmd> --help`.** This skill\'s recipes cover the common path; the CLI\'s own help is always the source of truth.\n8. **Use `polli docs [endpoint]` over guessing API shapes.** It prints the canonical `llm.txt` reference from the live API.\n\n## Common pitfalls\n\n- Forgetting `--output` on binary generators (image/audio/video) \u2014 the file goes to a default path, which may not be what the user wants.\n- Using `polli gen text --json` expecting OpenAI chat-completions shape \u2014 the CLI\'s `--json` wraps its own structure. Use `polli docs /v1/chat/completions` to see the raw API shape if you need it.\n- Running commands without auth \u2014 `polli auth status` tells you who you\'re logged in as and your balance in one call.\n- **`gen text` streams to a TTY, buffers when piped.** The default now auto-detects \u2014 a human at the terminal sees tokens tick in, a pipe/redirect gets the full response once. Force either mode with `--stream` or `--no-stream`. For scripts and chains like `polli gen text \u2026 | polli gen audio \u2026`, you don\'t need to do anything; buffering happens automatically.\n- **Translating a `polli` workflow into a browser app.** `gen.pollinations.ai` requires a bearer token for generation requests, so a plain client-side `fetch` with no auth returns 401 unless it is served from cache. Mint a scoped key with `polli keys create` and proxy via your own backend.\n';
1286
1307
 
1287
1308
  // src/harnesses/fs.ts
1288
1309
  import {
@@ -1362,26 +1383,6 @@ var resolveHarnessKey = async (harness, options) => {
1362
1383
  return created.key;
1363
1384
  };
1364
1385
 
1365
- // src/harnesses/models.ts
1366
- var fetchHarnessModels = async (selectedModel) => {
1367
- const { data } = await gen("/v1/models");
1368
- const models2 = data.filter(
1369
- (m) => m.tools === true && m.output_modalities?.includes("text") && m.supported_endpoints?.includes("/v1/chat/completions") && m.context_length && !m.agent && m.community !== true
1370
- ).map((m) => ({
1371
- id: m.id,
1372
- contextWindow: m.context_length,
1373
- input: (m.input_modalities ?? ["text"]).filter(
1374
- (modality) => modality === "text" || modality === "image"
1375
- )
1376
- }));
1377
- if (!models2.some((model) => model.id === selectedModel)) {
1378
- throw new Error(
1379
- `Model "${selectedModel}" is not a tool-calling text model. Run: polli models`
1380
- );
1381
- }
1382
- return models2;
1383
- };
1384
-
1385
1386
  // src/harnesses/snapshot.ts
1386
1387
  import { createHash } from "crypto";
1387
1388
  import { join as join3 } from "path";
@@ -1402,8 +1403,8 @@ var captureFiles = (paths) => Object.fromEntries(
1402
1403
  { before: readTextIfExists(path), afterHash: null }
1403
1404
  ])
1404
1405
  );
1405
- var restoreFiles = (files6) => {
1406
- for (const [path, file] of Object.entries(files6)) {
1406
+ var restoreFiles = (files7) => {
1407
+ for (const [path, file] of Object.entries(files7)) {
1407
1408
  if (file.before === null) removeIfExists(path);
1408
1409
  else writeTextAtomic(path, file.before);
1409
1410
  }
@@ -1456,12 +1457,114 @@ var restoreOrStrip = (ctx, id, paths, strip) => {
1456
1457
  };
1457
1458
  var clearSnapshot = (ctx, id, paths) => removeIfExists(snapshotPath(ctx, id, paths));
1458
1459
 
1460
+ // src/harnesses/bloom.ts
1461
+ var ID = "bloom";
1462
+ var LABEL = "Bloom CLI";
1463
+ var KEY_ENV = "POLLINATIONS_API_KEY";
1464
+ var bloomHome = (ctx) => {
1465
+ const configured = ctx.env.BLOOM_HOME;
1466
+ if (!configured?.trim()) return join4(ctx.home, ".bloom");
1467
+ return resolveHomePath(ctx.home, configured);
1468
+ };
1469
+ var envPath = (ctx) => join4(bloomHome(ctx), ".env");
1470
+ var files = (ctx) => [envPath(ctx)];
1471
+ var keyLine = new RegExp(`^\\s*(?:export\\s+)?${KEY_ENV}\\s*=`, "u");
1472
+ var readKey = (ctx) => {
1473
+ const text = readTextIfExists(envPath(ctx));
1474
+ if (text === null) return null;
1475
+ return parseEnv(text)[KEY_ENV] || null;
1476
+ };
1477
+ var setKey = (ctx, key) => {
1478
+ const lines = (readTextIfExists(envPath(ctx)) ?? "").split("\n");
1479
+ const index = lines.findIndex((line) => keyLine.test(line));
1480
+ const filtered = lines.filter(
1481
+ (line, current) => current === index || !keyLine.test(line)
1482
+ );
1483
+ const value = `${KEY_ENV}=${JSON.stringify(key)}`;
1484
+ if (index === -1) {
1485
+ const insertAt = filtered.at(-1) === "" ? filtered.length - 1 : filtered.length;
1486
+ filtered.splice(insertAt, 0, value);
1487
+ } else filtered[index] = value;
1488
+ writeTextAtomic(envPath(ctx), filtered.join("\n"), 384);
1489
+ };
1490
+ var stripKey = (ctx) => {
1491
+ const text = readTextIfExists(envPath(ctx));
1492
+ if (text === null) return false;
1493
+ const lines = text.split("\n");
1494
+ const filtered = lines.filter((line) => !keyLine.test(line));
1495
+ if (filtered.length === lines.length) return false;
1496
+ writeTextAtomic(envPath(ctx), filtered.join("\n"), 384);
1497
+ return true;
1498
+ };
1499
+ var result = (ctx) => ({
1500
+ harness: ID,
1501
+ label: LABEL,
1502
+ configured: readKey(ctx) !== null,
1503
+ files: files(ctx)
1504
+ });
1505
+ var configureBloom = (ctx, apiKey) => {
1506
+ applyWithSnapshot(ctx, ID, files(ctx), () => setKey(ctx, apiKey));
1507
+ return result(ctx);
1508
+ };
1509
+ var disableBloom = (ctx) => {
1510
+ const outcome = restoreOrStrip(ctx, ID, files(ctx), () => stripKey(ctx));
1511
+ return { ...result(ctx), configured: false, outcome };
1512
+ };
1513
+ var bloom = {
1514
+ id: ID,
1515
+ label: LABEL,
1516
+ description: "Create and configure a dedicated Pollinations key for Bloom",
1517
+ restartHint: "Changes apply on the next Bloom session. Start Bloom with: bloom",
1518
+ async on(ctx, options) {
1519
+ if (!commandExists("bloom", ctx.env)) {
1520
+ throw new Error(
1521
+ "Bloom was not found. Install it first: uv tool install --python 3.12 bloom-cli"
1522
+ );
1523
+ }
1524
+ const apiKey = await resolveHarnessKey(
1525
+ { id: ID, label: LABEL, existingKey: readKey(ctx) },
1526
+ { browser: options.browser }
1527
+ );
1528
+ return configureBloom(ctx, apiKey);
1529
+ },
1530
+ off: disableBloom,
1531
+ status: result
1532
+ };
1533
+
1534
+ // src/harnesses/dsh.ts
1535
+ import { join as join5 } from "path";
1536
+ import { parseEnv as parseEnv2 } from "util";
1537
+ import { isMap, isSeq, parseDocument, Scalar } from "yaml";
1538
+
1539
+ // SKILL.md?raw
1540
+ var SKILL_default = '---\nname: polli\ndescription: Generate images, text, audio, video, and transcribe speech via the Pollinations API using the polli CLI. Use when asked to generate media, call pollinations.ai, check pollen balance, list models, manage API keys, inspect quests, manage agents or my-models, or run polli commands.\nallowed-tools: Bash(polli *)\n---\n\n# polli \u2014 Pollinations CLI\n\nThin wrapper around `gen.pollinations.ai`. Generates images, text, audio, video; transcribes speech; manages API keys, usage, quests, agents, and invite-only my-models.\n\nIf `polli` is not installed, run `npm i -g @pollinations/cli@latest` (provides the `polli` binary).\n\n## When to use this skill\n\n- User asks to **generate an image / text / audio / video** via pollinations\n- User mentions **polli, pollinations, pollen, pollinations.ai**\n- User wants to **transcribe speech** or run TTS\n- User asks about their **pollen balance, usage, or API keys**\n- User wants to **browse or filter available models**\n- User wants to inspect **quests** or manage invite-only **my-models**\n- User wants to create or update a hosted prompt **agent**\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Store an existing key | `printf \'%s\' "$POLLINATIONS_API_KEY" \\| polli auth login --with-token` |\n| Generate image | `polli gen image "<prompt>" --output out.png` |\n| Generate text | `polli gen text "<prompt>"` |\n| Text with stdin as context | `echo "<ctx>" \\| polli gen text "<question>"` |\n| Describe an image (vision) | `polli gen text "what is this?" --image <url>` |\n| One-shot TTS | `polli gen audio "<text>" --output speech.mp3` |\n| Speak out loud | `polli gen audio "<text>" --play` (uses `afplay` on macOS; `ffplay`/`mpv`/`mpg123` on Linux) |\n| Generate video | `polli gen video "<prompt>" --output out.mp4` |\n| Transcribe audio | `polli gen transcribe path/to.mp3` |\n| Upload a local file | `polli upload path/to.png` (prints public URL) |\n| List all models | `polli models` |\n| Filter models by type | `polli models --type image` |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`, max 90) |\n| List your quests + claim state | `polli quests` (filters: `--open --claimable --claimed --coming-soon`) |\n| Manage prompt agents | `polli agents list` |\n| Manage invite-only community models | `polli my-models list` |\n| Connect a coding harness to Pollinations | `polli harness <bloom\\|dsh\\|opencode\\|openclaw\\|pi\\|prime> on` (available adapters: `polli harness --help`) |\n| Machine-readable output | append `--json` to any command |\n\n## Setup\n\nOne-time: `polli auth login` (device-flow; creates a key with `profile`, `usage`, and `keys`). To store an existing key, run\n`printf \'%s\' "$POLLINATIONS_API_KEY" | polli auth login --with-token`. Verify\nwith `polli auth status`.\nOverride the stored key for a single command with `--key <key>`.\n\n## Recipes\n\n### Generate an image to a file\n```bash\npolli gen image "a fox reading a book, studio ghibli style" --output fox.png\n```\nDefaults: `zimage`, 1024x1024. Pick a different model with `--model flux` (see `polli models --type image`). For edits / img2img, pass one or more `--image <url>` flags \u2014 **must be public http(s) URLs**, local paths are rejected client-side. **Only models that list `"image"` in `input_modalities` actually consume the flag** \u2014 `flux` and `zimage` are text-only and will silently ignore `--image`. Find i2i-capable models with `polli models --type image --json | jq -r \'.[] | select(.input_modalities | contains(["image"])) | .name\'` (common choices: `nanobanana`, `kontext`, `p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe).\n\n### Upload a local file to get a public URL\n```bash\nURL=$(polli upload cat.png)\npolli gen image "make the cat purple" --image "$URL" --output purple.png\n```\n`polli upload <file>` posts a multipart upload to `media.pollinations.ai` (100MB max; 30-day lifecycle, refreshed by GETs once the object is at least 15 days old). Each upload receives a unique id. Human mode: URL on stdout and id/size/contentType on stderr. `--json`: full upload response on stdout. The returned URL is public (no auth to fetch) and works anywhere `--image` is accepted \u2014 `gen image`, `gen video`, etc.\n\n### Generate text\n```bash\npolli gen text "summarize the three laws of robotics"\n```\nSave to file: `--output summary.txt`. Use `--system "<msg>"` to set system prompt. For reasoning models, pass `--reasoning low|medium|high` to control reasoning effort. **Only send `--reasoning` to models where `reasoning: true`** in `polli models --type text --json` \u2014 the flag is not validated client-side, and non-reasoning models may silently accept it (openai), ignore it, or return a 400 (mistral).\n\n### Describe an image with a vision model\n```bash\nURL=$(polli upload selfie.jpg)\npolli gen text "turn this person into a cartoon pet in one playful sentence" --image "$URL"\n```\n`gen text --image <url...>` attaches one or more **public https URLs** as an OpenAI-style multimodal message \u2014 repeatable for multi-image prompts. Local paths aren\'t supported; run them through `polli upload` first (see the upload recipe above). **Only text models with `"image"` in `input_modalities` actually read the image** \u2014 filter with `polli models --type text --json | jq -r \'.[] | select(.input_modalities | index("image")) | .name\'`. Non-vision models silently ignore the attachment. Good defaults: `openai`, `gemini`, `claude`.\n\n### Pipe stdin as context into text generation\n```bash\ncat README.md | polli gen text "what does this project do?"\n```\nstdin becomes context; the positional argument is the question.\n\n### Interactive chat session\n```bash\npolli gen chat --model openai --system "you are a terse assistant"\n```\nSlash commands inside the session: `/exit`, `/clear`, `/save <path>`.\n\n### Text-to-speech\n```bash\npolli gen audio "hello world" --voice nova --output hello.mp3\necho "long script" | polli gen audio --voice nova --output out.mp3\n```\nDefault voice is `sage`. To discover the full live voice list, use the model registry: `polli models --type audio --json | jq -r \'.[].voices[]?\'` \u2014 each audio model entry includes its `voices[]` array. Format defaults to mp3; `--format opus|aac|flac|wav` to change. Accepts stdin (same as `gen text`). Add `--play` to save and then play the audio back (handy for narration/demos). Playback starts after the file is fully written, and the command blocks until playback finishes \u2014 if you want fire-and-forget, wrap in a subshell: `( polli gen audio "..." --play & )`. Player on macOS: `afplay`; on Linux it tries `ffplay`, then `mpv`, then `mpg123` in that order.\n\n### Generate music (elevenmusic)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenmusic --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (eleven-sfx)\n```bash\npolli gen audio "thunderclap with heavy rain" --model eleven-sfx --duration 5 --output thunder.mp3\n```\nText-to-sound-effect via ElevenLabs (aliases: `sfx`, `sound-effects`). `--duration` 0.5\u201330s (omit to let the model pick). Billed per second of output (~$0.004/s, capped at $0.12 for a full 30s).\n\n### Multilingual TTS (eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model multilingual-v2 --voice rachel --output fr.mp3\n```\nStable, lifelike TTS across 29 languages (aliases: `multilingual-v2`, `eleven-v2`) \u2014 a non-alpha alternative to the default v3.\n\n### Generate video\n```bash\npolli gen video "a spacecraft landing on mars" --model wan-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model wan-fast` at ~$0.01/sec, **fixed 5-second output** (any `--duration` value is ignored \u2014 you always pay for and receive 5 sec). For image-to-video, pass `--image <url>` with a **public HTTPS URL** (local file paths and 404/rate-limited hosts will fail with a server error).\n\n**Flag support varies per model and is not enforced client-side.** `--duration`, `--aspect-ratio`, and `--audio` are forwarded to the server but may be silently ignored \u2014 verified on `wan-fast` where duration is locked to 5s, `--aspect-ratio 9:16` still returns 16:9, and `--audio` produces no audio track. Always inspect the output (`file`, `ffprobe`) before trusting a flag worked. Check `polli models --type video --json` for per-model capabilities.\n\n**Video is not tracked by `--stats`.** `polli models --type video --stats` returns empty \u2014 the stats pipe only records text/image/audio events. To compare video models, fall back to `polli models --type video --json` and look at price/description fields.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `whisper` (default), `scribe`, `universal-2`, `universal-3.5-pro`. Accepts common audio formats (mp3, wav, m4a, flac, ogg); non-audio input (e.g. a `.txt` file) returns a clear `400 invalid_request_error: extension "txt" not supported` \u2014 no need to pre-validate with `file`. Default output is the plain transcript on stdout as a single line (pipe-friendly). Use `--json` for structured output: **whisper** and **AssemblyAI** return timing data when requested through the API; **scribe** returns only `{text: "..."}` \u2014 use whisper or AssemblyAI if you need timing data. `--language <ISO-639-1>` (e.g. `en`, `fr`) is an optional hint that can improve accuracy for non-English or accented speech.\n\n### Discover models\n```bash\npolli models --type text # text models only\npolli models --type image --verbose # with context length / pricing\npolli models --stats # health + avg latency + err% (60m default)\npolli models --stats --window 5 # last 5 minutes only\n```\nUse `--stats` before choosing a model. **Caveat**: the `err%` column counts **5xx only** \u2014 a model can show `0.0%` while having massive 4xx rates (auth, validation, etc.). For the full picture use `--stats --json` and read `errors_4xx`, `errors_5xx`, `latency_p95_ms`.\n\n**Pricing fields are per-token, not per-request.** `completionImageTokens: 0.000008` means each output image-token costs that much \u2014 a single 1024x1024 image from `gptimage` lands at ~$0.008, not $0.000008. Flat-priced image models (`flux`, `zimage`) expose `completionImageTokens` as the whole-image price because they emit exactly one "token" per image. When in doubt, make one call and read the true cost from `polli usage --history --limit 5 --json`.\n\n### Check usage and balance\n```bash\npolli usage # current pollen balance\npolli usage --history # recent individual requests\npolli usage --daily # daily cost summary\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window, max 90\npolli quests # your quests + claim state (open/claimable/claimed/coming)\npolli quests --claimable # only rewards ready to claim\n```\n**History is eventually consistent** \u2014 a request you just made may not appear for 30\u201360s. When matching costs to freshly-generated media, use `--limit 50` and filter by timestamp, and retry if the expected entry is missing. `polli usage --json` returns `{"pollen": <number>}` \u2014 the current balance only; use `--history --json` or `--daily --json` for cost breakdowns.\n\n### Manage my-models\n```bash\npolli my-models list\npolli my-models models --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY"\npolli my-models create --name my-model --title "My Model" --api chat_completions --url https://api.example.com/v1/chat/completions --bearer-token "$UPSTREAM_KEY" --upstream-model gpt-4.1-mini --required-safety privacy,secrets,sexual,violence,shield\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model flux\npolli my-models update <id> --description "Updated description"\npolli my-models update <id> --paid-only # only accept Paid Pollen; --no-paid-only reverts\npolli my-models update <id> --required-safety privacy,secrets,sexual,violence,shield\npolli my-models delete <id>\n```\n`my-models` manages owned community text, image, and transcription models. Any account can create private models; `communityEndpointsAllowed: true` is required only to publish them. API keys require `account:keys`. Use `account:usage` for narrow read-only usage and `polli quests`; use both permissions when a client needs both read-only account state and admin operations. Quest claiming is dashboard-only; `polli quests` is read-only and account-aware.\n\n### Register an image my-model\n```bash\npolli my-models test --modality image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --model image-v1\npolli my-models create --name my-image --title "My Image" --modality image --image-pricing request --completion-image-price 0.01 --input-modalities text,image --base-url https://api.example.com/v1 --bearer-token "$UPSTREAM_KEY" --upstream-model image-v1\n```\nTest before creating. The probe reports the pricing mode it detected and the input modalities it found, including whether the endpoint accepts image edits; pass those back as `--input-modalities text,image` to advertise edit support. `polli my-models list` shows them in the `inputs` column.\n\nTwo billing modes: `--image-pricing request` charges `--completion-image-price` per generated image, while `--image-pricing tokens` bills returned token usage per 1M through `--prompt-text-price`, `--prompt-image-price`, and `--completion-image-price`.\n\nPrices only apply to `--visibility public` models. A private model is owner-only and always free, so every price flag above is stored as `0` until you publish \u2014 and making a published model private clears its prices again.\n\n`--modality` is fixed at creation \u2014 `update` cannot change it.\n\n### Manage agents\n\n```bash\npolli agents list\npolli agents get <id>\npolli agents create --config agent.json --name my-agent --title "My Agent"\npolli agents create --config code-agent.json\npolli agents update <id> --config agent.json\npolli agents delete <id>\n```\nPrompt-agent config contains `systemPrompt`, `baseModel`, and optional `mcpServers`; create also requires `--name` and `--title`. Code-agent config contains `type: "code_agent"` and a public GitHub `repository` with `agent.ts` at its root; its model ID, title, and description come from GitHub. Use server IDs from the MCP catalog. Prompt-agent updates replace the complete runtime configuration.\n\nCreating an agent also creates its callable model listing. Managed agents are text-only and free, with no fallbacks or per-user RPM. Deleting the agent also deletes its model listing. See [Publish an Agent](https://github.com/pollinations/pollinations/blob/main/BUILD_YOUR_OWN_AGENT.md).\n\n### Manage API keys\n```bash\npolli keys list # list all keys on the account\npolli keys info # details about the CURRENTLY AUTHENTICATED key only (takes no id)\npolli keys create --name "my-bot" --type secret --budget 1000 --permissions profile usage # scoped key\npolli keys create --name "my-app" --type publishable --redirect-uri https://app.example/callback --earnings\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--permissions <perms...>` scopes what the new key can do on the account (e.g. `profile usage` lets it call `polli --key <new> usage`). **Without `--permissions`, new scoped keys can generate media but cannot read account state** \u2014 `polli --key <new> usage` will 403. `"keys"` is auto-stripped from the list so a scoped key can never mint further keys. Existing keys with `account:keys` can manage my-models where that invite-only feature is enabled, but still need `account:usage` for read-only account state. Publishable app keys default developer earnings off; pass `--earnings` to enable them. To inspect a specific key other than the current one, use `polli keys list --json | jq \'.[] | select(.id == "<id>")\'`. `keys info` is intentionally scoped to the caller\'s own key.\n\n### Connect a coding harness\n```bash\npolli harness --help # supported harnesses\npolli harness bloom on # create a dedicated key for Bloom CLI\npolli harness dsh on # login if needed, mint key "polli-harness-dsh", write provider + default model\npolli harness dsh on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness dsh on --no-mcp # configure the provider and skill without MCP tools\npolli harness dsh off # restore the config backed up before "on"\npolli harness opencode on # enable the Pollinations OpenCode plugin\npolli harness opencode off # remove the plugin setup and stored key\npolli harness pi on # login if needed, mint key "polli-harness-pi", configure Pi with Pollinations\npolli harness pi on --model moonshotai/kimi-k2.6 # use the model ID from `polli models`\npolli harness pi off # restore the Pi config backed up before "on"\npolli harness openclaw on # login if needed, mint key "polli-harness-openclaw", add provider + Polli skill\npolli harness openclaw off # remove the Pollinations provider, key, and skill\n```\nEach adapter checks that its harness can be launched before login, key creation, or configuration. DSH\'s official launch uses `npx`, so its adapter checks for `npx`; Bloom, OpenCode, OpenClaw, and Pi require their installed commands.\n\nBloom already uses Pollinations and only needs a dedicated key in `$BLOOM_HOME/.env` (default `~/.bloom/.env`). The DSH adapter globally configures the Pollinations provider, hosted Pollinations MCP, and this skill under `$DSH_HOME` (default `~/.dsh`). OpenCode enables the existing Pollinations plugin and stores its dedicated key in the plugin config. OpenClaw adds a `pollinations` provider to `~/.openclaw/openclaw.json`, stores a dedicated key in `env.vars`, and installs this skill under `~/.openclaw/skills/polli/`. Pi writes `~/.pi/agent/models.json`, `auth.json`, and `settings.json`, and installs this skill under `~/.pi/agent/skills/polli/`. Guide: `polli docs` section "Coding Harnesses".\n\n### Read API docs\n```bash\npolli docs # full llm.txt reference\npolli docs /v1/chat/completions # filter to one endpoint\npolli docs --open # open in browser\n```\n\n## Output contract\n\n- **Default (human mode):** varies by command \u2014 most emit `key: value` pairs or tab-separated tables with a header row. Exceptions: `gen text` prints the full response to stdout; `gen transcribe` prints the transcript as plain text; `gen chat` runs an interactive REPL. Status/progress messages go to stderr, so pipes stay clean.\n- **`--json`:** every command emits machine-parseable JSON to stdout; all human messages go to stderr. **Always prefer `--json` when piping into `jq` or parsing** \u2014 it\'s the only shape with a stable contract.\n- **Exit codes:** 0 on success, non-zero on auth failure, rate limit, network error, or invalid args. Error messages go to stderr.\n\n## Agent operating rules\n\n1. **Run `polli auth status` first** if you don\'t know whether the user is logged in. Fail fast with a clear "run `polli auth login`" message if not.\n2. **Prefer `--json`** whenever you\'ll parse the output. Never grep human-formatted tables.\n3. **Don\'t hardcode model IDs.** Fetch the live list with `polli models --type <type>`. Model availability changes.\n4. **Before picking a model for production use, check `polli models --stats`.** Rule of thumb for "healthy": `err%` \u2264 5, `avg` latency in a reasonable range for the modality (standard text <5s, image <10s, video <60s), and `requests` high enough to be statistically meaningful (ignore rows with <10 requests \u2014 noise). **Filter by capability first, then optimize by health** \u2014 e.g. for a reasoning task, narrow to models where `reasoning: true` (via `polli models --type text --json`), *then* cross-reference against `--stats` output. The healthiest model overall may not support the capability you need. **Reasoning models are inherently slower \u2014 expect 5\u201350s, not <5s**; when picking among them, prioritize low `err%` and request count over raw latency, and compare latency only within the reasoning-capable subset.\n5. **Always pass `--output <path>`** for `gen image`, `gen audio`, `gen video` \u2014 otherwise the file lands in the current directory with a default name.\n6. **For stdin-as-context** on `gen text`, pipe the context and pass the question as the positional argument: `cat file | polli gen text "question about the file"`.\n7. **For exact flag lists, run `polli <cmd> --help` or `polli gen <cmd> --help`.** This skill\'s recipes cover the common path; the CLI\'s own help is always the source of truth.\n8. **Use `polli docs [endpoint]` over guessing API shapes.** It prints the canonical `llm.txt` reference from the live API.\n\n## Common pitfalls\n\n- Forgetting `--output` on binary generators (image/audio/video) \u2014 the file goes to a default path, which may not be what the user wants.\n- Using `polli gen text --json` expecting OpenAI chat-completions shape \u2014 the CLI\'s `--json` wraps its own structure. Use `polli docs /v1/chat/completions` to see the raw API shape if you need it.\n- Running commands without auth \u2014 `polli auth status` tells you who you\'re logged in as and your balance in one call.\n- **`gen text` streams to a TTY, buffers when piped.** The default now auto-detects \u2014 a human at the terminal sees tokens tick in, a pipe/redirect gets the full response once. Force either mode with `--stream` or `--no-stream`. For scripts and chains like `polli gen text \u2026 | polli gen audio \u2026`, you don\'t need to do anything; buffering happens automatically.\n- **Translating a `polli` workflow into a browser app.** `gen.pollinations.ai` requires a bearer token for generation requests, so a plain client-side `fetch` with no auth returns 401 unless it is served from cache. Mint a scoped key with `polli keys create` and proxy via your own backend.\n';
1541
+
1542
+ // src/harnesses/models.ts
1543
+ var fetchHarnessModels = async (selectedModel) => {
1544
+ const { data } = await gen("/v1/models");
1545
+ const models2 = data.filter(
1546
+ (m) => m.tools === true && m.output_modalities?.includes("text") && m.supported_endpoints?.includes("/v1/chat/completions") && m.context_length && !m.agent && m.community !== true
1547
+ ).map((m) => ({
1548
+ id: m.id,
1549
+ contextWindow: m.context_length,
1550
+ input: (m.input_modalities ?? ["text"]).filter(
1551
+ (modality) => modality === "text" || modality === "image"
1552
+ )
1553
+ }));
1554
+ if (!models2.some((model) => model.id === selectedModel)) {
1555
+ throw new Error(
1556
+ `Model "${selectedModel}" is not a tool-calling text model. Run: polli models`
1557
+ );
1558
+ }
1559
+ return models2;
1560
+ };
1561
+
1459
1562
  // src/harnesses/dsh.ts
1460
- var ID = "dsh";
1461
- var LABEL = "DeepSeek Harness";
1563
+ var ID2 = "dsh";
1564
+ var LABEL2 = "DeepSeek Harness";
1462
1565
  var PROVIDER = "pollinations";
1463
1566
  var DEFAULT_MODEL = "deepseek/deepseek-v4-flash";
1464
- var KEY_ENV = "POLLI_DSH_API_KEY";
1567
+ var KEY_ENV2 = "POLLI_DSH_API_KEY";
1465
1568
  var MCP_ID = "mcp-pollinations";
1466
1569
  var MCP_URL = `${BASE_URL}/mcp/pollinations`;
1467
1570
  var PROVIDER_PATH = ["llm-pi-ai", "providers", PROVIDER];
@@ -1473,47 +1576,47 @@ var JS_TAG = {
1473
1576
  };
1474
1577
  var dshHome = (ctx) => {
1475
1578
  const configured = ctx.env.DSH_HOME;
1476
- if (!configured?.trim()) return join4(ctx.home, ".dsh");
1579
+ if (!configured?.trim()) return join5(ctx.home, ".dsh");
1477
1580
  return resolveHomePath(ctx.home, configured);
1478
1581
  };
1479
- var settingsPath = (ctx) => join4(dshHome(ctx), "settings.yaml");
1480
- var envPath = (ctx) => join4(dshHome(ctx), ".env");
1481
- var patchPath = (ctx) => join4(dshHome(ctx), "cordis.patch.yml");
1482
- var skillPath = (ctx) => join4(dshHome(ctx), "skills", "polli", "SKILL.md");
1582
+ var settingsPath = (ctx) => join5(dshHome(ctx), "settings.yaml");
1583
+ var envPath2 = (ctx) => join5(dshHome(ctx), ".env");
1584
+ var patchPath = (ctx) => join5(dshHome(ctx), "cordis.patch.yml");
1585
+ var skillPath = (ctx) => join5(dshHome(ctx), "skills", "polli", "SKILL.md");
1483
1586
  var loadYaml = (path) => parseDocument(readTextIfExists(path) ?? "", { customTags: [JS_TAG] });
1484
- var files = (ctx) => [
1587
+ var files2 = (ctx) => [
1485
1588
  settingsPath(ctx),
1486
- envPath(ctx),
1589
+ envPath2(ctx),
1487
1590
  patchPath(ctx),
1488
1591
  skillPath(ctx)
1489
1592
  ];
1490
- var readKey = (ctx) => {
1491
- const text = readTextIfExists(envPath(ctx));
1593
+ var readKey2 = (ctx) => {
1594
+ const text = readTextIfExists(envPath2(ctx));
1492
1595
  if (text === null) return null;
1493
- const key = parseEnv(text)[KEY_ENV];
1596
+ const key = parseEnv2(text)[KEY_ENV2];
1494
1597
  return key || null;
1495
1598
  };
1496
- var envLine = (key) => `${KEY_ENV}=${JSON.stringify(key)}`;
1497
- var keyLine = new RegExp(`^\\s*(?:export\\s+)?${KEY_ENV}\\s*=`, "u");
1599
+ var envLine = (key) => `${KEY_ENV2}=${JSON.stringify(key)}`;
1600
+ var keyLine2 = new RegExp(`^\\s*(?:export\\s+)?${KEY_ENV2}\\s*=`, "u");
1498
1601
  var setEnvKey = (ctx, key) => {
1499
- const lines = (readTextIfExists(envPath(ctx)) ?? "").split("\n");
1500
- const index = lines.findIndex((line) => keyLine.test(line));
1602
+ const lines = (readTextIfExists(envPath2(ctx)) ?? "").split("\n");
1603
+ const index = lines.findIndex((line) => keyLine2.test(line));
1501
1604
  const filtered = lines.filter(
1502
- (line, i) => i === index || !keyLine.test(line)
1605
+ (line, i) => i === index || !keyLine2.test(line)
1503
1606
  );
1504
1607
  if (index === -1) {
1505
1608
  const insertAt = filtered.at(-1) === "" ? filtered.length - 1 : filtered.length;
1506
1609
  filtered.splice(insertAt, 0, envLine(key));
1507
1610
  } else filtered[index] = envLine(key);
1508
- writeTextAtomic(envPath(ctx), filtered.join("\n"), 384);
1611
+ writeTextAtomic(envPath2(ctx), filtered.join("\n"), 384);
1509
1612
  };
1510
1613
  var deleteEnvKey = (ctx) => {
1511
- const text = readTextIfExists(envPath(ctx));
1614
+ const text = readTextIfExists(envPath2(ctx));
1512
1615
  if (text === null) return false;
1513
1616
  const lines = text.split("\n");
1514
- const filtered = lines.filter((line) => !keyLine.test(line));
1617
+ const filtered = lines.filter((line) => !keyLine2.test(line));
1515
1618
  if (filtered.length === lines.length) return false;
1516
- writeTextAtomic(envPath(ctx), filtered.join("\n"), 384);
1619
+ writeTextAtomic(envPath2(ctx), filtered.join("\n"), 384);
1517
1620
  return true;
1518
1621
  };
1519
1622
  var stripMcpEntry = (doc) => {
@@ -1549,7 +1652,7 @@ var writeMcpEntry = (ctx) => {
1549
1652
  }
1550
1653
  stripMcpEntry(doc);
1551
1654
  const authorization = doc.createNode(
1552
- `\`Bearer \${process.env.${KEY_ENV}}\``
1655
+ `\`Bearer \${process.env.${KEY_ENV2}}\``
1553
1656
  );
1554
1657
  authorization.tag = "tag:yaml.org,2002:js";
1555
1658
  authorization.type = Scalar.QUOTE_SINGLE;
@@ -1582,7 +1685,7 @@ var hasMcpEntry = (ctx) => {
1582
1685
  };
1583
1686
  var providerConfig = (models2) => ({
1584
1687
  displayName: "Pollinations.ai",
1585
- apiKeyEnv: KEY_ENV,
1688
+ apiKeyEnv: KEY_ENV2,
1586
1689
  api: "openai-completions",
1587
1690
  baseURL: `${BASE_URL}/v1`,
1588
1691
  compat: {
@@ -1637,41 +1740,41 @@ var stripConfig = (ctx) => {
1637
1740
  }
1638
1741
  return changed;
1639
1742
  };
1640
- var result = (ctx) => {
1743
+ var result2 = (ctx) => {
1641
1744
  const doc = loadYaml(settingsPath(ctx));
1642
1745
  const model = doc.getIn([...DEFAULT_MODEL_PATH, "model"]);
1643
1746
  return {
1644
- harness: ID,
1645
- label: LABEL,
1646
- configured: doc.getIn([...PROVIDER_PATH, "apiKeyEnv"]) === KEY_ENV && doc.getIn([...PROVIDER_PATH, "api"]) === "openai-completions" && doc.getIn([...PROVIDER_PATH, "baseURL"]) === `${BASE_URL}/v1` && doc.getIn([...DEFAULT_MODEL_PATH, "provider"]) === PROVIDER && typeof model === "string" && readKey(ctx) !== null && readTextIfExists(skillPath(ctx)) !== null,
1747
+ harness: ID2,
1748
+ label: LABEL2,
1749
+ configured: doc.getIn([...PROVIDER_PATH, "apiKeyEnv"]) === KEY_ENV2 && doc.getIn([...PROVIDER_PATH, "api"]) === "openai-completions" && doc.getIn([...PROVIDER_PATH, "baseURL"]) === `${BASE_URL}/v1` && doc.getIn([...DEFAULT_MODEL_PATH, "provider"]) === PROVIDER && typeof model === "string" && readKey2(ctx) !== null && readTextIfExists(skillPath(ctx)) !== null,
1647
1750
  model: typeof model === "string" ? model : void 0,
1648
1751
  mcp: hasMcpEntry(ctx),
1649
- files: files(ctx)
1752
+ files: files2(ctx)
1650
1753
  };
1651
1754
  };
1652
1755
  var configureDsh = (ctx, settings) => {
1653
- applyWithSnapshot(ctx, ID, files(ctx), () => writeConfig(ctx, settings));
1654
- return result(ctx);
1756
+ applyWithSnapshot(ctx, ID2, files2(ctx), () => writeConfig(ctx, settings));
1757
+ return result2(ctx);
1655
1758
  };
1656
1759
  var disableDsh = (ctx) => {
1657
- const outcome = restoreOrStrip(ctx, ID, files(ctx), () => stripConfig(ctx));
1658
- return { ...result(ctx), configured: false, outcome };
1760
+ const outcome = restoreOrStrip(ctx, ID2, files2(ctx), () => stripConfig(ctx));
1761
+ return { ...result2(ctx), configured: false, outcome };
1659
1762
  };
1660
1763
  var dsh = {
1661
- id: ID,
1662
- label: LABEL,
1764
+ id: ID2,
1765
+ label: LABEL2,
1663
1766
  description: "Configure DeepSeek Harness as a Pollinations provider",
1664
- restartHint: "Changes apply on the next request. Start DeepSeek Harness with: npx @deepseek-ai/dsh web",
1767
+ restartHint: "Changes apply on the next request. Start DeepSeek Harness with: npx @deepseek-ai/dsh@latest web",
1665
1768
  async on(ctx, options) {
1666
1769
  if (!commandExists("npx", ctx.env)) {
1667
1770
  throw new Error(
1668
- "DeepSeek Harness requires npx. Install Node.js, then run: npx @deepseek-ai/dsh web"
1771
+ "DeepSeek Harness requires npx. Install Node.js, then run: npx @deepseek-ai/dsh@latest web"
1669
1772
  );
1670
1773
  }
1671
1774
  const model = options.model ?? DEFAULT_MODEL;
1672
1775
  const models2 = await fetchHarnessModels(model);
1673
1776
  const apiKey = await resolveHarnessKey(
1674
- { id: ID, label: LABEL, existingKey: readKey(ctx) },
1777
+ { id: ID2, label: LABEL2, existingKey: readKey2(ctx) },
1675
1778
  { browser: options.browser }
1676
1779
  );
1677
1780
  return configureDsh(ctx, {
@@ -1682,30 +1785,30 @@ var dsh = {
1682
1785
  });
1683
1786
  },
1684
1787
  off: disableDsh,
1685
- status: result
1788
+ status: result2
1686
1789
  };
1687
1790
 
1688
1791
  // src/harnesses/openclaw.ts
1689
1792
  import { spawnSync as spawnSync2 } from "child_process";
1690
- import { join as join5 } from "path";
1793
+ import { join as join6 } from "path";
1691
1794
  import JSON5 from "json5";
1692
- var ID2 = "openclaw";
1693
- var LABEL2 = "OpenClaw";
1795
+ var ID3 = "openclaw";
1796
+ var LABEL3 = "OpenClaw";
1694
1797
  var PROVIDER2 = "pollinations";
1695
1798
  var DEFAULT_MODEL2 = "moonshotai/kimi-k2.6";
1696
- var KEY_ENV2 = "POLLI_OPENCLAW_API_KEY";
1799
+ var KEY_ENV3 = "POLLI_OPENCLAW_API_KEY";
1697
1800
  var openclawStateDir = (ctx) => {
1698
1801
  const stateDir = ctx.env.OPENCLAW_STATE_DIR?.trim();
1699
1802
  if (stateDir) return resolveHomePath(ctx.home, stateDir);
1700
1803
  const home = ctx.env.OPENCLAW_HOME?.trim();
1701
- return join5(home ? resolveHomePath(ctx.home, home) : ctx.home, ".openclaw");
1804
+ return join6(home ? resolveHomePath(ctx.home, home) : ctx.home, ".openclaw");
1702
1805
  };
1703
1806
  var configPath = (ctx) => {
1704
1807
  const override = ctx.env.OPENCLAW_CONFIG_PATH?.trim();
1705
- return override ? resolveHomePath(ctx.home, override) : join5(openclawStateDir(ctx), "openclaw.json");
1808
+ return override ? resolveHomePath(ctx.home, override) : join6(openclawStateDir(ctx), "openclaw.json");
1706
1809
  };
1707
- var skillFile = (ctx) => join5(openclawStateDir(ctx), "skills", "polli", "SKILL.md");
1708
- var files2 = (ctx) => [configPath(ctx), skillFile(ctx)];
1810
+ var skillFile = (ctx) => join6(openclawStateDir(ctx), "skills", "polli", "SKILL.md");
1811
+ var files3 = (ctx) => [configPath(ctx), skillFile(ctx)];
1709
1812
  var loadJson = (path) => {
1710
1813
  const text = readTextIfExists(path);
1711
1814
  if (!text?.trim()) return {};
@@ -1715,14 +1818,14 @@ var saveJson = (path, data) => {
1715
1818
  writeTextAtomic(path, `${JSON.stringify(data, null, 2)}
1716
1819
  `, 384);
1717
1820
  };
1718
- var readKey2 = (ctx) => {
1821
+ var readKey3 = (ctx) => {
1719
1822
  const env = loadJson(configPath(ctx)).env;
1720
- const key = env?.vars?.[KEY_ENV2];
1823
+ const key = env?.vars?.[KEY_ENV3];
1721
1824
  return typeof key === "string" && key ? key : null;
1722
1825
  };
1723
1826
  var providerEntry = (models2) => ({
1724
1827
  baseUrl: `${BASE_URL}/v1`,
1725
- apiKey: `\${${KEY_ENV2}}`,
1828
+ apiKey: `\${${KEY_ENV3}}`,
1726
1829
  api: "openai-completions",
1727
1830
  models: models2.map((model) => ({
1728
1831
  id: model.id,
@@ -1736,7 +1839,7 @@ var writeConfig2 = (ctx, models2, apiKey, model) => {
1736
1839
  const doc = loadJson(configPath(ctx));
1737
1840
  const env = asRecord(doc.env);
1738
1841
  const vars = asRecord(env.vars);
1739
- vars[KEY_ENV2] = apiKey;
1842
+ vars[KEY_ENV3] = apiKey;
1740
1843
  env.vars = vars;
1741
1844
  doc.env = env;
1742
1845
  const modelsConfig = asRecord(doc.models);
@@ -1759,9 +1862,9 @@ var writeConfig2 = (ctx, models2, apiKey, model) => {
1759
1862
  var stripConfig2 = (ctx) => {
1760
1863
  let changed = false;
1761
1864
  const doc = loadJson(configPath(ctx));
1762
- if (doc.env?.vars && KEY_ENV2 in asRecord(doc.env.vars)) {
1865
+ if (doc.env?.vars && KEY_ENV3 in asRecord(doc.env.vars)) {
1763
1866
  const vars = asRecord(doc.env.vars);
1764
- delete vars[KEY_ENV2];
1867
+ delete vars[KEY_ENV3];
1765
1868
  if (Object.keys(vars).length === 0) delete doc.env.vars;
1766
1869
  saveJson(configPath(ctx), doc);
1767
1870
  changed = true;
@@ -1786,30 +1889,30 @@ var stripConfig2 = (ctx) => {
1786
1889
  }
1787
1890
  return changed;
1788
1891
  };
1789
- var result2 = (ctx) => {
1892
+ var result3 = (ctx) => {
1790
1893
  const doc = loadJson(configPath(ctx));
1791
1894
  const provider = asRecord(doc.models?.providers?.[PROVIDER2]);
1792
1895
  const primary = asRecord(doc.agents?.defaults?.model).primary;
1793
1896
  return {
1794
- harness: ID2,
1795
- label: LABEL2,
1796
- configured: provider?.baseUrl === `${BASE_URL}/v1` && provider?.api === "openai-completions" && provider?.apiKey === `\${${KEY_ENV2}}` && typeof primary === "string" && primary.startsWith(`${PROVIDER2}/`) && readKey2(ctx) !== null && readTextIfExists(skillFile(ctx)) !== null,
1897
+ harness: ID3,
1898
+ label: LABEL3,
1899
+ configured: provider?.baseUrl === `${BASE_URL}/v1` && provider?.api === "openai-completions" && provider?.apiKey === `\${${KEY_ENV3}}` && typeof primary === "string" && primary.startsWith(`${PROVIDER2}/`) && readKey3(ctx) !== null && readTextIfExists(skillFile(ctx)) !== null,
1797
1900
  model: typeof primary === "string" && primary.startsWith(`${PROVIDER2}/`) ? primary.slice(`${PROVIDER2}/`.length) : void 0,
1798
- files: files2(ctx)
1901
+ files: files3(ctx)
1799
1902
  };
1800
1903
  };
1801
1904
  var configureOpenClaw = (ctx, models2, apiKey, model) => {
1802
1905
  applyWithSnapshot(
1803
1906
  ctx,
1804
- ID2,
1805
- files2(ctx),
1907
+ ID3,
1908
+ files3(ctx),
1806
1909
  () => writeConfig2(ctx, models2, apiKey, model)
1807
1910
  );
1808
- return result2(ctx);
1911
+ return result3(ctx);
1809
1912
  };
1810
1913
  var disableOpenClaw = (ctx) => {
1811
- const outcome = restoreOrStrip(ctx, ID2, files2(ctx), () => stripConfig2(ctx));
1812
- return { ...result2(ctx), configured: false, outcome };
1914
+ const outcome = restoreOrStrip(ctx, ID3, files3(ctx), () => stripConfig2(ctx));
1915
+ return { ...result3(ctx), configured: false, outcome };
1813
1916
  };
1814
1917
  var openclawInstalled = (ctx) => commandExists("openclaw", ctx.env);
1815
1918
  var initializeOpenClaw = (ctx) => {
@@ -1824,8 +1927,8 @@ var initializeOpenClaw = (ctx) => {
1824
1927
  }
1825
1928
  };
1826
1929
  var openclaw = {
1827
- id: ID2,
1828
- label: LABEL2,
1930
+ id: ID3,
1931
+ label: LABEL3,
1829
1932
  description: "Add Pollinations as a provider in OpenClaw",
1830
1933
  restartHint: "Restart the gateway: openclaw gateway restart (or /model inside chat to switch).",
1831
1934
  async on(ctx, options) {
@@ -1838,32 +1941,32 @@ var openclaw = {
1838
1941
  const models2 = await fetchHarnessModels(model);
1839
1942
  initializeOpenClaw(ctx);
1840
1943
  const apiKey = await resolveHarnessKey(
1841
- { id: ID2, label: LABEL2, existingKey: readKey2(ctx) },
1944
+ { id: ID3, label: LABEL3, existingKey: readKey3(ctx) },
1842
1945
  { browser: options.browser }
1843
1946
  );
1844
1947
  return configureOpenClaw(ctx, models2, apiKey, model);
1845
1948
  },
1846
1949
  off: disableOpenClaw,
1847
- status: result2
1950
+ status: result3
1848
1951
  };
1849
1952
 
1850
1953
  // src/harnesses/opencode.ts
1851
- import { join as join6 } from "path";
1954
+ import { join as join7 } from "path";
1852
1955
  import JSON52 from "json5";
1853
- var ID3 = "opencode";
1854
- var LABEL3 = "OpenCode";
1956
+ var ID4 = "opencode";
1957
+ var LABEL4 = "OpenCode";
1855
1958
  var DEFAULT_MODEL3 = "openai/gpt-5.4-nano";
1856
1959
  var PLUGIN_SPEC = "opencode-pollinations-plugin";
1857
1960
  var pollinationsConfigDir = (ctx) => {
1858
1961
  if (process.platform === "win32") {
1859
- return join6(ctx.env.APPDATA ?? ctx.home, "pollinations");
1962
+ return join7(ctx.env.APPDATA ?? ctx.home, "pollinations");
1860
1963
  }
1861
1964
  if (process.platform === "darwin") {
1862
- return join6(ctx.home, "Library", "Application Support", "pollinations");
1965
+ return join7(ctx.home, "Library", "Application Support", "pollinations");
1863
1966
  }
1864
1967
  const xdg = ctx.env.XDG_CONFIG_HOME?.trim();
1865
- return join6(
1866
- xdg ? resolveHomePath(ctx.home, xdg) : join6(ctx.home, ".config"),
1968
+ return join7(
1969
+ xdg ? resolveHomePath(ctx.home, xdg) : join7(ctx.home, ".config"),
1867
1970
  "pollinations"
1868
1971
  );
1869
1972
  };
@@ -1871,11 +1974,11 @@ var opencodeConfigFile = (ctx) => {
1871
1974
  if (ctx.env.OPENCODE_CONFIG?.trim()) {
1872
1975
  return resolveHomePath(ctx.home, ctx.env.OPENCODE_CONFIG);
1873
1976
  }
1874
- const dir = ctx.env.OPENCODE_CONFIG_DIR?.trim() ? resolveHomePath(ctx.home, ctx.env.OPENCODE_CONFIG_DIR) : join6(ctx.home, ".config", "opencode");
1875
- return ["opencode.jsonc", "opencode.json", "config.json"].map((name) => join6(dir, name)).find((path) => readTextIfExists(path) !== null) ?? join6(dir, "opencode.json");
1977
+ const dir = ctx.env.OPENCODE_CONFIG_DIR?.trim() ? resolveHomePath(ctx.home, ctx.env.OPENCODE_CONFIG_DIR) : join7(ctx.home, ".config", "opencode");
1978
+ return ["opencode.jsonc", "opencode.json", "config.json"].map((name) => join7(dir, name)).find((path) => readTextIfExists(path) !== null) ?? join7(dir, "opencode.json");
1876
1979
  };
1877
- var pluginConfigFile = (ctx) => join6(pollinationsConfigDir(ctx), "config.json");
1878
- var files3 = (ctx) => [
1980
+ var pluginConfigFile = (ctx) => join7(pollinationsConfigDir(ctx), "config.json");
1981
+ var files4 = (ctx) => [
1879
1982
  opencodeConfigFile(ctx),
1880
1983
  pluginConfigFile(ctx)
1881
1984
  ];
@@ -1958,15 +2061,15 @@ var stripOpenCodeConfig = (ctx) => {
1958
2061
  if (changed) writeJson(path, config);
1959
2062
  return changed;
1960
2063
  };
1961
- var result3 = (ctx) => {
2064
+ var result4 = (ctx) => {
1962
2065
  const config = openCodeConfig(ctx);
1963
2066
  const model = isOurDefaultModel(config.model) ? config.model.slice("pollinations/enter/".length) : void 0;
1964
2067
  return {
1965
- harness: ID3,
1966
- label: LABEL3,
2068
+ harness: ID4,
2069
+ label: LABEL4,
1967
2070
  configured: hasPluginEntry(config) && isOurDefaultModel(config.model) && readApiKey(ctx) !== null,
1968
2071
  model,
1969
- files: files3(ctx)
2072
+ files: files4(ctx)
1970
2073
  };
1971
2074
  };
1972
2075
  var writeConfig3 = (ctx, settings) => {
@@ -1979,19 +2082,19 @@ var stripConfig3 = (ctx) => {
1979
2082
  return changed;
1980
2083
  };
1981
2084
  var configureOpenCode = (ctx, settings) => {
1982
- applyWithSnapshot(ctx, ID3, files3(ctx), () => writeConfig3(ctx, settings));
1983
- return result3(ctx);
2085
+ applyWithSnapshot(ctx, ID4, files4(ctx), () => writeConfig3(ctx, settings));
2086
+ return result4(ctx);
1984
2087
  };
1985
2088
  var disableOpenCode = (ctx) => {
1986
- const outcome = restoreOrStrip(ctx, ID3, files3(ctx), () => stripConfig3(ctx));
1987
- return { ...result3(ctx), configured: false, outcome };
2089
+ const outcome = restoreOrStrip(ctx, ID4, files4(ctx), () => stripConfig3(ctx));
2090
+ return { ...result4(ctx), configured: false, outcome };
1988
2091
  };
1989
2092
  var openCodeInstalled = (ctx) => commandExists("opencode", ctx.env, [
1990
- join6(ctx.home, ".opencode", "bin", "opencode")
2093
+ join7(ctx.home, ".opencode", "bin", "opencode")
1991
2094
  ]);
1992
2095
  var opencode = {
1993
- id: ID3,
1994
- label: LABEL3,
2096
+ id: ID4,
2097
+ label: LABEL4,
1995
2098
  description: "Configure OpenCode to use Pollinations",
1996
2099
  restartHint: "Restart OpenCode, then pick a Pollinations model with /models. Inside OpenCode: /poll quests shows claimable Pollen, /poll help lists the media tools.",
1997
2100
  async on(ctx, options) {
@@ -2004,8 +2107,8 @@ var opencode = {
2004
2107
  await fetchHarnessModels(model);
2005
2108
  const apiKey = await resolveHarnessKey(
2006
2109
  {
2007
- id: ID3,
2008
- label: LABEL3,
2110
+ id: ID4,
2111
+ label: LABEL4,
2009
2112
  existingKey: readApiKey(ctx),
2010
2113
  accountPermissions: ["profile", "usage"]
2011
2114
  },
@@ -2014,25 +2117,25 @@ var opencode = {
2014
2117
  return configureOpenCode(ctx, { apiKey, model });
2015
2118
  },
2016
2119
  off: disableOpenCode,
2017
- status: result3
2120
+ status: result4
2018
2121
  };
2019
2122
 
2020
2123
  // src/harnesses/pi.ts
2021
- import { join as join7 } from "path";
2022
- var ID4 = "pi";
2023
- var LABEL4 = "Pi";
2124
+ import { join as join8 } from "path";
2125
+ var ID5 = "pi";
2126
+ var LABEL5 = "Pi";
2024
2127
  var PROVIDER3 = "pollinations";
2025
2128
  var DEFAULT_MODEL4 = "deepseek/deepseek-v4-flash";
2026
2129
  var piAgentDir = (ctx) => {
2027
2130
  const configured = ctx.env.PI_CODING_AGENT_DIR;
2028
- if (!configured?.trim()) return join7(ctx.home, ".pi", "agent");
2131
+ if (!configured?.trim()) return join8(ctx.home, ".pi", "agent");
2029
2132
  return resolveHomePath(ctx.home, configured);
2030
2133
  };
2031
- var modelsPath = (ctx) => join7(piAgentDir(ctx), "models.json");
2032
- var authPath = (ctx) => join7(piAgentDir(ctx), "auth.json");
2033
- var settingsPath2 = (ctx) => join7(piAgentDir(ctx), "settings.json");
2034
- var skillFile2 = (ctx) => join7(piAgentDir(ctx), "skills", "polli", "SKILL.md");
2035
- var files4 = (ctx) => [
2134
+ var modelsPath = (ctx) => join8(piAgentDir(ctx), "models.json");
2135
+ var authPath = (ctx) => join8(piAgentDir(ctx), "auth.json");
2136
+ var settingsPath2 = (ctx) => join8(piAgentDir(ctx), "settings.json");
2137
+ var skillFile2 = (ctx) => join8(piAgentDir(ctx), "skills", "polli", "SKILL.md");
2138
+ var files5 = (ctx) => [
2036
2139
  modelsPath(ctx),
2037
2140
  authPath(ctx),
2038
2141
  settingsPath2(ctx),
@@ -2047,7 +2150,7 @@ var saveJson2 = (path, data) => {
2047
2150
  writeTextAtomic(path, `${JSON.stringify(data, null, 2)}
2048
2151
  `, 384);
2049
2152
  };
2050
- var readKey3 = (ctx) => {
2153
+ var readKey4 = (ctx) => {
2051
2154
  const auth = loadJson2(authPath(ctx));
2052
2155
  const entry = auth[PROVIDER3];
2053
2156
  if (!entry || typeof entry !== "object") return null;
@@ -2127,7 +2230,7 @@ var stripConfig4 = (ctx) => {
2127
2230
  }
2128
2231
  return changed;
2129
2232
  };
2130
- var result4 = (ctx) => {
2233
+ var result5 = (ctx) => {
2131
2234
  const modelsData = loadJson2(modelsPath(ctx));
2132
2235
  const authData = loadJson2(authPath(ctx));
2133
2236
  const settingsData = loadJson2(settingsPath2(ctx));
@@ -2139,24 +2242,24 @@ var result4 = (ctx) => {
2139
2242
  const hasDefaultProvider = settingsData.defaultProvider === PROVIDER3;
2140
2243
  const model = typeof settingsData.defaultModel === "string" ? settingsData.defaultModel : void 0;
2141
2244
  return {
2142
- harness: ID4,
2143
- label: LABEL4,
2245
+ harness: ID5,
2246
+ label: LABEL5,
2144
2247
  configured: hasProvider && hasKey && hasDefaultProvider && readTextIfExists(skillFile2(ctx)) !== null,
2145
2248
  model,
2146
- files: files4(ctx)
2249
+ files: files5(ctx)
2147
2250
  };
2148
2251
  };
2149
2252
  var configurePi = (ctx, settings) => {
2150
- applyWithSnapshot(ctx, ID4, files4(ctx), () => writeConfig4(ctx, settings));
2151
- return result4(ctx);
2253
+ applyWithSnapshot(ctx, ID5, files5(ctx), () => writeConfig4(ctx, settings));
2254
+ return result5(ctx);
2152
2255
  };
2153
2256
  var disablePi = (ctx) => {
2154
- const outcome = restoreOrStrip(ctx, ID4, files4(ctx), () => stripConfig4(ctx));
2155
- return { ...result4(ctx), configured: false, outcome };
2257
+ const outcome = restoreOrStrip(ctx, ID5, files5(ctx), () => stripConfig4(ctx));
2258
+ return { ...result5(ctx), configured: false, outcome };
2156
2259
  };
2157
2260
  var pi = {
2158
- id: ID4,
2159
- label: LABEL4,
2261
+ id: ID5,
2262
+ label: LABEL5,
2160
2263
  description: "Configure Pi as a Pollinations provider",
2161
2264
  restartHint: "Changes apply on the next Pi session. Start Pi with: pi",
2162
2265
  async on(ctx, options) {
@@ -2168,31 +2271,31 @@ var pi = {
2168
2271
  const model = options.model ?? DEFAULT_MODEL4;
2169
2272
  const models2 = await fetchHarnessModels(model);
2170
2273
  const apiKey = await resolveHarnessKey(
2171
- { id: ID4, label: LABEL4, existingKey: readKey3(ctx) },
2274
+ { id: ID5, label: LABEL5, existingKey: readKey4(ctx) },
2172
2275
  { browser: options.browser }
2173
2276
  );
2174
2277
  return configurePi(ctx, { apiKey, model, models: models2 });
2175
2278
  },
2176
2279
  off: disablePi,
2177
- status: result4
2280
+ status: result5
2178
2281
  };
2179
2282
 
2180
2283
  // src/harnesses/prime.ts
2181
- import { join as join8 } from "path";
2182
- var ID5 = "prime";
2183
- var LABEL5 = "Prime Agent";
2284
+ import { join as join9 } from "path";
2285
+ var ID6 = "prime";
2286
+ var LABEL6 = "Prime Agent";
2184
2287
  var PROVIDER4 = "pollinations";
2185
2288
  var DEFAULT_MODEL5 = "deepseek/deepseek-v4-flash";
2186
2289
  var primeAgentDir = (ctx) => {
2187
2290
  const configured = ctx.env.PRIME_AGENT_CODING_AGENT_DIR;
2188
- if (!configured?.trim()) return join8(ctx.home, ".prime", "agent");
2291
+ if (!configured?.trim()) return join9(ctx.home, ".prime", "agent");
2189
2292
  return resolveHomePath(ctx.home, configured);
2190
2293
  };
2191
- var modelsPath2 = (ctx) => join8(primeAgentDir(ctx), "models.json");
2192
- var authPath2 = (ctx) => join8(primeAgentDir(ctx), "auth.json");
2193
- var settingsPath3 = (ctx) => join8(primeAgentDir(ctx), "settings.json");
2194
- var skillPath2 = (ctx) => join8(primeAgentDir(ctx), "skills", "polli", "SKILL.md");
2195
- var files5 = (ctx) => [
2294
+ var modelsPath2 = (ctx) => join9(primeAgentDir(ctx), "models.json");
2295
+ var authPath2 = (ctx) => join9(primeAgentDir(ctx), "auth.json");
2296
+ var settingsPath3 = (ctx) => join9(primeAgentDir(ctx), "settings.json");
2297
+ var skillPath2 = (ctx) => join9(primeAgentDir(ctx), "skills", "polli", "SKILL.md");
2298
+ var files6 = (ctx) => [
2196
2299
  modelsPath2(ctx),
2197
2300
  authPath2(ctx),
2198
2301
  settingsPath3(ctx),
@@ -2228,7 +2331,7 @@ var providerEntry2 = (models2) => ({
2228
2331
  contextWindow: model.contextWindow
2229
2332
  }))
2230
2333
  });
2231
- var readKey4 = (ctx) => {
2334
+ var readKey5 = (ctx) => {
2232
2335
  const auth = loadJson3(authPath2(ctx));
2233
2336
  const credential = auth[PROVIDER4];
2234
2337
  return credential?.type === "api_key" && credential.key ? credential.key : null;
@@ -2284,35 +2387,35 @@ var stripConfig5 = (ctx) => {
2284
2387
  }
2285
2388
  return changed;
2286
2389
  };
2287
- var result5 = (ctx) => {
2390
+ var result6 = (ctx) => {
2288
2391
  const doc = loadJson3(modelsPath2(ctx));
2289
2392
  const provider = doc?.providers?.[PROVIDER4];
2290
2393
  const settings = loadJson3(settingsPath3(ctx));
2291
2394
  const model = settings?.defaultProvider === PROVIDER4 ? settings.defaultModel : void 0;
2292
2395
  return {
2293
- harness: ID5,
2294
- label: LABEL5,
2295
- configured: provider?.baseUrl === `${BASE_URL}/v1` && provider?.api === "openai-completions" && provider?.apiKey === PROVIDER4 && readKey4(ctx) !== null && readTextIfExists(skillPath2(ctx)) !== null,
2396
+ harness: ID6,
2397
+ label: LABEL6,
2398
+ configured: provider?.baseUrl === `${BASE_URL}/v1` && provider?.api === "openai-completions" && provider?.apiKey === PROVIDER4 && readKey5(ctx) !== null && readTextIfExists(skillPath2(ctx)) !== null,
2296
2399
  model: typeof model === "string" ? model : void 0,
2297
- files: files5(ctx)
2400
+ files: files6(ctx)
2298
2401
  };
2299
2402
  };
2300
2403
  var configurePrime = (ctx, models2, apiKey, model) => {
2301
2404
  applyWithSnapshot(
2302
2405
  ctx,
2303
- ID5,
2304
- files5(ctx),
2406
+ ID6,
2407
+ files6(ctx),
2305
2408
  () => writeConfig5(ctx, models2, apiKey, model)
2306
2409
  );
2307
- return result5(ctx);
2410
+ return result6(ctx);
2308
2411
  };
2309
2412
  var disablePrime = (ctx) => {
2310
- const outcome = restoreOrStrip(ctx, ID5, files5(ctx), () => stripConfig5(ctx));
2311
- return { ...result5(ctx), configured: false, outcome };
2413
+ const outcome = restoreOrStrip(ctx, ID6, files6(ctx), () => stripConfig5(ctx));
2414
+ return { ...result6(ctx), configured: false, outcome };
2312
2415
  };
2313
2416
  var prime = {
2314
- id: ID5,
2315
- label: LABEL5,
2417
+ id: ID6,
2418
+ label: LABEL6,
2316
2419
  description: "Add Pollinations as a custom provider in Prime Agent",
2317
2420
  restartHint: "Models reload when you open /model. Start Prime Agent with: prime-agent",
2318
2421
  async on(ctx, options) {
@@ -2324,17 +2427,24 @@ var prime = {
2324
2427
  const model = options.model ?? DEFAULT_MODEL5;
2325
2428
  const models2 = await fetchHarnessModels(model);
2326
2429
  const apiKey = await resolveHarnessKey(
2327
- { id: ID5, label: LABEL5, existingKey: readKey4(ctx) },
2430
+ { id: ID6, label: LABEL6, existingKey: readKey5(ctx) },
2328
2431
  { browser: options.browser }
2329
2432
  );
2330
2433
  return configurePrime(ctx, models2, apiKey, model);
2331
2434
  },
2332
2435
  off: disablePrime,
2333
- status: result5
2436
+ status: result6
2334
2437
  };
2335
2438
 
2336
2439
  // src/harnesses/index.ts
2337
- var HARNESSES = [dsh, opencode, openclaw, pi, prime];
2440
+ var HARNESSES = [
2441
+ bloom,
2442
+ dsh,
2443
+ opencode,
2444
+ openclaw,
2445
+ pi,
2446
+ prime
2447
+ ];
2338
2448
 
2339
2449
  // src/commands/harness.ts
2340
2450
  var context = () => ({ home: homedir2(), env: process.env });
@@ -2345,22 +2455,22 @@ var OFF_MESSAGES = {
2345
2455
  };
2346
2456
  var runOn = async (harness, options) => {
2347
2457
  try {
2348
- const result6 = await harness.on(context(), options);
2349
- const model = result6.model ? ` (model: ${result6.model})` : "";
2458
+ const result7 = await harness.on(context(), options);
2459
+ const model = result7.model ? ` (model: ${result7.model})` : "";
2350
2460
  printSuccess(`${harness.label} now uses Pollinations${model}.`);
2351
2461
  printInfo(harness.restartHint);
2352
- printResult(result6);
2462
+ printResult(result7);
2353
2463
  } catch (error) {
2354
2464
  fail(`Failed to connect ${harness.label}`, error);
2355
2465
  }
2356
2466
  };
2357
2467
  var runOff = async (harness) => {
2358
2468
  try {
2359
- const result6 = await harness.off(context());
2360
- const outcome = result6.outcome ?? "unchanged";
2469
+ const result7 = await harness.off(context());
2470
+ const outcome = result7.outcome ?? "unchanged";
2361
2471
  printSuccess(`${harness.label}: ${OFF_MESSAGES[outcome]}`);
2362
2472
  if (outcome !== "unchanged") printInfo(harness.restartHint);
2363
- printResult(result6);
2473
+ printResult(result7);
2364
2474
  } catch (error) {
2365
2475
  fail(`Failed to disconnect ${harness.label}`, error);
2366
2476
  }
@@ -2874,7 +2984,7 @@ function printModels(models2) {
2874
2984
  inputs: model.type === "proxy" ? model.inputModalities?.join(", ") || "-" : "-",
2875
2985
  visibility: model.type === "proxy" && model.paidOnly ? `${model.visibility} (paid only)` : model.visibility,
2876
2986
  upstream: model.type === "proxy" && model.modality === "video" ? "-" : model.upstreamModel ?? "-",
2877
- api: model.type === "prompt_agent" ? "responses" : model.api ?? "-",
2987
+ api: model.type === "prompt_agent" || model.type === "code_agent" ? "responses" : model.api ?? "-",
2878
2988
  endpoint: model.url ?? model.baseUrl ?? "-",
2879
2989
  fallbacks: model.type === "proxy" ? model.fallbacks?.join(", ") || "-" : "-",
2880
2990
  description: model.description ?? "-"