English | 简体中文
Ask GPT is a CLI tool to chat with OpenAI LLMs via API.
- Custom Roles: Customise multi roles, each with its own system prompt.
- Save/Retrieve Conversations: Save conversations locally and continue it seamlessly in the future.
- Streaming Output: See the output instantly after an input, no need to wait for completion.
- Support Pipeline: Send any output of other CLI tools to AI via pipeline.
- Interactive mode: Chat with AI interactively. Offer a user experience similar to the web-based ChatGPT.
- Support Models: Compatibility with all models accessible through the OpenAI API.
- Edit Config Easily: One-click access to configuration file for easy setup and customization.
Download the pre-built binary from release and add it to path.
-
Run ask-gpt for the first time:
ag -v
and the app will create the config file at
%USERPROFILE%/.config/ask-gpt/config.yaml
for Windows and
$HOME/.config/ask-gpt/config.yaml
for Linux and macOS.
-
Edit the config. See Configuration for detail.
-
Quickly ask a question:
ag "what's the best programming language in the world?"
-
To create or continue a conversation, use
-s
:ag -s "chat 1" "Tell a story"
-
To chat interactively, use
-i
:ag -i "Translate the given sentences to Chinese"
-s
can be used with-i
:ag -s "translation" -i "Translate the given sentences to Chinese"
-
Use pipeline:
cat raw.txt | ag -i "Translate above contents to Chinese"
-
To create a new role, use
-n
:ag -n
then set its name, description and prompt interactively.
-
To use a role, use
-r
(the role should already exist):ag -r "translator" -i "Translate the given sentences to Chinese"
-r
can be used with-s
but only valid when creating a conversation. -
To show history of the conversation, use
-h
:ag -s "translation" -h -i
this will print previous messages and continue with interactive mode.
-
For more usage, see:
chatgpt --help
Name | Meaning | Default |
---|---|---|
url | The base URL for OpenAI API. | "https://api.openai.com/v1" |
api_key | Your OpenAI API key. | "" |
model | The model to be used. | "gpt-4o-mini" |
max_tokens | The maximum token cost in a single API call. | 4096 |
temperature | See OpenAI Doc | 0.5 |
top_p | See OpenAI Doc | 1.0 |
frequency_penalty | See OpenAI Doc | 0 |
presence_penalty | See OpenAI Doc | 0 |
editor | The editor to be used to edit config file. Must in path. | "code" |
editor_arg | The arguments to be passed to the editor. %path will be replaced by the actual path. |
"%path" |