|
7 | 7 |
|
8 | 8 | [](https://github.com/emacs-openai/codegpt/actions/workflows/test.yml) |
9 | 9 |
|
| 10 | +This Emacs Code extension allows you to use the official OpenAI API to generate |
| 11 | +code or natural language responses from OpenAI's [GPT-3](https://en.wikipedia.org/wiki/GPT-3) |
| 12 | +to your questions, right within the editor. |
| 13 | + |
| 14 | +## 🏆 Features |
| 15 | + |
| 16 | +WIP |
| 17 | + |
| 18 | +## 💾 Installation |
| 19 | + |
| 20 | +#### package.el |
| 21 | + |
| 22 | +This package is available from [JCS-ELPA](https://jcs-emacs.github.io/jcs-elpa/). |
| 23 | +Install from these repositories then you should be good to go! |
| 24 | + |
| 25 | +Normall, you don't need to add `(require 'codegpt)` to your confiugration since |
| 26 | +most `codegpt` commands are autoload and can be called without loading the module! |
| 27 | + |
| 28 | +#### use-package |
| 29 | + |
| 30 | +If you are using [use-package](https://www.emacswiki.org/emacs/UsePackage), |
| 31 | +add the following to your `init.el` file: |
| 32 | + |
| 33 | +```elisp |
| 34 | +(use-package codegpt :ensure t) |
| 35 | +``` |
| 36 | + |
| 37 | +or with `straight.el`: |
| 38 | + |
| 39 | +```elisp |
| 40 | +(use-package codegpt |
| 41 | + :straight (codegpt :type git :host github :repo "emacs-openai/codegpt")) |
| 42 | +``` |
| 43 | + |
| 44 | +#### Manual installation |
| 45 | + |
| 46 | +Copy all `.el` files in this repository to `~/.emacs.d/lisp` and add the following: |
| 47 | + |
| 48 | +```elisp |
| 49 | +(add-to-list 'load-path "~/.emacs.d/lisp/") |
| 50 | +(require codegpt) |
| 51 | +``` |
| 52 | + |
| 53 | +## 🔑 Obtaining API key |
| 54 | + |
| 55 | +To use this extension, you will need an API key from OpenAI. To obtain one, |
| 56 | +follow these steps: |
| 57 | + |
| 58 | +1. Go to [OpenAI's website](https://beta.openai.com/account/api-keys). If you |
| 59 | +don't have an account, you will need to create one or sign up using your Google |
| 60 | +or Microsoft account. |
| 61 | +2. Click on the `Create new secret key` button. |
| 62 | +3. Copy the key and paste it into the `API Key` field in the extension settings. |
| 63 | + |
| 64 | +When you create a new account, you receive $18 in free credits for the API which |
| 65 | +you must use in the first 90 days. You can see pricing information |
| 66 | +[here](https://openai.com/api/pricing/). 1000 tokens are about 700 words, and |
| 67 | +you can see the token count for each request at the end of the response in the |
| 68 | +sidebar. |
| 69 | + |
10 | 70 | ## 🔨 Usage |
11 | 71 |
|
12 | | -The fastest way to use this package: |
| 72 | +Highlight or select code using the `set-mark-command`, then do: |
13 | 73 |
|
14 | 74 | ``` |
15 | 75 | M-x codegpt |
@@ -37,4 +97,3 @@ If you would like to contribute to this project, you may either |
37 | 97 | clone and make pull requests to this repository. Or you can |
38 | 98 | clone the project and establish your own branch of this tool. |
39 | 99 | Any methods are welcome! |
40 | | - |
|
0 commit comments