Skip to content

BananaAcid/PollinationsAiPS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

33 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

PollinationsAi for PowerShell

PollinationsAiPS is a PowerShell library designed to simplify interactions with the Pollinations.ai ecosystem. It allows developers and sysadmins to leverage a many powerful AI models for image creation, text generation, and audio processing without leaving the terminal.

Key Features:

  • Image Generation: Create visuals from text prompts with customizable parameters.
  • Text Generation: Interface with LLMs for chat and text completion.
  • Audio/Voice: Support for text-to-speech and speech-to-text (depending on API availability).
  • Pipeline Friendly: Designed to work with PowerShell objects and pipes.
  • Easy Integration: Simple to use in your powershell workflows (.NET Framework and .NET Core) and Azure.
  • Cross Platform: Just runs on Windows, macOS, and Linux. And Docker / Podman. And more.

... in pure Powershell 5+ / 7+ (Win, Linux, OSX, Docker, ...) -- PollinationsAI can be used for free (only needs registration, but no moneys)

Warning

PollinationsAI will cache the response to your request indefinitely (possibly the request as well) and the response can be accessed without authentication.

This might be what you are looking for, if you want to get persistent results to a request or want to share the response (the URL visible with -Debug is without authentication).

DO NOT enter private data (name, address, ...), personal information, information about other people, financial data and other sensetive information. It is not save to use in a corporate environment. Handle it as if you would post on X / Facebook.

See Discussion

Just go for it

Install-Module -Name PollinationsAiPS -Force ; Import-Module -Name PollinationsAiPS ; Get-PollinationsAiByok -Add | Out-Null

gpat "a cat"
# ... a text about a cat ...

gpai "a cat" -save
# an url to file with a cat

Quickly install it (install, update)

Install-Module -Name PollinationsAiPS -Force

then make it available in the current session (for immediate use, or start a new shell)

Import-Module -Name PollinationsAiPS
only download it into your current folder
Save-Module -Name PollinationsAiPS -Path .\   # this creates a subfolder .\PollinationsAiPS\1.0.0\

You might want to add your key as environment variable to your profile

Bring-Your-Own-Key method - opens a popup for you to accept to generate a temporary key and adds it to your profile (persists)

Get-PollinationsAiByok -Add

Bring-Your-Own-Key, but only temporary (until you close the terminal/session)

Get-PollinationsAiByok -Init

or manually:

  • "`n`n`$env:POLLINATIONSAI_API_KEY = `"sk_..............`"" >> $PROFILE.CurrentUserAllHosts
    ... after restarting your powershell console, the key will be available. (sk_... is the API key you created at Pollinations.ai)

Documentation (params, examples)

Important

⭐ The specific documentation for each command

  • Get-PollinationsAiText -> /docs/text.md (single line input text, but all model lists)
  • Get-PollinationsAiTextEx -> /docs/textEx.md (for multiline texts)
  • Get-PollinationsAiImage -> /docs/image.md
  • Get-PollinationsAiAudio -> /docs/audio.md
  • PollinationsAI:\ Drive -> /docs/files.md (to for images to url, to be used with the commands)
  • ConvertFrom-AnsiEscapedString
  • Get-PollinationsAiByok, Alias: Get-PAByok, Get-PollinationsAiDeviceToken
  • Get-PollinationsAiByokWeb (Old method, but can be used to redirect to a website that receives the confirmation/apikey)

Example Usage

Generate a text based on the prompt "a cat"

Get-PollinationsAiText "a cat"
# Ah, a cat – these furry little bundles ...
  • Aliases: Get-PollinationsAiText, Get-PAiTxt, gpat

Generate a text based on the prompt "a cat", and show it with cli colors / cli formatting

Get-PollinationsAiText "a cat." -colors
# Ah, a cat – these furry little bundles ...
  • Aliases: Get-PollinationsAiText, Get-PAiTxt, gpat

Generate a text based on a multiline prompt

Get-Content somefile.txt | Get-PollinationsAiTextEx
# ...
Get-PollinationsAiTextEx (Get-Content somefile.txt)
# ...
Get-PollinationsAiTextEx @("line 1", "line 2")
# ...
Get-PollinationsAiTextEx "line 1 `n line 2"
# ...
  • Aliases: Get-PollinationsAiTextEx, Get-PAiTxtX, gpatx

Generate an image based on the prompt "a cat"

Get-PollinationsAiImage "a cat" -save
# C:\Users\<username>\AppData\Local\Temp\00974dda-c60c-4c4f-b6bc-4c6e948616d5.jpg
  • Aliases: Get-PollinationsAiImage, Get-PAiImg, gpai

Generate an audio based on the prompt "a cat"

Get-PollinationsAiAudio "a cat" -save
# C:\Users\<username>\AppData\Local\Temp\00974dda-c60c-4c4f-b6bc-4c6e948616d5.mp3
  • Aliases: PollinationsAiAudio, Get-PAiAud, gpaa

List models

Get-PollinationsAiImage -List

All types support -List

Filter for free and with image-url as input

Get-PollinationsAiImage -List -Details |? paid_only -eq $false |? input_modalities -contains image | Format-Table 

About

Power up your PowerShell scripts with AI! A seamless interface for Pollinations.ai to generate images, text, and audio. πŸ€–

Topics

Resources

License

Stars

Watchers

Forks

Contributors