|
6 | 6 |
|
7 | 7 | [](https://github.com/emacs-openai/chatgpt/actions/workflows/test.yml) |
8 | 8 |
|
| 9 | +This Emacs Code extension allows you to use the official OpenAI API to generate |
| 10 | +code or natural language responses from OpenAI's [ChatGPT](https://openai.com/blog/chatgpt) |
| 11 | +to your questions, right within the editor. |
| 12 | + |
| 13 | +*P.S. This plugin focuses on experience with making conversations with ChatGPT!* |
| 14 | + |
| 15 | +<p align="center"> |
| 16 | +<img alt="explain" src="./etc/demo.gif"/> |
| 17 | +</p> |
| 18 | + |
| 19 | +## 💾 Installation |
| 20 | + |
| 21 | +#### package.el |
| 22 | + |
| 23 | +This package is available from [JCS-ELPA](https://jcs-emacs.github.io/jcs-elpa/). |
| 24 | +Install from these repositories then you should be good to go! |
| 25 | + |
| 26 | +Normally, you don't need to add `(require 'chatgpt)` to your configuration since |
| 27 | +most `'chatgpt` commands are autoload and can be called without loading the module! |
| 28 | + |
| 29 | +#### use-package |
| 30 | + |
| 31 | +If you are using [use-package](https://www.emacswiki.org/emacs/UsePackage), |
| 32 | +add the following to your `init.el` file: |
| 33 | + |
| 34 | +```elisp |
| 35 | +(use-package 'chatgpt :ensure t) |
| 36 | +``` |
| 37 | + |
| 38 | +or with `straight.el`: |
| 39 | + |
| 40 | +```elisp |
| 41 | +(use-package 'chatgpt |
| 42 | + :straight ('chatgpt :type git :host github :repo "emacs-openai/'chatgpt")) |
| 43 | +``` |
| 44 | + |
| 45 | +#### Manual installation |
| 46 | + |
| 47 | +Copy all `.el` files in this repository to `~/.emacs.d/lisp` and add the following: |
| 48 | + |
| 49 | +```elisp |
| 50 | +(add-to-list 'load-path "~/.emacs.d/lisp/") |
| 51 | +(require 'chatgpt) |
| 52 | +``` |
| 53 | + |
| 54 | +## 🔑 Obtaining API key |
| 55 | + |
| 56 | +To use this extension, you will need an API key from OpenAI. To obtain one, |
| 57 | +follow these steps: |
| 58 | + |
| 59 | +1. Go to [OpenAI's website](https://beta.openai.com/account/api-keys). If you |
| 60 | +don't have an account, you will need to create one or sign up using your Google |
| 61 | +or Microsoft account. |
| 62 | +2. Click on the `Create new secret key` button. |
| 63 | +3. Copy the key and paste into the 'API Key' field under the 'openai' custom group settings. |
| 64 | + |
| 65 | +When you create a new account, you receive $18 in free credits for the API which |
| 66 | +you must use in the first 90 days. You can see pricing information |
| 67 | +[here](https://openai.com/api/pricing/). 1000 tokens are about 700 words, and |
| 68 | +you can see the token count for each request at the end of the response in the |
| 69 | +sidebar. |
| 70 | + |
9 | 71 | ## 🔨 Usage |
10 | 72 |
|
11 | | -WIP |
| 73 | +To start this package: |
| 74 | + |
| 75 | +``` |
| 76 | +M-x chatgpt |
| 77 | +``` |
| 78 | + |
| 79 | +You will then be asked to insert your response; in this window, you press |
| 80 | +<kbd>return</kbd> to send the message, and <kbd>Shift</kbd>+<kbd>return</kbd> |
| 81 | +to insert a newline like a normal browser! |
12 | 82 |
|
13 | 83 | ## 📝 Customization |
14 | 84 |
|
|
18 | 88 | - `chatgpt-max-tokens` - The maximum number of tokens to generate in the completion. |
19 | 89 | - `chatgpt-temperature` - What sampling temperature to use. |
20 | 90 | - `chatgpt-input-method` - Method to receive input. |
| 91 | +- `chatgpt-spinner-type` - Type of the spinner. |
| 92 | +- `chatgpt-display-tokens-info` - Non-nil we display tokens information for each request. |
21 | 93 |
|
22 | 94 | ## 🔗 References |
23 | 95 |
|
|
0 commit comments