PSAOAI is a PowerShell module for working with Azure OpenAI from scripts, consoles, and automation workflows.
It gives you a PowerShell-native surface for chat completions, embeddings, image generation, and environment handling without forcing you to drop into raw REST calls every time.
It is most useful when you want a practical PowerShell wrapper around Azure OpenAI that is easy to install from PowerShell Gallery, script, and reuse across automation tasks.
PSAOAI is a good fit for:
- PowerShell users who want a reusable Azure OpenAI module instead of ad-hoc REST snippets
- automation engineers who want repeatable prompt, embedding, or image-generation workflows
- people building higher-level tools on top of a PowerShell-native OpenAI integration layer
PSAOAI is not the best fit for:
- users who want a provider-agnostic framework first
- people expecting a full desktop product rather than a scriptable module layer
- cases where raw API experimentation is preferred over a PowerShell command surface
Install-Module -Name PSAOAI
Import-Module -Name PSAOAIGet-Command -Module PSAOAISet the environment values needed by your Azure OpenAI deployment:
PSAOAI_API_AZURE_OPENAI_ENDPOINTPSAOAI_API_AZURE_OPENAI_APIVERSIONPSAOAI_API_AZURE_OPENAI_CC_DEPLOYMENTPSAOAI_API_AZURE_OPENAI_KEY
"Explain Azure Logic App IF conditions in simple terms." |
Invoke-PSAOAIChatCompletion -Deployment "your_deployment" -SimpleResponse -Stream $false- chat completions for scripted or interactive use
- embeddings for search, similarity, or downstream automation
- image generation through DALL-E 3
- environment and key handling for repeated local usage
- logging and reusable PowerShell-native integration in other tools
- The module is primarily positioned around Azure OpenAI; it is not a broad multi-provider abstraction layer.
- Real usability depends on correct local environment configuration and valid deployment settings.
- The smoothest first-run path is a single verified Azure OpenAI deployment, not a complex multi-model setup.
- This repo currently presents itself more as a practical module than as a heavily packaged developer platform.
- Chat completions for interactive or scripted Azure OpenAI calls, including
o1ando3-style usage. - Embeddings for similarity, retrieval, and downstream automation workflows.
- Image generation through DALL-E 3.
- Secure key and environment handling for repeated local usage.
- Response logging for debugging, auditing, and operational review.
- PowerShell-native commands that are easier to script and reuse than raw REST calls.
-
Basic
o1-style usage"<describe reasoning problem>" | Invoke-PSAOAIChatCompletion -Deployment "model_o1" -o1
-
Structured non-streaming example
"AZURE Logic App 'IF' element" | Invoke-PSAOAIChatCompletion -APIVersion "2024-05-01-preview" -Endpoint "https://example.openai.azure.com" -Deployment "example_model_gpt35_!" -User "BobbyK" -Temperature 0.2 -TopP 0.7 -FrequencyPenalty 0 -PresencePenalty 0 -simpleresponse -SystemPrompt "Explain to me" -Stream $false -JSONMode
-
Capture a streamed response into a variable
$resule = "AZURE Logic App 'IF' element" | Invoke-PSAOAIChatCompletion -APIVersion "2024-05-01-preview" -Endpoint "https://example.openai.azure.com" -Deployment "example_model_gpt35_!" -User "BobbyK" -Temperature 0.2 -TopP 0.7 -FrequencyPenalty 0 -PresencePenalty 0 -simpleresponse -SystemPrompt "Explain to me" -Stream $true
-
o3-style usageInvoke-PSAOAIChatCompletion -Deployment "model_o3" -o3 -usermessage "Explain to me: $(Get-Content <plain_text_file_path> | out-string) `nReturn as Markdown format" -OneTimeUserPrompt
Invoke-PSAOAIcompletion -usermessage "explain winform" -Deployment "gpt45" -User "BobbyK" -simpleresponse -Stream $falseInvoke-PSAOAIDalle3 -Prompt "A finely detailed, broken marble figure head half-submerged in sandy terrain. The scene is
bathed in the illuminating glow of daylight. The artistic style of the image evokes the feel of Polish romanticism,
characterized by a realistic approach with an underlying emotional dimension and emphasis on symbolic compositions often seen
in Malczewski's works who was active before 1912. Please note, the marble figure head should be of no particular person, just
a generic, anonymous sculpture." -quality hd $response = "Hello, World!" | Invoke-PSAOAIEmbedding -User "Gemini" -Verbose -Deployment "gpt-45" -simpleresponse
$responseIf specific paths are not provided, PSAOAI uses:
<User's document folder>/PSAOAI/
That folder is used for logs and module data and is created automatically when the module is imported.
We use SemVer for versioning.
Contributions, issue reports, and improvement suggestions are welcome.
If you want to extend the module, start by reviewing the exported commands, current release notes, and the existing PowerShell module layout in this repo.
PSAOAI is released under the MIT License.
If you have questions, bug reports, or improvement ideas, use GitHub Issues.

