Site icon

Create Assistant API Request


This tutorial will teach us how to create an AI Assistant using the Create Assistant API request. We will use the Python programming language and Spyder IDE.


Create Assistant API Request

In this example, we’re creating an Assistant that is a GPT-4 model with the Code Interpreter tool enabled. The Python code to create a new AI assistant using the API call is as follows:


Create Assistant API Request
— Python OpenAI SDK
— OpenAI Tutorials —

from openai import OpenAI
client = OpenAI()
    assistant = client.beta.assistants.create(
    name=”TestingDocs Assistant”,
    instructions=”A helpful code assistant”,
    tools=[{“type”: “code_interpreter”}],
except Exception:
    print(“An error occurred”)
    print(“Assistant created successfully”,assistant)


This will create a new assistant. The model picked was gpt-4-turbo, and we have enabled the Code Interpreter tool. We can enable the following tools :


To verify and cross-check, log in to the OpenAI Platform. Click on the left navigation Assistants tab.

We can see that the assistant was successfully created.

That’s it.

OpenAI API Tutorials

OpenAI tutorials on this website can be found at:

Exit mobile version