OpenAI CLI
CLI commands for OpenAI provider
OpenAI CLI Commands
Manage and test OpenAI provider via the command line.
Environment Setup
export OPENAI_API_KEY=sk-...Commands
Check Provider Status
praisonai-ts providers doctor openaiOutput:
Provider Doctor: openai
Package: @ai-sdk/openai
Description: OpenAI GPT models
Environment Variable: OPENAI_API_KEY
Status: ✅ Ready
Key Preview: sk-p...xxxx
Modalities:
Text/Chat: ✅ Embeddings: ✅ Image: ✅
Audio: ✅ Speech: ✅ Tools: ✅JSON Output
praisonai-ts providers doctor openai --jsonOutput:
{
"success": true,
"data": {
"provider": "openai",
"env_key": "OPENAI_API_KEY",
"has_key": true,
"key_preview": "sk-p...xxxx",
"package": "@ai-sdk/openai",
"description": "OpenAI GPT models",
"modalities": {
"text": true,
"chat": true,
"embeddings": true,
"image": true,
"audio": true,
"speech": true,
"tools": true
},
"status": "ready"
}
}Test Provider
praisonai-ts providers test openai gpt-4o-miniOutput:
ℹ Testing openai/gpt-4o-mini...
✅ Test Passed
Provider: openai
Model: gpt-4o-mini
Latency: 1523ms
Response: "Test ok."Test with JSON Output
praisonai-ts providers test openai gpt-4o-mini --jsonOutput:
{
"success": true,
"data": {
"provider": "openai",
"model": "gpt-4o-mini",
"status": "success",
"latency_ms": 1523,
"response_preview": "Test ok."
}
}Chat with OpenAI
praisonai-ts chat "What is 2+2?" --provider openai --model gpt-4o-miniList All Providers
praisonai-ts providers listAdvanced Usage
Custom Base URL (Proxy)
export OPENAI_BASE_URL=https://my-proxy.example.com/v1
praisonai-ts providers test openai gpt-4o-miniAs of PR #4505, the same OPENAI_BASE_URL is honoured in the SDK’s env-only path too — an Agent built without an explicit baseURL picks it up on the next call. See JS Credential Rotation.
With Organization ID
export OPENAI_ORG_ID=org-xxxxx
praisonai-ts providers test openai gpt-4oVerbose Output
praisonai-ts providers doctor openai --verboseOptions Reference
| Option | Description |
|---|---|
--json | Output in JSON format |
--verbose | Show detailed information |
--model <model> | Specify model for test |
Troubleshooting
Missing API Key
Status: ❌ Missing API KeySolution:
export OPENAI_API_KEY=sk-your-key-hereConnection Error
Error: Network errorSolution: Check your internet connection and any proxy settings.
Invalid Model
Error: Model not foundSolution: Use a valid model name like gpt-4o-mini, gpt-4o, or gpt-4-turbo.