What is the OpenAI API?

Working with the OpenAI API

James Chapman

Curriculum Manager, DataCamp

Coming up...

 

Course goals
  • Use the OpenAI API to access AI models
  • Use those models to solve various tasks
  • Use Python code to do this!

 

Expected knowledge
  • Subsetting Python lists and dictionaries
  • Control flow → if, elif, else
  • Loops → for, while

 

Not expected to know
  • AI or machine learning
Working with the OpenAI API

OpenAI, ChatGPT, and the OpenAI API

 

  • OpenAI = AI R&D company
  • ChatGPT = AI application
  • OpenAI API = Interface for accessing OpenAI models

 

The OpenAI organization logo.

1 Image Credit: OpenAI
Working with the OpenAI API

OpenAI, ChatGPT, and the OpenAI API

 

  • OpenAI = AI R&D company
  • ChatGPT = AI application
  • OpenAI API = Interface for accessing OpenAI models

 

A car showroom.

Working with the OpenAI API

OpenAI, ChatGPT, and the OpenAI API

 

  • OpenAI = AI R&D company
  • ChatGPT = AI application
  • OpenAI API = Interface for accessing OpenAI models

 

A person interacting with an interface for ordering cars.

Working with the OpenAI API

What is an API?

  • Application Programming Interface

A computer sending a request to an API.

Working with the OpenAI API

What is an API?

  • Application Programming Interface

A waiter delivering orders and food between the kitchen and tables. This mimics how APIs operate between devices and systems.

Working with the OpenAI API

What is an API?

 

Our device location is being sent to an API, which is then passed to a database. The API returns the response from the system, the weather forecast, back to our device.

Working with the OpenAI API

The OpenAI API

A computer sending a request to the OpenAI API.

Working with the OpenAI API

The OpenAI API

A computer sending a request to the OpenAI API, which contains the model and any data and model parameters.

Working with the OpenAI API

API vs. web interface

  • Provides flexibility for integrating AI into products, experiences, and processes
  • Interact via programming language

A computer interacting with the OpenAI API.

  • Very little setup
  • Sufficient for streamlining individual's workflows

The ChatGPT web interface.

Working with the OpenAI API

Building AI applications

DataLab = Cloud-based, AI-powered IDE

A screenshot of the generate code feature from DataLab.

1 https://www.datacamp.com/datalab
Working with the OpenAI API

Let's practice!

Working with the OpenAI API

Preparing Video For Download...