Pollinations
unlistedby xiaotian1171
Generate text and images with Pollinations inside your notes, paying with your own Pollen.
Pollinations for Obsidian
Generate text and images with Pollinations inside your notes, paying with your own Pollen.
- Text from a prompt or straight from the selection - the answer lands at the cursor, on a new line below, or by replacing the selection.
- Images with a click - the picture is saved into your vault and embedded in the note.
- Sign in with a code (device flow), or paste an API key. No secret is baked into the plugin, and the sign-in is attributed to your own app key if you set one.
- Any model from the live lists - a model browser inside Obsidian searches the text and image catalogues as they exist right now.
- Retries and plain-language errors - 429s, server errors and network hiccups are retried with backoff; every failure turns into one readable sentence.
Requirements and disclosures
- An account and pollen are needed. Generation is billed to the key you paste
or sign in with; the plugin has no free tier of its own. Create a key at
enter.pollinations.ai/keys, or sign in with a device code. - Network use. The plugin talks to
gen.pollinations.aifor generation andenter.pollinations.aifor sign-in, and to no other host. - Keys stay on your device, in this plugin's
data.json. There is no telemetry and no analytics of any kind. - License: MIT.
Install
From the community plugin directory (once it is listed)
Settings > Community plugins > Browseand search for Pollinations.- Install, then enable it.
With BRAT (before it is listed)
- Install BRAT.
BRAT > Add beta pluginand enterxiaotian1171/pollinations-obsidian.
By hand
- Download
main.js,manifest.jsonandstyles.cssfrom the latest release. - Put them in
<your vault>/.obsidian/plugins/pollinations/. - Reload Obsidian and enable Pollinations in the community plugins list.
Demo
A two minute run-through of everything the plugin does:
- Enable the plugin, then open
Settings > Pollinationsand either- click Sign in with a code - a notice and a small window show a code such
as
ABCD-1234, you openenter.pollinations.ai/device, enter the code, approve, and the window closes by itself once the key arrives; or - paste an
sk_...key fromenter.pollinations.ai/keysinto API key.
- click Sign in with a code - a notice and a small window show a code such
as
- Press Test next to Test the connection. A notice reports how many text
models are live, for example
connected, 188 text models available. - In a note, put the caret where you want the answer and run the command
Pollinations: Generate text at the cursor from the command palette
(
Ctrl/Cmd+P). TypeName a village in one wordand press Generate. The word appears at the caret; the status bar reports the token usage, for examplePollinations: 9 tokens. - Select a paragraph, then run Pollinations: Generate text from the
selection with the selection template set to
Summarise in one sentence: {{text}}. The summary is inserted according to Where generated text goes. - Run Pollinations: Generate an image and embed it, type
a wooden watermill, flat illustration, and press Generate. The image is saved next to the note (or in the folder you configured), embedded where the caret was, and a notice shows the path. - Run Pollinations: Browse the live model list, filter by publisher, and click Use for text or Use for images to make that model the default.
The ribbon icon on the left runs step 3 directly.
Commands
| Command | What it does |
|---|---|
| Generate text at the cursor | Asks for a prompt (pre-filled with the selection) and inserts the answer |
| Generate text from the selection | Sends the selection through the selection template and inserts the answer |
| Generate text and review it before inserting | Shows the answer in a window with Insert / Copy / Discard |
| Generate an image and embed it | Asks for a prompt, saves the image into the vault and embeds it |
| Generate an image from the selection | Uses the selection as the prompt |
| Browse the live model list | Searches the live text and image catalogues and sets a default |
| Sign in with a Pollen account | Runs the device flow |
| Test the connection and count the models | One request to the model list |
Settings
| Setting | Meaning |
|---|---|
| API key | Your sk_... key. Written by the sign-in flow, or pasted by you |
| App key | Optional pk_... publishable key, so sign-ins are attributed to your Pollinations account |
| Text model | Any id from the live text list. Empty means the quick default, nova-fast |
| Image model | Any id from the live image list. Empty means the quick default, tongyi-mai/z-image-turbo |
| System prompt | Sent with text requests. Empty switches to the cheaper one-shot /text/{prompt} route |
| Selection template | How the selection is sent; {{text}} is replaced with it |
| Temperature, Max tokens | Passed to chat completions. 0 tokens means no limit |
| Image folder | Vault folder for generated images. Empty means "next to the note" |
| Image size | Width and height, 64 to 4096 |
| Where generated text goes | At the cursor, on a new line below, or replacing the selection |
| Open the sign-in page in the browser | Turn off if you would rather open the link yourself |
Signing in with a code
The device flow means the plugin never ships a key:
- The plugin asks
/api/device/codefor a code (with your app key asclient_idwhen one is configured). - You get the code in a window and a notice, and the browser opens
enter.pollinations.ai/device?user_code=.... - The plugin polls
/api/device/tokenevery 5 seconds. A pending answer is expected and not an error;slow_downmakes it wait longer. - On approval it stores the returned
sk_...in the plugin's settings, reads/api/device/userinfofor your account name, and closes the window.
The key stays on your device, in data.json for this plugin only. Sign out
removes it; you can also revoke it on the Pollinations site.
Errors
| Kind | Meaning | Retried |
|---|---|---|
auth (401, 403) | The key is missing, wrong or revoked | no |
balance (402, or a body that says so) | The key is valid but out of Pollen | no |
rate_limit (429) | Too many requests | yes, 0.75s then 1.5s |
bad_request (400, 404, 422) | Unknown model id or bad parameters; the API's own message is shown | no |
server (5xx) | Pollinations or the upstream model failed | yes |
network | DNS, TLS, timeout or a dead connection | yes |
parse | A 2xx answer that cannot be read | no |
Image responses are kept as bytes and never decoded as text.
Privacy
The plugin sends only what you ask it to: your prompt, the model, and the size.
It talks to gen.pollinations.ai for generation and enter.pollinations.ai for
sign-in. There is no analytics, no telemetry and no other endpoint. Your key is
stored in this plugin's data.json and nowhere else.
Tests
The logic that decides URLs, payloads, parsing, error kinds, file names and where
the answer lands is plain TypeScript in src/api.ts and src/format.ts, with no
Obsidian imports, so it runs headless:
npm install
npm run typecheck # tsc, no errors
npm test # 180 checks, no network and no keys
npm run test:live # the same suite plus real API calls (needs POLLINATIONS_API_KEY)
npm run build # tsc + esbuild -> main.js
npm run test:live is the evidence script; it prints real status codes, latencies
and payload shapes. A run produced:
- the prompt route
200in 3.02s,text/plain, answerHello, friendly human. - chat
200in 2.52s, modelus.amazon.nova-micro-v1:0, and the answer extracted fromchoices[0].message.content GET /text/models200with 188 text models andGET /image/models200with 77 image models, read into the same structure the model browser usesGET /image/...200in 0.43s,image/jpeg, 28 813 bytes, recognised asjpgPOST /api/device/code200in 0.89s withuser_code=8ZMYESJU,interval=5,expires_in=1800, thenPOST /api/device/token400{"error":"authorization_pending"}classified as pending, not as a failure/v1/audio/speech402classified as a balance failure: speech is a paid model and the free account used for the run has no pollen
CI runs the type check, the suite and the build on pull requests
(.github/workflows/tests.yml).
Layout
src/api.ts URLs, request shapes, parsing, error kinds - no Obsidian
src/format.ts file names, templates, where text lands - no Obsidian
src/settings.ts defaults and repair of the settings object - no Obsidian
src/main.ts commands, modals, settings tab, sign-in, the HTTP calls
tests/run.ts the headless suite and the live check
main.js the built plugin, committed as the community directory requires
Development
npm install
npm run dev # esbuild watch, writes main.js
npm test # after each change
License
MIT, see LICENSE.
For plugin developers
Search results and similarity scores are powered by semantic analysis of your plugin's README. If your plugin isn't appearing for searches you'd expect, try updating your README to clearly describe your plugin's purpose, features, and use cases.