Should You Use GitHub Copilot or OpenAI Codex for AI Coding?
Is the AI pair programmer better than the natural language-to-code generational model?

With the rise of more and more complex machine learning algorithms and models, comes fascinating new AI implementations. Ranging from automation of jobs in Amazon warehouses to predicting the stock market, AI is being trained to do tasks with more speed and accuracy than has ever been available to humans before.
Most notable to software development, the release of OpenAI Codex and GitHub Copilot has sent shock waves through the software development community, with many fearing their inevitable takeover of development jobs. Now while there’s not much reason to fear replacement by an AI like OpenAI Codex or GitHub Copilot, there is an interesting question that has been posed to developers. Should I use a coding AI? And if so, which one should I use?
Should you use a coding AI?
Let’s talk about the first question, should you use a coding AI? Put simply, the answer is probably yes. First off, we have to ask ourselves why big tech businesses are investing so much in machine learning, with Microsoft investing billions of dollars into AI development firm OpenAI, the creator of Codex. Well, the biggest cost that most development firms face is the cost of developers.
Every hour that you have a developer working could cost between $20 and $200 dollars/hour. Multiply that by thousands of developers working for years and you can see a significant advantage to increasing the speed at which developers code. By introducing an assistant like GitHub Copilot, developers no longer have to worry about brainstorming an algorithm or a function to do a specific task (at least not as much as they used to), and can instead focus on the implementation of that function or algorithm.
By speeding up workflow, development firms can increase the productivity of their developers and spend less, while getting more. Therefore, it’s likely that coding alongside an AI will be the norm given a few years, and maybe even a requirement in some jobs. So not only does a coding AI speed up your own productivity and let you do and focus more on what you want to, but it also could be a necessity in the coming decade.
So which AI should You Use?
If you just want the short answer, you probably want to use GitHub Copilot.
However, like most things, this is a little more complicated than it seems. GitHub Copilot and OpenAI Codex are both AIs that, when given a prompt, will output code in a variety of languages that is often very accurate to what you’re looking for.
That being said, the main difference between the two comes with their respective scopes. OpenAI Codex and GitHub Copilot are both models trained on the GPT-3 language prediction model created by OpenAI. However, while GitHub Copilot writes code alongside you in your text editor (as the name suggests), Codex requires that you access it via their API, or Playground.
This can make it pretty tedious to use Codex for code completion because of all the steps involved. Take this little example in JavaScript where I’m using the OpenAI node package to get a simple function:
As you can see, all of that is for a simple function that returns the square root of a product. OpenAI’s biggest caveat is its interface, it’s simply going to be a process to get good code completion from Codex, at least for now.
That being said it’s still pretty cool that we can get a function, in a given language, by asking an AI to make it for us, using our own code. So how would we do this with GitHub Copilot? Here’s the same example with that:

Now that’s pretty nifty; Not only do we shorten the time that it takes to get a completion significantly, but we can use that directly in our code by pressing tab, or if we’re not really feeling the first suggestion it gives us, we can press ATL + ]
and ATL + [
to shuffle between suggestions.
At this point the answer might seem obvious, GitHub Copilot can be used directly to autocomplete your code without having to go through a tedious process or interface with the engine on OpenAI’s website. However, there are a couple of reasons why you might want to give OpenAI more of a chance.
First of all, GitHub Copilot is really only usable in a few IDEs, a list is available here. This means that developers using unsupported IDEs aren’t going to have much access to this tool, at least not yet. Therefore, for the time being, at least, those of you not using VSCode might accept the downsides of Codex’s interface to get those nifty code completions.
Second, Codex has something up its sleeve that is not readily available to GitHub Copilot users, training. That’s right, you can create your own fine-tuned OpenAI model by feeding it training data from files. If you do that, then it theoretically would be able to generate much more accurate and detailed responses than what GitHub Copilot might be capable of.
GitHub Copilot can understand the context of a file and generate very accurate, but specific code completion based on that. However, if you were to train a Codex model on say a bunch of files and code from a big project you’re working on, then its completion is going to have a lot more context of the app you’re working on because it’s not limited to the file that it’s in.
At the end of the day, what matters when choosing between the two of these is your use case. If you want to increase your productivity and write code faster with quick, accurate, and inline code completion, you’re probably looking at GitHub Copilot.
To be honest, most developers are probably in this group and will make that decision. That being said, if you have a specific use case where you need either really accurate and detailed completions, an API to interface with for your application, or aren’t using a Microsoft IDE, then OpenAI has you covered with Codex.
Pricing
As of late, GitHub Copilot has been released to the developer world for all to try… at a price. You can now expect to pay $10/month starting in August for access to GitHub Copilot unless you can prove you’re a student or you maintain a large open-source codebase. Therefore, you might be eyeing Codex a little more now, with the possibility of creating your own auto-completion tools and APIs.
That being said, Codex remains in private beta for the time being, and without access, you don’t get any of its features. Codex might also move into a paid or freemium membership later on, like most APIs, but we won’t know until the model is released.
As of now, I’d say use GitHub Copilot while you can, then once you have to pay for it think about your options more. However, GitHub Copilot is still a great tool, and I think it’s worth the money for the productivity it adds to your workflow. Whatever the case, I doubt you’ll be disappointed by either choice.
Happy Coding Everyone!