Skip to main content
HomeTutorialsArtificial Intelligence (AI)

How to Use ChatGPT Code Interpreter

Everything you need to know about OpenAI’s ChatGPT Code Interpreter
Jul 2023  · 9 min read

OpenAI's ChatGPT has taken the world by storm with its remarkable text-generation abilities. Presently, the chatbot continues to captivate users by generating charts, maps, and transforming images into videos, thanks to a newly introduced feature called Code Interpreter. This feature, exclusive to ChatGPT Plus subscribers, was launched by OpenAI on July 6.

This article gives an overview of how you can use ChatGPT code interpreter functionality with the help of a few example use cases.

ChatGPT Plugins

ChatGPT’s Code Interpreter is a plugin. Yes, it’s a plugin. ChatGPT plugins are enhancements that augment what ChatGPT can do for you. For example, the Kayak and Expedia plugins can answer real-time travel questions. These plugins are found in the ChatGPT plugins store.

ChatGPT Plugin Store (only available to ChatGPT plus users)

ChatGPT Plugin Store (only available to ChatGPT plus users)

In fact Code Interpreter is one of the two plugins officially published by OpenAI itself. Plugins are tools designed specifically to help ChatGPT access up-to-date information, run computations, or use third-party services.

The other plugin that OpenAI published before Code Interpreter is “Web browsing”. Currently, the web browsing plugin is unavailable as OpenAI has recently removed it due to security and privacy issues.

What is ChatGPT Code Interpreter?

ChatGPT is a chatbot that responds to questions using a technology known as a large language model (LLM). This technology works by predicting the next word in a sequence to form coherent responses. However, when the code interpreter feature is activated, ChatGPT's capabilities are significantly enhanced.

With the code interpreter enabled, ChatGPT can write and execute computer code to provide answers. This feature, introduced by OpenAI, allows the chatbot to perform tasks it couldn't do before. For instance, it can carry out complex calculations, generate charts based on user-uploaded data, and more, all through the execution of code.

The introduction of the code interpreter is seen by some as a way to reduce inaccuracies, a common issue associated with LLMs. By executing code to find answers, the chatbot can provide more precise and accurate responses, enhancing the overall user experience.

Technically speaking, the ChatGPT model has access to a Python interpreter in a sandbox environment and it can not only write code but also execute it in a Python environment and return the answers. If the code fails (as it does many times), it can also debug the code reading the callback messages and automatically enters the loop to fix the code and make it work.

The code interpreter feature stays active for the whole chat, but there's a time limit to make sure things don't go on for too long. The cool thing is, you can run multiple pieces of code one after the other, and they can work together.

Plus, you can send files to this chat conversation. So, if your code needs to read data from a file, you can send that file over. And when your code is done, you can get the results back. For example, if your code makes a new file, you can download that file and use it however you want. At the moment the limit on input file size is roughly 500 MB.

Here’s a simple example of Code Interpreter from official OpenAI documentation:

Code interpreter plugin performing logic calculations

Code interpreter plugin performing logic calculations

Getting started with Code Interpreter

Getting started is easy but you do need a ChatGPT plus account to access this functionality. Even if you have ChatGPT plus, the functionality is not available to you by default as it is in beta and must be turned on from the settings.

If you have ChatGPT plus, all you need to do is click on settings on left-hand corner and turn on the toggle button for Code Interpreter:

Enabling Code interpreter from Beta features in ChatGPT settings

Enabling Code interpreter from Beta features in ChatGPT settings

Common use-cases of ChatGPT code interpreter

The most common use-case of ChatGPT’s Code Interpreter that came out so far is Analyzing Data. For example, if you ask ChatGPT to find something interesting in your data, it can examine information like your financial records, health stats, or location details and give you some insights. People working in finance have found it useful for tasks like studying stock prices or planning a budget. Researchers are also using this tool to make unique data visualizations. For example this interactive graph of World Population was created by ChatGPT’s code interpreter.

2022 World Population Map


Even though data analysis is the most common use-case for now. Theoretically, any task that requires logic and computation should be possible for ChatGPT’s code interpreter to achieve. From the initial user studies, OpenAI has identified these areas where the code interpreter is particularly very useful:

  • Solving mathematical problems, both quantitative and qualitative
  • Doing data analysis and visualization
  • Converting files between formats

Examples of using ChatGPT code interpreter

Example 1 - Data Analysis on Toy Dataset

First, let’s try it out with a very simple dataset. This is what the dataset looks like:

Carat table

I will upload the csv file and ask the ChatGPT’s code interpreter to analyze the data through a simple prompt. Before you do that we have to select Code Interpreter from the dropdown towards the top (If you don’t have ChatGPT plus you won’t even see the dropdowns).

