An Emacs shell for OpenAI’s DALL-E
For related packages, see:
- chatgpt-shell: An Emacs shell for OpenAI’s ChatGPT.
- ob-chatgpt-shell: Evaluate ChatGPT shell blocks in Emacs org babel blocks.
- ob-dall-e-shell: Evaluate DALL-E shell blocks in Emacs org babel blocks.
- shell-maker: Create Emacs shells backed by either local or cloud services.
If you’re finding dall-e-shell
useful, help make the project sustainable and consider ✨sponsoring✨.
dall-e-shell
is in development. Please report issues or send pull requests for improvements.
Finding it useful? Like the package? I’d love to hear from you. Get in touch (Mastodon / Twitter / Reddit / Email).
- Load
(require 'dall-e-shell)
If using use-package, you can install with :ensure t
.
(use-package dall-e-shell
:ensure t
:custom
((dall-e-shell-openai-key
(lambda ()
(auth-source-pass-get 'secret "openai-key")))))
You’ll first need to get a key from OpenAI.
;; if you are using the "pass" password manager
(setq dall-e-shell-openai-key
(lambda ()
;; (auth-source-pass-get 'secret "openai-key") ; alternative using pass support in auth-sources
(nth 0 (process-lines "pass" "show" "openai-key"))))
;; or if using auth-sources, e.g., so the file ~/.authinfo has this line:
;; machine api.openai.com password OPENAI_KEY
(setq dall-e-shell-openai-key
(auth-source-pick-first-password :host "api.openai.com"))
;; or same as previous but lazy loaded (prevents unexpected passphrase prompt)
(setq dall-e-shell-openai-key
(lambda ()
(auth-source-pick-first-password :host "api.openai.com")))
M-x set-variable dall-e-shell-openai-key
(setq dall-e-shell-openai-key "my key")
(setq dall-e-shell-openai-key (getenv "OPENAI_API_KEY"))
Launch with M-x dall-e-shell
.
Note: M-x =dall-e-shell
keeps a single shell around, refocusing if needed. To launch multiple shells, use C-u M-x dall-e-shell
.
Type clear
as a prompt.
DALL-E(v3)> clear
Alternatively, use either M-x dall-e-shell-clear-buffer
or M-x comint-clear-buffer
.
Custom variable | Description |
---|---|
dall-e-shell-welcome-function | Function returning welcome message or nil for no message. |
dall-e-shell-openai-key | OpenAI key as a string or a function that loads and returns it. |
dall-e-shell-image-size | The default size of the requested image as a string. |
dall-e-shell-read-string-function | Function to read strings from user. |
dall-e-shell-request-timeout | How long to wait for a request to time out. |
dall-e-shell-model-version | The used DALL-E OpenAI model. For Dall-E 3, use “dall-e-3”. |
dall-e-shell-display-function | Function to display the shell. Set to `display-buffer’ or custom function. |
dall-e-shell-model-versions | The list of Dall-E OpenAI models to swap from. |
dall-e-shell-additional-curl-options | Additional options for `curl’ command. |
dall-e-shell-image-output-directory | Output directory for the generated image. |
dall-e-shell-image-quality | Image quality: `standard’ or `hd’ (DALL-E 3 only feature). |
C-<up> or M-p | dall-e-shell-previous-input | Cycle backwards through input history, saving input. |
dall-e-shell | Start a DALL-E shell. | |
dall-e-shell-insert-image-from-region-description | Generate and insert an image using current region as description. | |
dall-e-shell-interrupt | Interrupt `dall-e-shell’ from any buffer. | |
S-<return> | dall-e-shell-newline | Insert a newline, and move to left margin of the new line. |
RET | dall-e-shell-submit | Submit current input. |
C-x C-s | dall-e-shell-save-session-transcript | Save shell transcript to file. |
C-c C-v | dall-e-shell-swap-model-version | Swap model version from `dall-e-shell-model-versions’. |
dall-e-shell-mode | Major mode for DALL-E shell. | |
C-<down> or M-n | dall-e-shell-next-input | Cycle forwards through input history. |
M-r | dall-e-shell-search-history | Search previous input history. |
dall-e-shell-rename-buffer | Rename current shell buffer. |
👉 Find my work useful? Support this work via GitHub Sponsors or buy my iOS apps.
- Blog (xenodium.com)
- Blog (lmno.lol/alvaro)
- Plain Org (iOS)
- Flat Habits (iOS)
- Scratch (iOS)
- macosrec (macOS)
- Fresh Eyes (macOS)
- dwim-shell-command (Emacs)
- company-org-block (Emacs)
- org-block-capf (Emacs)
- ob-swiftui (Emacs)
- chatgpt-shell (Emacs)
- ready-player (Emacs)
- sqlite-mode-extras
- ob-chatgpt-shell (Emacs)
- dall-e-shell (Emacs)
- ob-dall-e-shell (Emacs)
- shell-maker (Emacs)