Linux command
openai 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Chat completion
openai api chat.completions.create -m gpt-4 -g user "[prompt]"
Create embedding
openai api embeddings.create -m text-embedding-ada-002 -i "[text]"
List models
openai api models.list
Generate image
openai api images.generate -p "[description]"
说明
openai is the OpenAI CLI. Interacts with GPT models and other APIs. The tool provides command-line API access. Requires API key.
参数
- api _ENDPOINT_
- API command.
- -m _MODEL_
- Model name.
- -g _ROLE_ _MESSAGE_
- Message with role.
- -i _INPUT_
- Input text.
- -p _PROMPT_
- Prompt text.
- --help
- Display help information.
FAQ
What is the openai command used for?
openai is the OpenAI CLI. Interacts with GPT models and other APIs. The tool provides command-line API access. Requires API key.
How do I run a basic openai example?
Run `openai api chat.completions.create -m gpt-4 -g user "[prompt]"` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does api _ENDPOINT_ do in openai?
API command.