This is an extension that incorporates the openAI's Codex API. By providing the code editor with the API_KEY of openAI Codex you can directly use it within your code files to generate code automatically.
- You are required to have a Codex API key in your possession.
As given in the requirements we need a Codex API key for this extension to work. If you have it already we are all ready to go.
- You will be required to enter the API key only when you open a VSCode instance after boot, or after installing the extension.
- To enter the API key, open Command Palette by
ctrl+shift+p
for windows, linux andcmd+shift+p
for mac - Try finding start session command which might look like
Codex: start session
and pressEnter
. You would be asked to enter your API key here, don't worry it is recieved in hidden star format, so you can just copy and paste it in front of other people. - And even if you forget to start a session and went on to the next command, it verifies if you have added a key before generating any code.
- Now, you want to use this extension to generate some code right, let's do that.
- As this is an AI it cannot read your mind, write some code prior to asking it to generate some code, you can write comments, and some code of your own, just to let the AI understand the objective and the programming language.
- After that go to command palette, and find something that looks like this
Codex: Generate Code Completion
, and pressEnter
. The extension will run for a while, so hang on. It will check if the key is correct, it will request the codex API to generate the code that you want, and write it in the current opened document.
- This is just an abstraction to the underlying Codex API that was implemented by openAI
- openai-codex <- Check the following link to understand the specification.
- Cannot generate multiple completion for the same piece of code
- The Generated code, is limited by the effeciency of AI
- Even though you have a API Key the extension might reject it
// Key not verified error message might be displayed Check: - If you have access to davinci-codex through playground Fix: - If you don't have access: please apply for codex - If you do have the access: A simple fix might be to create a new API key from the API keys settings and use that instead
- Improved README
- The request that are being made to the
api.openai.com
do not have server certificate verification - I would try to release a patch to re-enable server certificate verification.
{
// Specification for extension
"model_used": "davinci-codex",
// Tokens generated by AI per exection
// (Can be changed through settings)
"token_generation": 128,
"bug fixes": "extension.ts",
"fixes": "API Key verifications gets stuck, resolved"
}