Visual Studio Code extension for Codex

I do not have access to the Github Copilot beta, so I’ve started to work on a VSC extension to have codex completion.

EDIT: I removed the extension as it has not been approved yet. However you can still install it locally using the build instructions on my repo:
VincentHch/vscodex

4 Likes

I thought about asking permission to OpenAI but I couldn’t find where I could ask. Do you have any contact for such requests ?
However I’m not sure if this is real competition as a codex api key is required.

1 Like

Email sent. Thanks !

Hi @vincenzo you can check out our Going Live policies here. I’m in the process of clarifying our policies on VSCode extensions and hope to have an update soon - in the meantime please reach out to safety-specialists@openai.com if you have questions!

3 Likes

The marketplace link is currently a 404.
I don’t think you need any kind of permission from OpenAI to do a vscode extension. It’s just a wrapper around the API.

1 Like

I removed the extension as it has not been approved yet. However you can still install it locally using the build instructions on my repo:
VincentHch/vscodex

2 Likes

@vincenzo Thank you for the extension. I just installed it. Getting an error:

No text selected! Please select some text to get snippet

Perhaps it’s related to the API key?

Glad you’re using my extension! Do not hesitate to star it if you like it :slight_smile: Not the entire file is sent to the API, only the selection at the moment you execute the command. Try to select some text as it is shown in the readme.md before pressing ctrl+enter.

1 Like

I disabled the VIM extension, and the error seems to have gone away. However, still nothing happens. API key is never used.

I’ve added error log, reinstall it and check the error message when executing the command. You can also try to debug the extension (press F5) to see what is happening.

1 Like

Hey @vincenzo. I have installed your plugin and it works as a charm!
Huge applause for your work!

1 Like

I’m getting VSCodex: Incorrect API key provided: undefined.

I’ve set the environmental variable, and it can be echoed.

$echo $OPENAI_API_KEY
ABCDEFG

Thanks :slightly_smiling_face: Do not hesitate if you have any improvements idea

1 Like

@fc1 You may actually not have access to the codex API.
Try this request to verify that you do have access:

curl https://api.openai.com/v1/engines/davinci/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
  "prompt": "# test",
  "temperature": 0.7,
  "max_tokens": 64,
  "top_p": 1,
  "frequency_penalty": 0,
  "presence_penalty": 0
}'

@vincenzo I have access to davinci-codex.

{"id": "cmpl-3bdKsOcoIe1AtTNTZkW3gVoNHR626", "object": "text_completion", "created": 1630098354, "model": "davinci:2020-05-03", "choices": [{"text": "_select_data_fifo pass # test_select_data_fifo_error pass #\u62a5\u9519: select(): fd 2: Invalid argument # test_select_data_pipe pass # test_select_data_pipe_error pass #\u62a5\u9519:", "index": 0, "logprobs": null, "finish_reason": "length"}]}

Hello @fc1! I just contributed a change to the extension that allows you to set the API key in the extension settings, try that and see if it works :slight_smile:

1 Like

@henrikfranzen3 @vincenzo the update works great, thank you!

1 Like

If anyone is interested, I’ve just pushed an interesting update in which you can choose to stop completion at the end of a function or class! Demo here: GitHub - vscodex

1 Like

Hi @vincenzo

You asked for an idea for your extension. The one thing I misses the most, is when I am writing a semi ‘unclear’ description for my method, I would like to see the best guess from codex. Then if it wasn’t what I was looking for I would like to get the next best guess and so forth (maybe be able to go back if I changed my mind?). When I am satisfied I accept the generated output.

What do you think?

Hi @vincenzo, If possible can you explain in detail how to install the extension that you have created. I checked your repo it was not clearly explained, thanks

1 Like