https://github.com/openai/openai-cli▌安装
Homebrew(Mac用户)
brew install openai/tools/openai
Go安装(跨平台)
go install'github.com/openai/openai-cli/cmd/openai@latest'
▌最基础的用法
openai responses create \ --input "用三句话解释什么是向量数据库" \ --model gpt-4o▌最值得关注的部分:直接跑Agent工作流
openai responses create \--input "搜索今天AI领域最重要的三条新闻,每条一句话总结" \--model gpt-4o \--tools web_search
▌输出格式:可以直接管道串联
输出JSON,用GJSON语法直接抽字段
openai responses create \--input "生成一个JSON格式的产品描述" \--model gpt-4o \--output json \--query "output[0].content[0].text"
▌其他实用功能
openai images generate \--prompt "极简风格的科技公司logo,蓝色调" \--model dall-e-3 \--output image.png
openai audio transcribe @recording.mp3 --model whisper-1openai audio speech create \--input "这是一段测试文字" \--model tts-1 \--voice alloy \--output output.mp3
openai responses create \--input @prompt.txt \--model gpt-4o
▌管理功能也整合进来了
创建新项目openai projects create --name "my-project"# 创建API Keyopenai api-keys create --name "production-key"
夜雨聆风