Skip to content

Commit e4dad92

Browse files
Add PSOpenAI module support for image, video, audio
Introduces PSOpenAI as a supported AI tool, enabling image editing/generation, video, and audio capabilities via the OpenAI API. Updates tool definitions, installation, uninstallation, initialization, and invocation logic to handle PowerShell module wrappers distinctly from CLI tools. Adds documentation and user guidance for PSOpenAI API key configuration and usage.
1 parent d4d8acf commit e4dad92

11 files changed

Lines changed: 592 additions & 62 deletions

README.md

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -56,16 +56,16 @@ The problem with AI coding assistants isn't their capability, it's their interfa
5656

5757
## How it differs from API wrappers
5858

59-
You might wonder why this exists when [PSOpenAI](https://github.com/mkht/PSOpenAI) is available. The answer: they solve different problems.
59+
Most of aitools wraps *agentic CLI tools* (AI assistants that read, understand, and rewrite code), but it also supports [PSOpenAI](https://github.com/mkht/PSOpenAI), a PowerShell wrapper for specialized capabilities like image/video/audio generation and editing.
6060

6161
| API Wrappers (like PSOpenAI) | Agentic CLI Tools (like Claude Code) |
6262
| ---------------------------------------- | -------------------------------------------- |
63-
| Send prompts, receive text | Open files, understand code, make edits |
63+
| Send prompts, receive text/media | Open files, understand code, make edits |
6464
| You handle file I/O and context | Built-in file management and context |
6565
| Great for generating new content | Great for refactoring existing code |
66-
| Requires scaffolding for code work | Ships with full coding toolchain |
66+
| Excels at image/video/audio generation | Specialized for code editing workflows |
6767

68-
PSOpenAI is excellent for what it does. aitools is for when you need an AI to *edit code*, not just *generate text*.
68+
aitools includes PSOpenAI support specifically for image editing and generation capabilities that CLI tools don't yet provide.
6969

7070
---
7171

@@ -152,8 +152,9 @@ Run the same task through all installed AI tools and compare results.
152152
| **Codex CLI** | Fast processing | Subscription | ✅ Supported |
153153
| **Cursor AI** | IDE integration | Free + paid | ✅ Supported |
154154
| **Ollama** | Offline use, completely free | Free | ✅ Supported |
155+
| **PSOpenAI** | Image/video/audio generation and editing | Pay-per-use | ✅ Supported |
155156

156-
Each tool has different strengths. Claude Code is the strongest coder but can struggle with files over 400 lines. Gemini has massive context windows. Ollama runs locally with no API costs. Use what fits your needs.
157+
**Note:** PSOpenAI is a PowerShell module wrapper (not a CLI), providing capabilities that agentic tools don't yet support like image editing, video generation, and text-to-speech. Each tool has different strengths - Claude Code is the strongest coder but can struggle with files over 400 lines. Gemini has massive context windows. Ollama runs locally with no API costs. Use what fits your needs.
157158

158159
---
159160

@@ -251,7 +252,9 @@ This demonstrates what agentic CLIs do well: read complex requirements, maintain
251252

252253
## Advanced Usage
253254

254-
### Working with Images (Codex Only)
255+
### Working with Images
256+
257+
**Image Analysis and Code Generation (Codex)**
255258

256259
```powershell
257260
$params = @{
@@ -262,7 +265,31 @@ $params = @{
262265
Invoke-AITool @params
263266
```
264267

265-
The `-Attachment` parameter works with image files (`.png`, `.jpg`, `.jpeg`, `.gif`, `.bmp`, `.webp`, `.svg`) and is currently only supported by Codex.
268+
The `-Attachment` parameter works with image files and is supported by Codex for vision-based code generation.
269+
270+
**Image Editing and Generation (PSOpenAI)**
271+
272+
PSOpenAI provides direct image manipulation capabilities that CLI tools don't yet support:
273+
274+
```powershell
275+
# Install and configure PSOpenAI
276+
Install-AITool -Name PSOPenAI
277+
Initialize-AITool -Tool PSOPenAI
278+
$env:OPENAI_API_KEY = 'sk-your-api-key'
279+
280+
# Edit an existing image
281+
Get-ChildItem C:\images\photo.png |
282+
Invoke-AITool -Tool PSOPenAI -Prompt "remove the background and add a white sticker border. make transparent. save with descriptive name"
283+
284+
# Generate a new image from text
285+
Invoke-AITool -Tool PSOPenAI -Prompt "A serene mountain landscape at sunset"
286+
```
287+
288+
**Key Differences:**
289+
- **Codex** (and other CLI tools with vision): Analyze images and write code/scripts to manipulate them
290+
- **PSOpenAI**: Directly edit or generate images through OpenAI's image API endpoints
291+
292+
**Authentication:** PSOpenAI requires an OpenAI API key. Set `$env:OPENAI_API_KEY` or run `Initialize-AITool -Tool PSOPenAI` for configuration instructions.
266293

267294
### Custom Configuration
268295

aitools.psm1

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,33 @@ $script:ToolDefinitions = @{
208208
Debug = $null
209209
Priority = 5
210210
}
211+
'PSOPenAI' = @{
212+
Command = 'PSOpenAI' # Module name, not a CLI command
213+
InstallCommands = @{
214+
Windows = 'Install-Module -Name PSOpenAI -Scope CurrentUser -Force'
215+
Linux = 'Install-Module -Name PSOpenAI -Scope CurrentUser -Force'
216+
MacOS = 'Install-Module -Name PSOpenAI -Scope CurrentUser -Force'
217+
}
218+
UninstallCommands = @{
219+
Windows = 'Uninstall-Module -Name PSOpenAI -Force'
220+
Linux = 'Uninstall-Module -Name PSOpenAI -Force'
221+
MacOS = 'Uninstall-Module -Name PSOpenAI -Force'
222+
}
223+
TestCommand = 'Get-Module -ListAvailable PSOpenAI'
224+
InitCommand = 'API_KEY_CHECK' # Special flag for API key verification
225+
PermissionFlag = $null
226+
Model = $null
227+
Verbose = $null
228+
Debug = $null
229+
Priority = 7
230+
IsWrapper = $true # Flag to indicate this is a PowerShell module wrapper, not a CLI
231+
}
211232
}
212233

213234
# Define TEPP scriptblock
214235
$teppScriptBlockParams = @{
215236
Name = 'Tool'
216-
ScriptBlock = { 'All', 'Aider', 'Gemini', 'ClaudeCode', 'Codex', 'GitHubCopilot', 'Cursor', 'Ollama' }
237+
ScriptBlock = { 'All', 'Aider', 'Gemini', 'ClaudeCode', 'Codex', 'GitHubCopilot', 'Cursor', 'Ollama', 'PSOPenAI' }
217238
}
218239
Register-PSFTeppScriptblock @teppScriptBlockParams
219240

messages/psopenai-api-key-info.txt

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
===================================================================
2+
PSOpenAI API Key Configuration
3+
===================================================================
4+
5+
PSOpenAI requires an OpenAI API key to function. You can configure it using one of these methods:
6+
7+
METHOD 1: Environment Variable (Recommended)
8+
--------------------------------------------
9+
Set the OPENAI_API_KEY environment variable:
10+
11+
PowerShell:
12+
$env:OPENAI_API_KEY = 'sk-your-api-key-here'
13+
14+
To persist across sessions (Windows):
15+
[System.Environment]::SetEnvironmentVariable('OPENAI_API_KEY', 'sk-your-api-key-here', 'User')
16+
17+
Linux/macOS:
18+
Add to ~/.bashrc or ~/.zshrc:
19+
export OPENAI_API_KEY='sk-your-api-key-here'
20+
21+
METHOD 2: Global Variable
22+
--------------------------
23+
Set a PowerShell global variable (session-only):
24+
25+
$global:OPENAI_API_KEY = 'sk-your-api-key-here'
26+
27+
METHOD 3: Per-Command Parameter
28+
--------------------------------
29+
Pass the API key directly to each command:
30+
31+
Invoke-AITool -Tool PSOPenAI -Prompt "..." -ApiKey 'sk-your-api-key-here'
32+
33+
GETTING YOUR API KEY:
34+
---------------------
35+
1. Sign up or log in at: https://platform.openai.com/
36+
2. Navigate to: https://platform.openai.com/api-keys
37+
3. Click "Create new secret key"
38+
4. Copy your API key (starts with 'sk-')
39+
5. Configure using one of the methods above
40+
41+
IMPORTANT:
42+
----------
43+
- PSOpenAI is a PowerShell wrapper module, not a CLI tool
44+
- It provides image editing/generation, video, and audio capabilities
45+
- Unlike CLI tools, PSOpenAI directly calls OpenAI API endpoints
46+
- Image editing uses Request-ImageEdit, generation uses Request-ImageGeneration
47+
- You need an active OpenAI account with available API credits
48+
49+
===================================================================

0 commit comments

Comments
 (0)