A LaunchBar action to interact with the ChatGPT API. Responses are received directly in LaunchBar and can be browsed, opened, previewed with Quick Look, inserted, or sent to another action. Conversation history is preserved for context. Responses are cached on disk. Understands keyword modifiers and commands. ChatGPT system messages are configurable via personas. Requires an OpenAI API key.
Open ChipiChat in LaunchBar, hit the spacebar, enter a command or message, then hit return to send it to ChatGPT.
The input will be taken from the clipboard if no text is entered into LaunchBar. This enables a powerful workflow to quickly pass text through ChatGPT.
As an example, here’s how you can send text on the clipboard to ChatGPT using the rewrite persona, and immediately insert the response into the frontmost document (watch a screencast of this):
- Select and copy text in a document.
- Invoke ChipiChat.
- Type
rewrite
and hit⇧ ↵
. - ChatGPT’s response replaces the selected text.
⌘ ↵
(command + return) Open the response in your text editor.⇧ ↵
(shift + return) Insert the response at the current cursor position.⌃ ↵
(control + return) Quick Look the response.⌘ Y
Quick Look the response.⌘ C
Copy the response to the clipboard.↵
(return) Open the response in your text editor (reconfigurable using thedefault_action
config option).→
(right-arrow) Browse the response as a list (ideal for acting on specific lines of text).⇥
(tab) Send the text to other LaunchBar targets, e.g., send the output to a friend by passing it to the Compose Message action.
Prefix your message with one-or-more modifiers for enhanced functionality:
(persona name)
: Use a predefined or custom persona.N.N
: Adjust response randomness by using the specified temperature value, e.g., “1.0 why is the sky blue?”.4
: Use the GPT-4 model (requires GPT-4 API access).copy
: Automatically copy the response to the clipboard.image
: Generate an image with DALL·E and return the image URL.new
: Start a new conversation with no history.transient
: Exclude conversation history for this message.
You can combine modifiers, e.g., “code copy 4 js uuid function” sends “js uuid function” to GPT-4 API with the code persona and copies the response. All modifiers must go at the beginning of the message.
Manage conversation history, settings, and personas by sending commands to ChipiChat:
help
: Display a short user guide.history
: Display recent conversation history.export
: Save conversation history to a file in ~/Downloads/.clear
: Erase all conversation history (otherwise, conversations are saved for the duration defined by thehistory_expiration_days
config option).cache
: Open the cache directory in the Finder.config list
: Show current configuration settings.config reset
: Reset all configuration options to default.config set OPTION VALUE
: Set the configuration OPTION to VALUE, e.g.,config set default_action alert
.persona list
: View a summary of personas.persona export
: Save all personas and their prompts to a file in ~/Downloads/.persona delete NAME
: Delete a persona.persona reset
: Reset personas to default. This will erase any custom personas you added.persona set default SYSTEM_MESSAGE
: Change the default persona’s system message.persona set NAME SYSTEM_MESSAGE
: Add or modify a persona.redo
: Regenerate the response using a random temperature between 0–1.version
: Display ChipiChat version and check if a new version is available.
Prerequisite: you must have LaunchBar installed.
Before you can use ChatGPT, you must get an OpenAI API key:
- Create an OpenAI account.
- Add a credit card in Account → Billing → Payment methods.
- Create a new secret API key.
- Download
ChipiChat.lbaction.zip
from releases. - Unzip it, and double-click the resulting
ChipiChat.lbaction
file to install (or manually move it into~/Library/Application Support/LaunchBar/Actions/
). - (optional) If you get this warning message, run the following command in Terminal.app to remove the Gatekeeper quarantine attribute:
xattr -d com.apple.quarantine ~/Library/Application\ Support/LaunchBar/Actions/ChipiChat.lbaction
- Open LaunchBar and type
cc
to invoke ChipiChat. - Hit the spacebar, type
config set api_key YOURAPIKEYHERE
, and hit return to save your API key in LaunchBar:
(Alternatively, you can use export OPENAI_API_KEY="…"
in your shell profile.)
Now you’re ready to use ChipiChat!
Invoke ChipiChat, hit the spacebar, then type a message and hit return:
After a couple seconds, you receive the response:
That’s a bit hard to read because not all the response text is visible, but if you press the right-arrow key, you can view it as a list:
Or, you can view it in Quick Look (press the left-arrow key to go back, then press ⌘ Y
or ⌃ ↵
):
ChipiChat has many features and myriad customizable options. Practice all the commands listed in usage and adjust the configuration options until ChipiChat works exactly how you want it to.
- Run the
version
command to check for new versions. - Download the new
ChipiChat.lbaction.zip
file from releases, unzip it, and double-click it to install. - Read the change log on the release page, which may have special instructions such as a requirement to run
config reset
after updating.
Use a persona to set the overall behavior of the assistant. Create your own or use one of the predefined personas (changelog
, code
, commit
, complete
, condense
, expand
, fix
, list
, reply
, rewrite
, safe
, summarize
, write
). A default persona is used if no persona is specified when you send a message.
Manage personas with these commands:
persona list
: View a summary of personas.persona export
: Save all personas and their prompts to a file in ~/Downloads/.persona delete NAME
: Delete a persona.persona reset
: Reset personas to default. This will erase any custom personas you added.persona set default SYSTEM_MESSAGE
: Change the default persona’s system message.persona set NAME SYSTEM_MESSAGE
: Add or modify a persona.
The SYSTEM_MESSAGE
is the system message that is included with the request to ChatGPT that influences the behavior of the assistant.
As an example, to create a persona named “Pierre” which translates user messages to French:
persona set pierre Translate the user message to French
To use a persona, add the persona’s NAME to the beginning of your message. So, to use the Pierre persona, just write “pierre retirement in france must be amazing” and the assistant will respond, “La retraite en France doit être incroyable.” The persona can be combined with other keyword modifiers, e.g., “copy list mexican zombie films” to use the list persona and copy the results to the clipboard automatically.
The following options can be changed using the config set OPTION VALUE
command. For example, to change the default_action
:
config set default_action quicklook
To view currently-set values, send the config list
command.
To reset all configuration options to default, send the config reset
command.
api_key
: Your OpenAI API key (default: empty or imported from$OPENAI_API_KEY
).cache_enable
: If you prefer to have a fresh response for every message, set this tofalse
(default:true
).cache_expiration_minutes
: How long before cached responses expire. This is useful to avoid loading a cached response for the same question in a different context, e.g., the message “please continue” might match a cached response from an earlier reply (default:15
). If a message loads a cached response unexpectedly, you can reduce the cache expiration, clear the history, or just send the query again with extra characters that make it unique.cache_min_words
: Minimum words in input text required before response is cached. Short phrases are less unique, and are more likely to load cached responses from a different context (default:3
).default_action
: The action to run when hitting return after receiving a response (options:open
,insert
,quicklook
,alert
,copy
,largetype
; default:open
).default_action_auto
: Set this totrue
to run thedefault_action
automatically without having to hit return after receiving a response (options:true
,false
; default:false
).hide
: Set this totrue
to hide LaunchBar while waiting for a response from ChatGPT (options:true
,false
; default:false
).history_expiration_days
: How long before old messages are removed from the conversation history (default:7
).filename_extension
: The extension of cached files changes how they open in a text editor and Quick Look (options:txt
,md
,markdown
; default:txt
). If you have a Quick Look extension that supports Markdown (e.g., Peek), change this tomd
for syntax highlighting.max_history_minutes
: Maximum age of conversation history to include in requests for context (default:480
).max_history_tokens
: Maximum amount of conversation history to include in requests for context (default:1000
).max_response_tokens
: Maximum amount of tokens to return in the response (default:Infinity
).model
: Which OpenAI model to use (default:gpt-3.5-turbo
).temperature
: What sampling temperature to use, between0.0
and2.0
(default:0.1
).timeout
: How many seconds to wait for a response from the API (default:30
; using GPT-4 adds timeout + 120 seconds).
Use the default_action
and default_action_auto
options to customize your preferred interface for receiving responses.
open
: Open the response in the default text editor. Hide LaunchBar.insert
: Paste the contents of the response into the cursor position. Hide LaunchBar.quicklook
: Open the response in Quick Look. LaunchBar remains open, so you can easily close the Quick Look (Esc
key) and do something else with the response.alert
: Open the response in a LaunchBar alert. Hit “Reply” to keep the conversation going (the cursor will return to the input field, ready to send the next message).copy
: Copy the contents of the response on the clipboard. Hide LaunchBar.largetype
: Open the response in a LaunchBar’s large type display. Only useful for short responses.
Set default_action_auto
to true
to automatically open the default action without needing to press return
after receiving a response.
If you use a Quick Look plugin that formats markdown with syntax highlighting (such as Peek), these settings will open every response in Quick Look:
config set filename_extension md
config set default_action quicklook
config set default_action_auto true
The best settings to carry on a conversation is to use LaunchBar alerts, which has a Reply button:
config set default_action alert
config set default_action_auto true
The open
and insert
actions are best for generating content, such as generating blog posts or emails.
The open
and quicklook
actions are best for generating code. Also press the right-arrow on a response to view it as a list of items, then copy–paste just the few lines that you need.
Remember, you can override the default action behavior by holding command, shift, or control when you hit return to open, insert, or Quick Look the response.
Press the right-arrow to view a response as a list with icons representing parts of Markdown content
( for code,
for ordered list,
for unordered list,
and
for all other text).
If you’re annoyed that LaunchBar remains on the screen while waiting for a response, turn on hiding: config set hide true
.
- @ptujec’s cuter Ask ChatGPT LaunchBar action.
- Chris Lemke’s ChatFred Alfred workflow.
- Awesome ChatGPT API – Curated list of apps and tools you can use with your own API key.
Contact me on Twitter, the Fediverse, or create a GitHub issue.
Do you find this free software useful? Say thanks with a coffee!