https://github.com/picatz/openai
🤖 CLI for OpenAI
https://github.com/picatz/openai
cli go openapi
Last synced: 3 months ago
JSON representation
🤖 CLI for OpenAI
- Host: GitHub
- URL: https://github.com/picatz/openai
- Owner: picatz
- License: mpl-2.0
- Created: 2023-01-11T03:33:09.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-11T23:40:46.000Z (3 months ago)
- Last Synced: 2025-04-12T00:29:31.801Z (3 months ago)
- Topics: cli, go, openapi
- Language: Go
- Homepage: https://pkg.go.dev/github.com/picatz/openai
- Size: 1.44 MB
- Stars: 36
- Watchers: 3
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OpenAI [](https://pkg.go.dev/github.com/picatz/openai) [](https://goreportcard.com/report/github.com/picatz/openai) [](https://opensource.org/licenses/MPL-2.0)
An unofficial community-maintained CLI application for [OpenAI](https://openai.com/).## Installation
```console
$ go install github.com/picatz/openai/cmd/openai@latest
```> [!IMPORTANT]
> To use the CLI you must have a valid `OPENAI_API_KEY` environment variable set. You can get one [here](https://platform.openai.com/).> [!TIP]
> You can customize which model is used by setting the `OPENAI_MODEL` environment variable. The default is `gpt-4o` today, but it may change in the future.### Usage
```console
$ openai --help
OpenAI CLIUsage:
openai [flags]
openai [command]Available Commands:
assistant Start an interactive assistant chat session
chat Chat with the OpenAI API
completion Generate the autocompletion script for the specified shell
help Help about any command
image Generate an image with DALL·E
responses Manage the OpenAI Responses APIFlags:
-h, --help help for openaiUse "openai [command] --help" for more information about a command.
``````console
$ openai assistant --help
Interact with the OpenAI API using the assistant API.This can be used to create a temporary assistant, or interact with an existing assistant.
Usage:
openai assistant [flags]
openai assistant [command]Examples:
$ openai assistant # create a temporary assistant and start chatting
$ openai assistant chat # same as above
$ openai assistant create --name "Example" --model "gpt-4-turbo-preview" --description "..." --instructions "..." --code-interpreter --retrieval
$ openai assistant list
$ openai assistant info
$ openai assistant chat
$ openai assistant deleteAvailable Commands:
chat Start an interactive assistant chat session
create Create an assistant
delete Delete an assistant
file Manage assistant files
info Get information about an assistant
list List assistants
update Update an assistantFlags:
-h, --help help for assistantUse "openai assistant [command] --help" for more information about a command.
```> [!TIP]
>
> If provided no arguments, the CLI will default to the `assistant` command with an ephemeral session,
> meaning messages and files will be deleted after exiting the session.#### With Ollama
You can use the CLI with [Ollama](https://ollama.com/) to use models that are run locally, such as [IBM Granite](https://ollama.com/library/granite3.1-dense).
```console
$ brew install ollama
...
$ ollama serve &
...
$ ollama run granite3.1-dense:2b
...
$ OPENAI_MODEL="granite3.1-dense:2b" OPENAI_EMBEDDING_MODEL="granite3.1-dense:2b" OPENAI_API_URL="http://localhost:11434/v1/" openai chat
```