@pollinations/cli 0.1.50 → 0.1.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -4
- package/SKILL.md +3 -3
- package/dist/index.js +141 -95
- 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.52",
|
|
18
18
|
description: "The Pollinations CLI \u2014 for humans, AI agents, and everything in between",
|
|
19
19
|
type: "module",
|
|
20
20
|
bin: {
|
|
@@ -751,6 +751,9 @@ var update = new Command("update").description("Update an agent; fields you leav
|
|
|
751
751
|
else {
|
|
752
752
|
printSuccess(`Agent updated: ${agent.id}`);
|
|
753
753
|
printAgents([agent]);
|
|
754
|
+
printInfo(
|
|
755
|
+
"It can take a minute or two before this is callable."
|
|
756
|
+
);
|
|
754
757
|
}
|
|
755
758
|
} catch (error) {
|
|
756
759
|
printError(
|
|
@@ -843,9 +846,20 @@ var docsCommand = new Command3("docs").description("Show Pollinations API docume
|
|
|
843
846
|
sections[sections.length - 1] += line;
|
|
844
847
|
}
|
|
845
848
|
const needle = endpoint.replace(/^\//, "").toLowerCase();
|
|
846
|
-
const headingMatches =
|
|
847
|
-
|
|
848
|
-
)
|
|
849
|
+
const headingMatches = [];
|
|
850
|
+
let selectedLevel = 0;
|
|
851
|
+
for (const section of sections) {
|
|
852
|
+
const level = section.match(/^(#{1,6}) /)?.[1].length;
|
|
853
|
+
if (!level) continue;
|
|
854
|
+
if (selectedLevel && level > selectedLevel) {
|
|
855
|
+
headingMatches[headingMatches.length - 1] += section;
|
|
856
|
+
} else if (section.split("\n")[0].toLowerCase().includes(needle)) {
|
|
857
|
+
selectedLevel = level;
|
|
858
|
+
headingMatches.push(section);
|
|
859
|
+
} else {
|
|
860
|
+
selectedLevel = 0;
|
|
861
|
+
}
|
|
862
|
+
}
|
|
849
863
|
const matches = headingMatches.length ? headingMatches : sections.filter(
|
|
850
864
|
(s) => s.toLowerCase().includes(needle)
|
|
851
865
|
);
|
|
@@ -2734,7 +2748,7 @@ import { parseEnv as parseEnv2 } from "util";
|
|
|
2734
2748
|
import { isMap, isSeq, parseDocument, Scalar } from "yaml";
|
|
2735
2749
|
|
|
2736
2750
|
// SKILL.md?raw
|
|
2737
|
-
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\nFor agent-assisted login, use `polli --json auth login --no-browser`. Read stderr while the command runs and show the user the verification URL and user code so they can review access. On approval, stdout contains one JSON result: `{"authenticated":true}`. Tokens are stored locally and never included in that result.\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Agent-assisted login | `polli --json auth login --no-browser` |\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| Generate a 3D model | `polli gen 3d "<prompt>" --output out.glb` (or `--image <url>` for image-only models) |\n| Embed text | `polli gen embeddings "<text>" ["<text2>" ...]` (one vector per line; also reads stdin) |\n| Change a voice | `polli gen voice-change talk.mp3 --voice nova` |\n| Isolate speech | `polli gen isolate interview.mp4` (strips music/noise) |\n| Speech + character timings | `polli gen audio "<text>" --timestamps` (also writes `speech.mp3.json`) |\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` (text, image, audio, video, 3d, embedding) |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`) |\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| Update the CLI | `polli update` (global installs only; npx/local get instructions) |\n| Connect a coding harness to Pollinations | `polli harness <bloom\\|dsh\\|hermes\\|opencode\\|openclaw\\|pi\\|prime\\|tgpt> on` (available adapters: `polli harness --help`) |\n| Start a Linux sandbox (alpha) | `polli sandbox create` (`--timeout <seconds>` to keep it running without ssh, `0` until you pause or kill it; `pollinations-large` as the template for 4 vCPU and 8 GB; then `list`, `logs <id>`, `timeout <id> <seconds>`, `pause <id>`, `kill <id>`); the default template comes logged in, with the coding harnesses |\n| ssh / scp / rsync into a sandbox | `ssh <sandbox-id>.polli`. Port forwarding (`ssh -L 3000:localhost:3000 <sandbox-id>.polli`) and VS Code Remote-SSH work. An open connection keeps the sandbox running and paid; it pauses 15\u201320 minutes after the last one closes (5\u201310 on Windows) |\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` (or `polli whoami`).\nOverride the stored key for a single command with `--key <key>`.\nPrefix any command with `POLLINATIONS_ENV=staging` to use staging; it keeps its own login, so run `POLLINATIONS_ENV=staging polli auth login` once.\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: `tongyi-mai/z-image-turbo`, 1024x1024. Without `--output` the file is `image.<ext>`, with the extension inferred from the response\'s `Content-Type` (`tongyi-mai/z-image-turbo` and `black-forest-labs/flux.1-schnell` return JPEG, so `image.jpg`); an explicit `--output` is used as given. Pick a different model with `--model black-forest-labs/flux.1-schnell` (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 `black-forest-labs/flux.1-schnell` and `tongyi-mai/z-image-turbo` 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: `google/gemini-2.5-flash-image`, `black-forest-labs/flux.1-kontext-pro`, `prunaai/p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe). **Img2img models may treat `--width`/`--height` as a hint** and keep the source aspect \u2014 check the output with `file`/`ffprobe`; if the aspect matters, pre-crop the source or crop afterwards.\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>` streams one raw-file request to `media.pollinations.ai` (400 MiB 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/gpt-5.4-nano --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```\nWithout `--voice`, the API uses the model\'s default voice. 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 (elevenlabs/music-v2)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenlabs/music-v2 --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (elevenlabs/eleven-text-to-sound-v2)\n```bash\npolli gen audio "thunderclap with heavy rain" --model elevenlabs/eleven-text-to-sound-v2 --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 (elevenlabs/eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model elevenlabs/eleven-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 alibaba/wan-2.2-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model alibaba/wan-2.2-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. The same applies to `--type 3d`.\n\n### Generate a 3D model\n```bash\npolli gen 3d "a red fox" --output fox.glb\npolli gen 3d --image https://media.pollinations.ai/abc --resolution high\n```\n`--model` defaults to `hyper3d/rodin-2.5` for a text-only prompt and `microsoft/trellis-2` once `--image <url>` is given (public http(s), upload local files first with `polli upload`) \u2014 `trellis-2` is **image-to-3D only** and rejects a bare prompt. `--resolution low|medium|high` only affects `trellis-2`. The output extension is inferred from the response\'s `Content-Type`, not the model name: `nvidia/asset-harvester` returns a Gaussian Splat `.ply`, everything else returns `.glb`. `hyper3d/rodin-2.5` and `nvidia/asset-harvester` require Paid Pollen.\n\n### Generate embeddings\n```bash\npolli gen embeddings "first text" "second text" --model google/gemini-embedding-2\nprintf \'first\\nsecond\\n\' | polli gen embeddings # one input per stdin line\n```\nPrints one JSON array per input, in input order, one per line (pipe/`jq`-friendly). `--dimensions <n>` (128-4096), `--task-type` (Gemini retrieval hint), and `--input-type query|document` (Cohere) are optional. `--json` prints the full response including `usage`.\n\n### Change or isolate a voice\n```bash\npolli gen voice-change talk.mp3 --voice nova --format wav\npolli gen isolate interview.mp4\n```\n`voice-change` re-speaks a **local** audio file in another voice (preset name or ElevenLabs voice ID) \u2014 default output `voice.<format>`. `isolate` strips music/background noise from local audio **or video**, keeping only speech \u2014 default output `isolated.mp3`. Both upload the file as multipart form data; ElevenLabs requires **at least 4.6 seconds** of audio for isolation, shorter clips fail with the API\'s `audio_too_short` error.\n\n### Speech with character-level timestamps\n```bash\npolli gen audio "Hello world" --timestamps\n```\nSaves the audio as usual (`speech.mp3` by default) and appends `.json` to its path for the `alignment`/`normalized_alignment` character timings. Only `elevenlabs/eleven-v3`, `elevenlabs/eleven-flash-v2.5`, and `elevenlabs/eleven-multilingual-v2` support this \u2014 other models fail with the API\'s error message.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `openai/whisper-large-v3` (default), `elevenlabs/scribe-v2`, `assemblyai/universal-2`, `assemblyai/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 `openai/gpt-image-1-mini` lands at ~$0.008, not $0.000008. Flat-priced image models (`black-forest-labs/flux.1-schnell`, `tongyi-mai/z-image-turbo`) 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 usage --daily --key polli-harness-claude --days 1 # cost of one harness key for the last day (`--model`, `--csv` filter/export both views; `--key` is repeatable)\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window\npolli quests # your quests + claim state (open/claimable/claimed/closed/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. Those print a JSON array of the API usage records (numeric `cost_usd`, `api_key_id`, available per-modality token fields), not the table columns.\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 sync <id>\npolli agents delete <id>\n```\nPrompt-agent config contains `systemPrompt`, `baseModel`, and optional `mcpServers` (add `composio` to act in the caller\'s own accounts, such as a GitHub commit; callers connect apps at https://enter.pollinations.ai/account#connectors); 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. Updates are partial: send only the fields to change; the rest keep their values. `sync` deploys the latest GitHub revision of a code agent.\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 create --name "server" --models black-forest-labs/flux.1-schnell tongyi-mai/z-image-turbo # only these two models\npolli keys update <id> --models text black-forest-labs/flux.1-schnell # every text model plus FLUX.1 Schnell\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--models` takes categories (`text`, `image`, `video`, `audio`, `3d`, `embedding`, `realtime`) and model IDs from `polli models`. A category includes models added later; a model ID allows only that model.\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. Include `keys` to let the new key create, list, and revoke keys itself. 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\nPolli defaults to `openai/gpt-6-sol`; `--model <id>` overrides it. Bloom is key-only and keeps its own model selection.\n\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 hermes on # login if needed, mint key "polli-harness-hermes", add provider + Polli skill\npolli harness hermes on --model deepseek/deepseek-v4-flash # use the model ID from `polli models`\npolli harness hermes 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\npolli harness tgpt on # use tgpt\'s Pollinations provider with a dedicated key\npolli harness tgpt off # restore tgpt\'s previous configuration\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, Hermes Agent, OpenCode, OpenClaw, Pi, and tgpt require their installed commands.\n\nBloom already uses Pollinations and only needs a dedicated key in `$BLOOM_HOME/.env` (default `~/.bloom/.env`). tgpt\'s existing Pollinations provider is selected in `~/.config/tgpt/config.conf` with a dedicated key and model. 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` (or `polli whoami`) 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` / `polli whoami` 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- **Backgrounded `polli gen` can fail silently** \u2014 no output file, empty log, no error (a safety rejection is an explicit 400). Run in the foreground; if backgrounded, check the `--output` file exists and retry once in the foreground before calling it failed.\n- **Content-safety 400s aren\'t only about violence.** Body-focused action phrasing can trip a sexual-content category on some edit models. Rephrase the benign intent neutrally (e.g. sport framing) and retry with a new seed.\n';
|
|
2751
|
+
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\nFor agent-assisted login, use `polli --json auth login --no-browser`. Read stderr while the command runs and show the user the verification URL and user code so they can review access. On approval, stdout contains one JSON result: `{"authenticated":true}`. Tokens are stored locally and never included in that result.\n\n## Quick reference\n\n| Intent | Command |\n|---|---|\n| Log in once | `polli auth login` |\n| Agent-assisted login | `polli --json auth login --no-browser` |\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| Generate a 3D model | `polli gen 3d "<prompt>" --output out.glb` (or `--image <url>` for image-only models) |\n| Embed text | `polli gen embeddings "<text>" ["<text2>" ...]` (one vector per line; also reads stdin) |\n| Change a voice | `polli gen voice-change talk.mp3 --voice nova` |\n| Isolate speech | `polli gen isolate interview.mp4` (strips music/noise) |\n| Speech + character timings | `polli gen audio "<text>" --timestamps` (also writes `speech.mp3.json`) |\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` (text, image, audio, video, 3d, embedding) |\n| Model health + latency | `polli models --stats` (default 60m, `--window <min>`) |\n| Check balance | `polli usage` |\n| Developer earnings | `polli earnings` (`--days <n>`) |\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| Update the CLI | `polli update` (global installs only; npx/local get instructions) |\n| Connect a coding harness to Pollinations | `polli harness <bloom\\|dsh\\|hermes\\|opencode\\|openclaw\\|pi\\|prime\\|tgpt> on` (available adapters: `polli harness --help`) |\n| Start a Linux sandbox (alpha) | `polli sandbox create` (`--timeout <seconds>` to keep it running without ssh, `0` until you pause or kill it; `pollinations-large` as the template for 4 vCPU and 8 GB; then `list`, `logs <id>`, `timeout <id> <seconds>`, `pause <id>`, `kill <id>`); the default template comes logged in, with the coding harnesses |\n| ssh / scp / rsync into a sandbox | `ssh <sandbox-id>.polli`. Port forwarding (`ssh -L 3000:localhost:3000 <sandbox-id>.polli`) and VS Code Remote-SSH work. An open connection keeps the sandbox running and paid; it pauses 15\u201320 minutes after the last one closes (5\u201310 on Windows) |\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` (or `polli whoami`).\nOverride the stored key for a single command with `--key <key>`.\nPrefix any command with `POLLINATIONS_ENV=staging` to use staging; it keeps its own login, so run `POLLINATIONS_ENV=staging polli auth login` once.\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: `tongyi-mai/z-image-turbo`, 1024x1024. Without `--output` the file is `image.<ext>`, with the extension inferred from the response\'s `Content-Type` (`tongyi-mai/z-image-turbo` and `black-forest-labs/flux.1-schnell` return JPEG, so `image.jpg`); an explicit `--output` is used as given. Pick a different model with `--model black-forest-labs/flux.1-schnell` (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 `black-forest-labs/flux.1-schnell` and `tongyi-mai/z-image-turbo` 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: `google/gemini-2.5-flash-image`, `black-forest-labs/flux.1-kontext-pro`, `prunaai/p-image-edit`). To use a local file, upload it first with `polli upload` (see next recipe). **Img2img models may treat `--width`/`--height` as a hint** and keep the source aspect \u2014 check the output with `file`/`ffprobe`; if the aspect matters, pre-crop the source or crop afterwards.\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>` streams one raw-file request to `media.pollinations.ai` (400 MiB 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/gpt-5.4-nano --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```\nWithout `--voice`, the API uses the model\'s default voice. 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 (elevenlabs/music-v2)\n```bash\npolli gen audio "lofi hip-hop beat" --model elevenlabs/music-v2 --duration 30 --instrumental --output track.mp3\n```\n\n### Generate sound effects (elevenlabs/eleven-text-to-sound-v2)\n```bash\npolli gen audio "thunderclap with heavy rain" --model elevenlabs/eleven-text-to-sound-v2 --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 (elevenlabs/eleven-multilingual-v2)\n```bash\npolli gen audio "Bonjour, ceci est un test" --model elevenlabs/eleven-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 alibaba/wan-2.2-fast --duration 5 --output mars.mp4\n```\nCheapest path: `--model alibaba/wan-2.2-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. The same applies to `--type 3d`.\n\n### Generate a 3D model\n```bash\npolli gen 3d "a red fox" --output fox.glb\npolli gen 3d --image https://media.pollinations.ai/abc --resolution high\n```\n`--model` defaults to `hyper3d/rodin-2.5` for a text-only prompt and `microsoft/trellis-2` once `--image <url>` is given (public http(s), upload local files first with `polli upload`) \u2014 `trellis-2` is **image-to-3D only** and rejects a bare prompt. `--resolution low|medium|high` only affects `trellis-2`. The output extension is inferred from the response\'s `Content-Type`, not the model name: `nvidia/asset-harvester` returns a Gaussian Splat `.ply`, everything else returns `.glb`. `hyper3d/rodin-2.5` and `nvidia/asset-harvester` require Paid Pollen.\n\n### Generate embeddings\n```bash\npolli gen embeddings "first text" "second text" --model google/gemini-embedding-2\nprintf \'first\\nsecond\\n\' | polli gen embeddings # one input per stdin line\n```\nPrints one JSON array per input, in input order, one per line (pipe/`jq`-friendly). `--dimensions <n>` (128-4096), `--task-type` (Gemini retrieval hint), and `--input-type query|document` (Cohere) are optional. `--json` prints the full response including `usage`.\n\n### Change or isolate a voice\n```bash\npolli gen voice-change talk.mp3 --voice nova --format wav\npolli gen isolate interview.mp4\n```\n`voice-change` re-speaks a **local** audio file in another voice (preset name or ElevenLabs voice ID) \u2014 default output `voice.<format>`. `isolate` strips music/background noise from local audio **or video**, keeping only speech \u2014 default output `isolated.mp3`. Both upload the file as multipart form data; ElevenLabs requires **at least 4.6 seconds** of audio for isolation, shorter clips fail with the API\'s `audio_too_short` error.\n\n### Speech with character-level timestamps\n```bash\npolli gen audio "Hello world" --timestamps\n```\nSaves the audio as usual (`speech.mp3` by default) and appends `.json` to its path for the `alignment`/`normalized_alignment` character timings. Only `elevenlabs/eleven-v3`, `elevenlabs/eleven-flash-v2.5`, and `elevenlabs/eleven-multilingual-v2` support this \u2014 other models fail with the API\'s error message.\n\n### Transcribe audio to text\n```bash\npolli gen transcribe recording.mp3 --language en\n```\nModels: `openai/whisper-large-v3` (default), `elevenlabs/scribe-v2`, `assemblyai/universal-2`, `assemblyai/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 `openai/gpt-image-1-mini` lands at ~$0.008, not $0.000008. Flat-priced image models (`black-forest-labs/flux.1-schnell`, `tongyi-mai/z-image-turbo`) 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 usage --daily --key polli-harness-claude --days 1 # cost of one harness key for the last day (`--model`, `--csv` filter/export both views; `--key` is repeatable)\npolli earnings # developer earnings total + per-entity breakdown (default 30d)\npolli earnings --days 7 # rolling window\npolli quests # your quests + claim state (open/claimable/claimed/closed/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. Those print a JSON array of the API usage records (numeric `cost_usd`, `api_key_id`, available per-modality token fields), not the table columns.\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 sync <id>\npolli agents delete <id>\n```\nPrompt-agent config contains `systemPrompt`, `baseModel`, and optional `mcpServers` (add `composio` to act in the caller\'s own accounts, such as a GitHub commit; callers connect apps at https://enter.pollinations.ai/account#connectors); 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. Updates are partial: send only the fields to change; the rest keep their values. `sync` deploys the latest GitHub revision of a code agent.\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 create --name "server" --models black-forest-labs/flux.1-schnell tongyi-mai/z-image-turbo # only these two models\npolli keys update <id> --models text black-forest-labs/flux.1-schnell # every text model plus FLUX.1 Schnell\npolli keys revoke <id> # id comes from `keys list --json`\n```\n`--models` takes categories (`text`, `image`, `video`, `audio`, `3d`, `embedding`, `realtime`) and model IDs from `polli models`. A category includes models added later; a model ID allows only that model.\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. Include `keys` to let the new key create, list, and revoke keys itself. 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\nPolli defaults to `openai/gpt-6-sol`; `--model <id>` overrides it. Bloom is key-only and keeps its own model selection.\n\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 hermes on # login if needed, mint key "polli-harness-hermes", add provider + Polli skill\npolli harness hermes on --model deepseek/deepseek-v4-flash # use the model ID from `polli models`\npolli harness hermes off # restore the config backed up before "on"\npolli harness opencode on # add the Pollinations provider (OpenCode 1.x and 2.x)\npolli harness opencode off # remove the provider 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\npolli harness tgpt on # use tgpt\'s Pollinations provider with a dedicated key\npolli harness tgpt off # restore tgpt\'s previous configuration\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, Hermes Agent, OpenCode, OpenClaw, Pi, and tgpt require their installed commands.\n\nBloom already uses Pollinations and only needs a dedicated key in `$BLOOM_HOME/.env` (default `~/.bloom/.env`). tgpt\'s existing Pollinations provider is selected in `~/.config/tgpt/config.conf` with a dedicated key and model. The DSH adapter globally configures the Pollinations provider, hosted Pollinations MCP, and this skill under `$DSH_HOME` (default `~/.dsh`). OpenCode adds a `pollinations` provider (read by both 1.x and 2.x) and stores its dedicated key in the provider\'s options. 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` (or `polli whoami`) 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` / `polli whoami` 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- **Backgrounded `polli gen` can fail silently** \u2014 no output file, empty log, no error (a safety rejection is an explicit 400). Run in the foreground; if backgrounded, check the `--output` file exists and retry once in the foreground before calling it failed.\n- **Content-safety 400s aren\'t only about violence.** Body-focused action phrasing can trip a sexual-content category on some edit models. Rephrase the benign intent neutrally (e.g. sport framing) and retry with a new seed.\n';
|
|
2738
2752
|
|
|
2739
2753
|
// src/harnesses/dsh.ts
|
|
2740
2754
|
init_config();
|
|
@@ -3315,13 +3329,17 @@ var openclaw = {
|
|
|
3315
3329
|
};
|
|
3316
3330
|
|
|
3317
3331
|
// src/harnesses/opencode.ts
|
|
3332
|
+
init_config();
|
|
3318
3333
|
import { join as join10 } from "path";
|
|
3319
3334
|
import JSON52 from "json5";
|
|
3320
3335
|
var ID7 = "opencode";
|
|
3321
3336
|
var LABEL7 = "OpenCode";
|
|
3337
|
+
var PROVIDER5 = "pollinations";
|
|
3322
3338
|
var DEFAULT_MODEL6 = "openai/gpt-6-sol";
|
|
3323
|
-
var
|
|
3324
|
-
var
|
|
3339
|
+
var PROVIDER_NPM = "@ai-sdk/openai-compatible";
|
|
3340
|
+
var MAX_OUTPUT_TOKENS = 32768;
|
|
3341
|
+
var LEGACY_PLUGIN = "opencode-pollinations-plugin";
|
|
3342
|
+
var legacyConfigDir = (ctx) => {
|
|
3325
3343
|
if (process.platform === "win32") {
|
|
3326
3344
|
return join10(ctx.env.APPDATA ?? ctx.home, "pollinations");
|
|
3327
3345
|
}
|
|
@@ -3341,10 +3359,10 @@ var opencodeConfigFile = (ctx) => {
|
|
|
3341
3359
|
const dir = ctx.env.OPENCODE_CONFIG_DIR?.trim() ? resolveHomePath(ctx.home, ctx.env.OPENCODE_CONFIG_DIR) : join10(ctx.home, ".config", "opencode");
|
|
3342
3360
|
return ["opencode.jsonc", "opencode.json", "config.json"].map((name) => join10(dir, name)).find((path) => readTextIfExists(path) !== null) ?? join10(dir, "opencode.json");
|
|
3343
3361
|
};
|
|
3344
|
-
var
|
|
3362
|
+
var legacyKeyFile = (ctx) => join10(legacyConfigDir(ctx), "config.json");
|
|
3345
3363
|
var files5 = (ctx) => [
|
|
3346
3364
|
opencodeConfigFile(ctx),
|
|
3347
|
-
|
|
3365
|
+
legacyKeyFile(ctx)
|
|
3348
3366
|
];
|
|
3349
3367
|
var readJson = (path) => {
|
|
3350
3368
|
const text = readTextIfExists(path);
|
|
@@ -3363,25 +3381,40 @@ var readJson = (path) => {
|
|
|
3363
3381
|
};
|
|
3364
3382
|
var writeJson = (path, data) => writeTextAtomic(path, `${JSON.stringify(data, null, 2)}
|
|
3365
3383
|
`, 384);
|
|
3366
|
-
var
|
|
3367
|
-
|
|
3384
|
+
var openCodeConfig = (ctx) => readJson(opencodeConfigFile(ctx)) ?? {};
|
|
3385
|
+
var providersOf = (config) => {
|
|
3386
|
+
const providers = config.provider;
|
|
3387
|
+
return providers !== null && typeof providers === "object" ? providers : {};
|
|
3388
|
+
};
|
|
3389
|
+
var isOurProvider = (entry) => {
|
|
3390
|
+
if (entry === null || typeof entry !== "object") return false;
|
|
3391
|
+
const options = entry.options;
|
|
3392
|
+
return options !== null && typeof options === "object" && options.baseURL === `${BASE_URL}/v1`;
|
|
3393
|
+
};
|
|
3394
|
+
var isLegacyPlugin = (entry) => typeof entry === "string" ? entry === LEGACY_PLUGIN || entry.includes(LEGACY_PLUGIN) : entry !== null && typeof entry === "object" && Object.values(entry).some(
|
|
3395
|
+
(value) => typeof value === "string" && value.includes(LEGACY_PLUGIN)
|
|
3368
3396
|
);
|
|
3369
3397
|
var pluginListKey = (config) => Array.isArray(config.plugins) && !Array.isArray(config.plugin) ? "plugins" : "plugin";
|
|
3370
|
-
var
|
|
3371
|
-
const
|
|
3372
|
-
|
|
3398
|
+
var removeLegacyPlugin = (config) => {
|
|
3399
|
+
const key = pluginListKey(config);
|
|
3400
|
+
const entries = config[key];
|
|
3401
|
+
if (!Array.isArray(entries) || !entries.some(isLegacyPlugin)) return false;
|
|
3402
|
+
const filtered = entries.filter((entry) => !isLegacyPlugin(entry));
|
|
3403
|
+
if (filtered.length === 0) delete config[key];
|
|
3404
|
+
else config[key] = filtered;
|
|
3405
|
+
return true;
|
|
3373
3406
|
};
|
|
3374
|
-
var
|
|
3375
|
-
const
|
|
3407
|
+
var readKey5 = (ctx) => {
|
|
3408
|
+
const entry = providersOf(openCodeConfig(ctx))[PROVIDER5];
|
|
3409
|
+
const key = isOurProvider(entry) ? entry.options.apiKey : void 0;
|
|
3376
3410
|
return typeof key === "string" && key.length > 5 ? key : null;
|
|
3377
3411
|
};
|
|
3378
|
-
var
|
|
3379
|
-
const
|
|
3380
|
-
|
|
3381
|
-
writeJson(pluginConfigFile(ctx), config);
|
|
3412
|
+
var legacyKey = (ctx) => {
|
|
3413
|
+
const key = readJson(legacyKeyFile(ctx))?.apiKey;
|
|
3414
|
+
return typeof key === "string" && key.length > 5 ? key : null;
|
|
3382
3415
|
};
|
|
3383
|
-
var
|
|
3384
|
-
const path =
|
|
3416
|
+
var deleteLegacyKey = (ctx) => {
|
|
3417
|
+
const path = legacyKeyFile(ctx);
|
|
3385
3418
|
const config = readJson(path);
|
|
3386
3419
|
if (config === null || config.apiKey === void 0) return false;
|
|
3387
3420
|
delete config.apiKey;
|
|
@@ -3389,62 +3422,74 @@ var deleteApiKey = (ctx) => {
|
|
|
3389
3422
|
else writeJson(path, config);
|
|
3390
3423
|
return true;
|
|
3391
3424
|
};
|
|
3392
|
-
var
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3425
|
+
var providerBlock = (models2, apiKey) => ({
|
|
3426
|
+
npm: PROVIDER_NPM,
|
|
3427
|
+
name: "Pollinations",
|
|
3428
|
+
options: { baseURL: `${BASE_URL}/v1`, apiKey },
|
|
3429
|
+
models: Object.fromEntries(
|
|
3430
|
+
models2.map((model) => [
|
|
3431
|
+
model.id,
|
|
3432
|
+
{
|
|
3433
|
+
name: model.id,
|
|
3434
|
+
tool_call: true,
|
|
3435
|
+
limit: {
|
|
3436
|
+
context: model.contextWindow,
|
|
3437
|
+
output: Math.min(model.contextWindow, MAX_OUTPUT_TOKENS)
|
|
3438
|
+
},
|
|
3439
|
+
modalities: { input: model.input, output: ["text"] }
|
|
3440
|
+
}
|
|
3441
|
+
])
|
|
3442
|
+
)
|
|
3443
|
+
});
|
|
3444
|
+
var writeConfig4 = (ctx, settings) => {
|
|
3445
|
+
const path = opencodeConfigFile(ctx);
|
|
3396
3446
|
const config = openCodeConfig(ctx);
|
|
3397
3447
|
if (typeof config.$schema !== "string") {
|
|
3398
3448
|
config.$schema = "https://opencode.ai/config.json";
|
|
3399
3449
|
}
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
}
|
|
3405
|
-
config
|
|
3406
|
-
writeJson(
|
|
3450
|
+
config.provider = {
|
|
3451
|
+
...providersOf(config),
|
|
3452
|
+
[PROVIDER5]: providerBlock(settings.models, settings.apiKey)
|
|
3453
|
+
};
|
|
3454
|
+
config.model = `${PROVIDER5}/${settings.model}`;
|
|
3455
|
+
removeLegacyPlugin(config);
|
|
3456
|
+
writeJson(path, config);
|
|
3457
|
+
deleteLegacyKey(ctx);
|
|
3407
3458
|
};
|
|
3408
|
-
var
|
|
3459
|
+
var stripConfig4 = (ctx) => {
|
|
3460
|
+
let changed = false;
|
|
3409
3461
|
const path = opencodeConfigFile(ctx);
|
|
3410
3462
|
const config = readJson(path);
|
|
3411
|
-
if (config
|
|
3412
|
-
|
|
3413
|
-
|
|
3414
|
-
|
|
3415
|
-
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
|
|
3419
|
-
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
|
|
3423
|
-
changed = true;
|
|
3463
|
+
if (config !== null) {
|
|
3464
|
+
const providers = providersOf(config);
|
|
3465
|
+
if (isOurProvider(providers[PROVIDER5])) {
|
|
3466
|
+
delete providers[PROVIDER5];
|
|
3467
|
+
if (Object.keys(providers).length === 0) delete config.provider;
|
|
3468
|
+
else config.provider = providers;
|
|
3469
|
+
changed = true;
|
|
3470
|
+
}
|
|
3471
|
+
if (isOurModel(config.model)) {
|
|
3472
|
+
delete config.model;
|
|
3473
|
+
changed = true;
|
|
3474
|
+
}
|
|
3475
|
+
if (removeLegacyPlugin(config)) changed = true;
|
|
3476
|
+
if (changed) writeJson(path, config);
|
|
3424
3477
|
}
|
|
3425
|
-
if (
|
|
3478
|
+
if (deleteLegacyKey(ctx)) changed = true;
|
|
3426
3479
|
return changed;
|
|
3427
3480
|
};
|
|
3481
|
+
var isOurModel = (model) => typeof model === "string" && model.startsWith(`${PROVIDER5}/`);
|
|
3428
3482
|
var result5 = (ctx) => {
|
|
3429
3483
|
const config = openCodeConfig(ctx);
|
|
3430
|
-
const model =
|
|
3484
|
+
const model = isOurModel(config.model) ? config.model.slice(PROVIDER5.length + 1) : void 0;
|
|
3431
3485
|
return {
|
|
3432
3486
|
harness: ID7,
|
|
3433
3487
|
label: LABEL7,
|
|
3434
|
-
configured:
|
|
3488
|
+
configured: isOurProvider(providersOf(config)[PROVIDER5]) && isOurModel(config.model) && readKey5(ctx) !== null,
|
|
3435
3489
|
model,
|
|
3436
3490
|
files: files5(ctx)
|
|
3437
3491
|
};
|
|
3438
3492
|
};
|
|
3439
|
-
var writeConfig4 = (ctx, settings) => {
|
|
3440
|
-
writeOpenCodeConfig(ctx, settings.model);
|
|
3441
|
-
writeApiKey(ctx, settings.apiKey);
|
|
3442
|
-
};
|
|
3443
|
-
var stripConfig4 = (ctx) => {
|
|
3444
|
-
let changed = stripOpenCodeConfig(ctx);
|
|
3445
|
-
changed = deleteApiKey(ctx) || changed;
|
|
3446
|
-
return changed;
|
|
3447
|
-
};
|
|
3448
3493
|
var configureOpenCode = (ctx, settings) => {
|
|
3449
3494
|
applyWithSnapshot(ctx, ID7, files5(ctx), () => writeConfig4(ctx, settings));
|
|
3450
3495
|
return result5(ctx);
|
|
@@ -3460,7 +3505,7 @@ var opencode = {
|
|
|
3460
3505
|
id: ID7,
|
|
3461
3506
|
label: LABEL7,
|
|
3462
3507
|
description: "Configure OpenCode to use Pollinations",
|
|
3463
|
-
restartHint: "Restart OpenCode, then pick a Pollinations model with /models.
|
|
3508
|
+
restartHint: "Restart OpenCode, then pick a Pollinations model with /models. Run `polli mcp install opencode --all` to add the media tools.",
|
|
3464
3509
|
async on(ctx, options) {
|
|
3465
3510
|
if (!openCodeInstalled(ctx)) {
|
|
3466
3511
|
throw new Error(
|
|
@@ -3468,17 +3513,16 @@ var opencode = {
|
|
|
3468
3513
|
);
|
|
3469
3514
|
}
|
|
3470
3515
|
const model = options.model ?? DEFAULT_MODEL6;
|
|
3471
|
-
await fetchHarnessModels(model);
|
|
3516
|
+
const models2 = await fetchHarnessModels(model);
|
|
3472
3517
|
const apiKey = await resolveHarnessKey(
|
|
3473
3518
|
{
|
|
3474
3519
|
id: ID7,
|
|
3475
3520
|
label: LABEL7,
|
|
3476
|
-
existingKey:
|
|
3477
|
-
accountPermissions: ["profile", "usage"]
|
|
3521
|
+
existingKey: readKey5(ctx) ?? legacyKey(ctx)
|
|
3478
3522
|
},
|
|
3479
3523
|
{ browser: options.browser }
|
|
3480
3524
|
);
|
|
3481
|
-
return configureOpenCode(ctx, { apiKey, model });
|
|
3525
|
+
return configureOpenCode(ctx, { apiKey, model, models: models2 });
|
|
3482
3526
|
},
|
|
3483
3527
|
off: disableOpenCode,
|
|
3484
3528
|
status: result5
|
|
@@ -3489,7 +3533,7 @@ import { join as join11 } from "path";
|
|
|
3489
3533
|
init_config();
|
|
3490
3534
|
var ID8 = "pi";
|
|
3491
3535
|
var LABEL8 = "Pi";
|
|
3492
|
-
var
|
|
3536
|
+
var PROVIDER6 = "pollinations";
|
|
3493
3537
|
var DEFAULT_MODEL7 = "openai/gpt-6-sol";
|
|
3494
3538
|
var piAgentDir = (ctx) => {
|
|
3495
3539
|
const configured = ctx.env.PI_CODING_AGENT_DIR;
|
|
@@ -3515,9 +3559,9 @@ var saveJson2 = (path, data) => {
|
|
|
3515
3559
|
writeTextAtomic(path, `${JSON.stringify(data, null, 2)}
|
|
3516
3560
|
`, 384);
|
|
3517
3561
|
};
|
|
3518
|
-
var
|
|
3562
|
+
var readKey6 = (ctx) => {
|
|
3519
3563
|
const auth = loadJson2(authPath(ctx));
|
|
3520
|
-
const entry = auth[
|
|
3564
|
+
const entry = auth[PROVIDER6];
|
|
3521
3565
|
if (!entry || typeof entry !== "object") return null;
|
|
3522
3566
|
const key = entry.key;
|
|
3523
3567
|
return typeof key === "string" && key ? key : null;
|
|
@@ -3545,14 +3589,14 @@ var writeConfig5 = (ctx, settings) => {
|
|
|
3545
3589
|
const providers = modelsData.providers ?? {};
|
|
3546
3590
|
modelsData.providers = {
|
|
3547
3591
|
...providers,
|
|
3548
|
-
[
|
|
3592
|
+
[PROVIDER6]: providerConfig2(settings.models)
|
|
3549
3593
|
};
|
|
3550
3594
|
saveJson2(modelsPath(ctx), modelsData);
|
|
3551
3595
|
const auth = loadJson2(authPath(ctx));
|
|
3552
|
-
auth[
|
|
3596
|
+
auth[PROVIDER6] = { type: "api_key", key: settings.apiKey };
|
|
3553
3597
|
saveJson2(authPath(ctx), auth);
|
|
3554
3598
|
const piSettings = loadJson2(settingsPath3(ctx));
|
|
3555
|
-
piSettings.defaultProvider =
|
|
3599
|
+
piSettings.defaultProvider = PROVIDER6;
|
|
3556
3600
|
piSettings.defaultModel = settings.model;
|
|
3557
3601
|
saveJson2(settingsPath3(ctx), piSettings);
|
|
3558
3602
|
if (readTextIfExists(skillFile2(ctx)) === null) {
|
|
@@ -3564,8 +3608,8 @@ var stripConfig5 = (ctx) => {
|
|
|
3564
3608
|
const modelsText = readTextIfExists(modelsPath(ctx));
|
|
3565
3609
|
if (modelsText?.trim()) {
|
|
3566
3610
|
const data = JSON.parse(modelsText);
|
|
3567
|
-
if (data.providers && typeof data.providers === "object" &&
|
|
3568
|
-
delete data.providers[
|
|
3611
|
+
if (data.providers && typeof data.providers === "object" && PROVIDER6 in data.providers) {
|
|
3612
|
+
delete data.providers[PROVIDER6];
|
|
3569
3613
|
saveJson2(modelsPath(ctx), data);
|
|
3570
3614
|
changed = true;
|
|
3571
3615
|
}
|
|
@@ -3573,8 +3617,8 @@ var stripConfig5 = (ctx) => {
|
|
|
3573
3617
|
const authText = readTextIfExists(authPath(ctx));
|
|
3574
3618
|
if (authText?.trim()) {
|
|
3575
3619
|
const data = JSON.parse(authText);
|
|
3576
|
-
if (
|
|
3577
|
-
delete data[
|
|
3620
|
+
if (PROVIDER6 in data) {
|
|
3621
|
+
delete data[PROVIDER6];
|
|
3578
3622
|
saveJson2(authPath(ctx), data);
|
|
3579
3623
|
changed = true;
|
|
3580
3624
|
}
|
|
@@ -3582,7 +3626,7 @@ var stripConfig5 = (ctx) => {
|
|
|
3582
3626
|
const settingsText = readTextIfExists(settingsPath3(ctx));
|
|
3583
3627
|
if (settingsText?.trim()) {
|
|
3584
3628
|
const data = JSON.parse(settingsText);
|
|
3585
|
-
if (data.defaultProvider ===
|
|
3629
|
+
if (data.defaultProvider === PROVIDER6) {
|
|
3586
3630
|
delete data.defaultProvider;
|
|
3587
3631
|
delete data.defaultModel;
|
|
3588
3632
|
saveJson2(settingsPath3(ctx), data);
|
|
@@ -3600,11 +3644,11 @@ var result6 = (ctx) => {
|
|
|
3600
3644
|
const authData = loadJson2(authPath(ctx));
|
|
3601
3645
|
const settingsData = loadJson2(settingsPath3(ctx));
|
|
3602
3646
|
const providers = modelsData.providers;
|
|
3603
|
-
const provider2 = providers?.[
|
|
3647
|
+
const provider2 = providers?.[PROVIDER6];
|
|
3604
3648
|
const hasProvider = provider2?.baseUrl === `${BASE_URL}/v1` && provider2?.api === "openai-completions";
|
|
3605
|
-
const authEntry = authData[
|
|
3649
|
+
const authEntry = authData[PROVIDER6];
|
|
3606
3650
|
const hasKey = authEntry?.type === "api_key" && typeof authEntry.key === "string" && !!authEntry.key;
|
|
3607
|
-
const hasDefaultProvider = settingsData.defaultProvider ===
|
|
3651
|
+
const hasDefaultProvider = settingsData.defaultProvider === PROVIDER6;
|
|
3608
3652
|
const model = typeof settingsData.defaultModel === "string" ? settingsData.defaultModel : void 0;
|
|
3609
3653
|
return {
|
|
3610
3654
|
harness: ID8,
|
|
@@ -3636,7 +3680,7 @@ var pi = {
|
|
|
3636
3680
|
const model = options.model ?? DEFAULT_MODEL7;
|
|
3637
3681
|
const models2 = await fetchHarnessModels(model);
|
|
3638
3682
|
const apiKey = await resolveHarnessKey(
|
|
3639
|
-
{ id: ID8, label: LABEL8, existingKey:
|
|
3683
|
+
{ id: ID8, label: LABEL8, existingKey: readKey6(ctx) },
|
|
3640
3684
|
{ browser: options.browser }
|
|
3641
3685
|
);
|
|
3642
3686
|
return configurePi(ctx, { apiKey, model, models: models2 });
|
|
@@ -3650,7 +3694,7 @@ import { join as join12 } from "path";
|
|
|
3650
3694
|
init_config();
|
|
3651
3695
|
var ID9 = "prime";
|
|
3652
3696
|
var LABEL9 = "Prime Agent";
|
|
3653
|
-
var
|
|
3697
|
+
var PROVIDER7 = "pollinations";
|
|
3654
3698
|
var DEFAULT_MODEL8 = "openai/gpt-6-sol";
|
|
3655
3699
|
var primeAgentDir = (ctx) => {
|
|
3656
3700
|
const configured = ctx.env.PRIME_AGENT_CODING_AGENT_DIR;
|
|
@@ -3688,7 +3732,7 @@ var providerEntry2 = (models2) => ({
|
|
|
3688
3732
|
baseUrl: `${BASE_URL}/v1`,
|
|
3689
3733
|
api: "openai-completions",
|
|
3690
3734
|
// Prime validates custom providers before resolving their auth.json entry.
|
|
3691
|
-
apiKey:
|
|
3735
|
+
apiKey: PROVIDER7,
|
|
3692
3736
|
compat,
|
|
3693
3737
|
models: models2.map((model) => ({
|
|
3694
3738
|
id: model.id,
|
|
@@ -3697,20 +3741,20 @@ var providerEntry2 = (models2) => ({
|
|
|
3697
3741
|
contextWindow: model.contextWindow
|
|
3698
3742
|
}))
|
|
3699
3743
|
});
|
|
3700
|
-
var
|
|
3744
|
+
var readKey7 = (ctx) => {
|
|
3701
3745
|
const auth = loadJson3(authPath2(ctx));
|
|
3702
|
-
const credential = auth[
|
|
3746
|
+
const credential = auth[PROVIDER7];
|
|
3703
3747
|
return credential?.type === "api_key" && credential.key ? credential.key : null;
|
|
3704
3748
|
};
|
|
3705
3749
|
var writeAuth = (ctx, apiKey) => {
|
|
3706
3750
|
const auth = loadJson3(authPath2(ctx));
|
|
3707
|
-
auth[
|
|
3751
|
+
auth[PROVIDER7] = { type: "api_key", key: apiKey };
|
|
3708
3752
|
saveJson3(authPath2(ctx), auth);
|
|
3709
3753
|
};
|
|
3710
3754
|
var deleteAuth = (ctx) => {
|
|
3711
3755
|
const auth = loadJson3(authPath2(ctx));
|
|
3712
|
-
if (!(
|
|
3713
|
-
delete auth[
|
|
3756
|
+
if (!(PROVIDER7 in auth)) return false;
|
|
3757
|
+
delete auth[PROVIDER7];
|
|
3714
3758
|
if (Object.keys(auth).length === 0) removeIfExists(authPath2(ctx));
|
|
3715
3759
|
else saveJson3(authPath2(ctx), auth);
|
|
3716
3760
|
return true;
|
|
@@ -3718,12 +3762,12 @@ var deleteAuth = (ctx) => {
|
|
|
3718
3762
|
var writeConfig6 = (ctx, models2, apiKey, model) => {
|
|
3719
3763
|
const doc = loadJson3(modelsPath2(ctx));
|
|
3720
3764
|
const providers = doc.providers ?? {};
|
|
3721
|
-
providers[
|
|
3765
|
+
providers[PROVIDER7] = providerEntry2(models2);
|
|
3722
3766
|
doc.providers = providers;
|
|
3723
3767
|
saveJson3(modelsPath2(ctx), doc);
|
|
3724
3768
|
writeAuth(ctx, apiKey);
|
|
3725
3769
|
const settings = loadJson3(settingsPath4(ctx));
|
|
3726
|
-
settings.defaultProvider =
|
|
3770
|
+
settings.defaultProvider = PROVIDER7;
|
|
3727
3771
|
settings.defaultModel = model;
|
|
3728
3772
|
saveJson3(settingsPath4(ctx), settings);
|
|
3729
3773
|
if (readTextIfExists(skillPath3(ctx)) === null) {
|
|
@@ -3733,15 +3777,15 @@ var writeConfig6 = (ctx, models2, apiKey, model) => {
|
|
|
3733
3777
|
var stripConfig6 = (ctx) => {
|
|
3734
3778
|
let changed = false;
|
|
3735
3779
|
const doc = loadJson3(modelsPath2(ctx));
|
|
3736
|
-
if (doc?.providers &&
|
|
3737
|
-
delete doc.providers[
|
|
3780
|
+
if (doc?.providers && PROVIDER7 in doc.providers) {
|
|
3781
|
+
delete doc.providers[PROVIDER7];
|
|
3738
3782
|
if (Object.keys(doc.providers).length === 0) delete doc.providers;
|
|
3739
3783
|
saveJson3(modelsPath2(ctx), doc);
|
|
3740
3784
|
changed = true;
|
|
3741
3785
|
}
|
|
3742
3786
|
changed = deleteAuth(ctx) || changed;
|
|
3743
3787
|
const settings = loadJson3(settingsPath4(ctx));
|
|
3744
|
-
if (settings && settings.defaultProvider ===
|
|
3788
|
+
if (settings && settings.defaultProvider === PROVIDER7) {
|
|
3745
3789
|
delete settings.defaultProvider;
|
|
3746
3790
|
delete settings.defaultModel;
|
|
3747
3791
|
saveJson3(settingsPath4(ctx), settings);
|
|
@@ -3755,13 +3799,13 @@ var stripConfig6 = (ctx) => {
|
|
|
3755
3799
|
};
|
|
3756
3800
|
var result7 = (ctx) => {
|
|
3757
3801
|
const doc = loadJson3(modelsPath2(ctx));
|
|
3758
|
-
const provider2 = doc?.providers?.[
|
|
3802
|
+
const provider2 = doc?.providers?.[PROVIDER7];
|
|
3759
3803
|
const settings = loadJson3(settingsPath4(ctx));
|
|
3760
|
-
const model = settings?.defaultProvider ===
|
|
3804
|
+
const model = settings?.defaultProvider === PROVIDER7 ? settings.defaultModel : void 0;
|
|
3761
3805
|
return {
|
|
3762
3806
|
harness: ID9,
|
|
3763
3807
|
label: LABEL9,
|
|
3764
|
-
configured: provider2?.baseUrl === `${BASE_URL}/v1` && provider2?.api === "openai-completions" && provider2?.apiKey ===
|
|
3808
|
+
configured: provider2?.baseUrl === `${BASE_URL}/v1` && provider2?.api === "openai-completions" && provider2?.apiKey === PROVIDER7 && readKey7(ctx) !== null && readTextIfExists(skillPath3(ctx)) !== null,
|
|
3765
3809
|
model: typeof model === "string" ? model : void 0,
|
|
3766
3810
|
files: files7(ctx)
|
|
3767
3811
|
};
|
|
@@ -3793,7 +3837,7 @@ var prime = {
|
|
|
3793
3837
|
const model = options.model ?? DEFAULT_MODEL8;
|
|
3794
3838
|
const models2 = await fetchHarnessModels(model);
|
|
3795
3839
|
const apiKey = await resolveHarnessKey(
|
|
3796
|
-
{ id: ID9, label: LABEL9, existingKey:
|
|
3840
|
+
{ id: ID9, label: LABEL9, existingKey: readKey7(ctx) },
|
|
3797
3841
|
{ browser: options.browser }
|
|
3798
3842
|
);
|
|
3799
3843
|
return configurePrime(ctx, models2, apiKey, model);
|
|
@@ -5483,6 +5527,7 @@ var create3 = addPriceOptions(
|
|
|
5483
5527
|
else {
|
|
5484
5528
|
printSuccess(`Model registered: ${created.modelId}`);
|
|
5485
5529
|
printModels([created]);
|
|
5530
|
+
printInfo("It can take a minute or two before this is callable.");
|
|
5486
5531
|
}
|
|
5487
5532
|
} catch (err) {
|
|
5488
5533
|
fail("Failed to create model", err);
|
|
@@ -5532,6 +5577,7 @@ var update3 = addPriceOptions(
|
|
|
5532
5577
|
else {
|
|
5533
5578
|
printSuccess(`Model updated: ${updated.modelId}`);
|
|
5534
5579
|
printModels([updated]);
|
|
5580
|
+
printInfo("It can take a minute or two before this is callable.");
|
|
5535
5581
|
}
|
|
5536
5582
|
} catch (err) {
|
|
5537
5583
|
fail("Failed to update model", err);
|