How to Create a Personalized ChatGPT Assistant using OpenAI’s Assistants API

Amit Rai
4 min readNov 12

Build personal AI assistants for your applications using OpenAI Assistant API

Image Generated by DELL-E

OpenAI has recently introduced an exciting feature, the Assistants, designed to help building powerful AI assistants capable of performing various tasks​​.

This weekend, I decided to explore the capabilities of the Assistant APIs to create an assistant, a “Math Homework Helper.”

This article will detail the process, drawing on the official OpenAI `documentation and my own coding experience.

Understanding OpenAI’s Assistants API

The Assistants API, still in beta, offers flexibility and power in creating AI assistants. These assistants can utilize OpenAI’s models with specific instructions to tune their personality and capabilities​​. Crucial to this are these main components:

  1. Assistant: This is the core AI entity that uses OpenAI’s models.
  2. Thread: Representing a conversation session between an Assistant and a user, Threads store messages and handle truncation to fit content into the model’s context​​.
  3. Message: Created by either an Assistant or a user, these can include text, images, and other files, and are stored in Threads​​.
  4. Run: Execute the Assistant within the Thread to initiate responses, which in turn automatically activates the necessary tools..


  1. Python
  2. OpenAI Key
  3. OpenAI Python SDK v1.2.x
  4. VS Code

Building the Assistant

To get started, one needs to specify the model and can further customize the Assistant’s behavior with parameters like instructions, tools, and file_ids etc​​. Here’s an example of creating a Math Tutor Assistant:

assistant = client.beta.assistants.create(
name="Math Homework Helper",
instructions="You are a personal math Homework Helper. Write and run code to answer math questions.",
tools=[{"type": "code_interpreter"}],

Interacting with the Assistant

Amit Rai

Cloud computing | Artificial Intelligence | Microservices