Code interpreter option menu

As soon as you select Code Interpreter you will see a plus sign in the message box using which you can use to upload files.


Once you input the prompt, the ChatGPT code interpreter starts processing. I can't display the entire output here since it's pretty big, as it includes the process itself, but here are a few insights extracted.

output visualizations

Having worked on this dataset before I can tell this is relevant insight and it’s impressive how fast it churned that out. Here is the story as well that we asked for:

Bulleted insights

This is pretty impressive. However, the dataset is relatively simple with 6,000 rows and 7 columns—pretty clean and straightforward. Let’s try out this example with a dataset that’s more likely for the real world.

Gain access to 60+ ChatGPT prompts for data science tasks in this ChatGPT Cheat Sheet for Data Science on DataCamp.

Example 2 - Data Insights on a more complex dataset

In this example, the dataset is of Canadian CPI inflation from StatsCan. This is what the dataset looks like—it is raw, has duplicates, missing values, a lot of encoded information, and geographical coding.

Inflation data

Let’s see what kind of insights we can get from this dataset and a simple prompt.


1. Developing The Schema

dataset schema

2. Data Cleaning

dataset analysis

3. Data Visualization

4. Extracting Insights

Insight extraction

This is impressive. It has done a decent job in understanding the data, cleaning the data, thinking of the relevant / appropriate visualization, then writing Python code to generate that visualization, and finally writing insights around it. It’s not perfect, but it’s very promising compared to all the automated insight tools we have seen in the past.

Do you want to learn how to use ChatGPT in a real-life end-to-end data science project? Check out this Guide to Using ChatGPT For Data Science Projects on DataCamp now.

Example 3 - Image Animation using ChatGPT

What you can also do is upload an image and make ChatGPT edit the image as well. For example, I will upload an image of an apple and ask it to animate it.

animation prompt

It may ask you some clarifying questions but will eventually write a code to animate the image as per your request.

animation working process

output gif

Animated output (gif file) downloaded from ChatGPT's Code Interpreter


OpenAI's ChatGPT Code Interpreter is a groundbreaking feature that expands the capabilities of the AI-driven chatbot. By enabling the code interpreter, ChatGPT gains the ability to write and execute computer code, allowing it to perform complex tasks such as calculations, data analysis, and generating visualizations.

This feature not only enhances the accuracy and precision of ChatGPT's responses but also provides users with a more interactive and dynamic experience. From analyzing data to solving mathematical problems, the code interpreter opens up a wide range of possibilities for users, making ChatGPT a powerful tool for various applications.

If you want to Level up your workflows and transform your business with ChatGPT! Join an introductory level Introduction to ChatGPT course on DataCamp now and master the power of generative AI. Unlock endless possibilities and revolutionize your work today! Enroll here.

Introduction to ChatGPT Course

Get Started with ChatGPT

Start Now

How to Become a Prompt Engineer: A Comprehensive Guide

A step-by-step guide to becoming a prompt engineer: skills required, top courses to take, with career advancement tips.
Srujana Maddula's photo

Srujana Maddula

9 min

What is Multimodal AI?

Discover multimodal AI, one of the most promising trends in generative AI.
Javier Canales Luna's photo

Javier Canales Luna

8 min

Stability AI Announces Stable Diffusion 3: All We Know So Far

Find out about the new updates to Stable Diffusion and discover the capabilities of the version 3 text-to-image model.
Richie Cotton's photo

Richie Cotton

[AI and the Modern Data Stack] How Databricks is Transforming Data Warehousing and AI with Ari Kaplan, Head Evangelist & Robin Sutara, Field CTO at Databricks

Richie, Ari, and Robin explore Databricks, the application of generative AI in improving services operations and providing data insights, data intelligence and lakehouse technology, how AI tools are changing data democratization, the challenges of data governance and management and how Databricks can help, the changing jobs in data and AI, and much more.
Richie Cotton's photo

Richie Cotton

52 min

[AI and the Modern Data Stack] Accelerating AI Workflows with Nuri Cankaya, VP of AI Marketing & La Tiffaney Santucci, AI Marketing Director at Intel

Richie, Nuri, and La Tiffaney explore AI’s impact on marketing analytics, how AI is being integrated into existing products, the workflow for implementing AI into business processes and the challenges that come with it, the democratization of AI, what the state of AGI might look like in the near future, and much more.
Richie Cotton's photo

Richie Cotton

52 min

Building Intelligent Applications with Pinecone Canopy: A Beginner's Guide

Explore using Canopy as an open-source Retrieval Augmented Generation (RAG) framework and context built on top of the Pinecone vector database.
Kurtis Pykes 's photo

Kurtis Pykes

12 min

See MoreSee More