Tutorial 14 min read

Build Your First AI Assistant with the OpenAI API in 2026

Start with the modern stack: the Responses API, current models, and a minimal tool layer to build a safe first assistant.

RC
Rupert Chesman
AI Educator · Filmmaker
Updated September 2026

Key Takeaway

The current OpenAI path is to build on the Responses API with a current model, one or two tools, explicit instructions, and a simple state strategy. The Assistants API is deprecated.

The Modern Beginner Path

Building an AI assistant with the OpenAI API has changed significantly since 2024. The Assistants API is deprecated. The current path is the Responses API, which provides a cleaner interface for building assistants with tool use, structured outputs, and multi-turn conversations.

This tutorial walks through building a simple but functional AI assistant. The Vibe Coding course extends this into more complex applications.

Step 1: Start with the Quickstart

Begin with OpenAI's official quickstart. Install the Python SDK, set up your API key, and make your first API call. This should take less than 10 minutes.

Installation pip install openai
export OPENAI_API_KEY="your-key-here"
First API Call from openai import OpenAI
client = OpenAI()

response = client.responses.create(
  model="gpt-5.6-terra",
  input="Explain what an AI assistant is in two sentences."
)

print(response.output_text)

If this returns a sensible response, your setup is correct.

Step 2: Pick a Current Model

The GPT-5.6 family (generally available since 9 July 2026) comes in three tiers, all with a 1M-token context. For a first assistant, use gpt-5.6-terra for production and gpt-5.6-luna for development. Key considerations:

  • gpt-5.6-sol: The flagship. Strongest reasoning and tool use; around US$4 per million input tokens and US$20 per million output on the current promotional price (through at least 21 November 2026). Use it when the task genuinely needs it.
  • gpt-5.6-terra: The balanced tier, roughly US$2/$12 per million tokens. Best default for a production assistant: good instruction following and tool use at a sensible price.
  • gpt-5.6-luna: The fast, cheap tier at US$0.20/$1.20 per million tokens. Ideal for development, testing and simple classification or routing.

Start with gpt-5.6-terra. Switching to Sol or Luna later is a one-line change — the model name is the only thing that moves.

Step 3: Define the Job

Before writing more code, define what your assistant will do. A good first assistant has a narrow, specific job:

  • Answer questions about company documentation.
  • Help users draft emails in a specific style.
  • Analyse CSV data and produce summary reports.
  • Classify customer feedback into categories.

For this tutorial, we build a document assistant. The Prompt Builder tool can help structure the system prompt.

System Prompt You are a document assistant for [Company Name]. Your job is to answer questions using only the provided documents.

Rules:
- Only answer questions from the documents.
- If the answer is not in the documents, say so clearly.
- Always cite which document you found the answer in.
- Do not make up information.

Step 4: Add One Tool

Tools give your assistant the ability to take actions beyond generating text. For a document assistant, the most useful first tool is a search function.

Start with one tool. Each additional tool adds complexity. Get one working reliably before adding more. The AI Agents course covers multi-tool architectures.

Step 5: Log and Test

From the first version, log every interaction: input, reasoning, tool calls, and output. Build a test set of 20-30 questions with expected answers:

  • Happy path tests: Questions the assistant should answer correctly.
  • Boundary tests: Questions close to scope but not exactly covered.
  • Out-of-scope tests: Questions the assistant should decline.
  • Adversarial tests: Attempts to make the assistant ignore instructions.

Document Assistant Example

Here is a complete, minimal document assistant tying all steps together:

Complete Document Assistant from openai import OpenAI
import json

client = OpenAI()

# Simple document store
documents = {
  "pricing": "Basic $29/month. Pro $79/month. Enterprise custom.",
  "features": "Real-time analytics, team collaboration, API access.",
  "support": "Email (24h response) and live chat (business hours)."
}

# Define the search tool
tools = [{
  "type": "function",
  "name": "search_docs",
  "description": "Search company documents.",
  "parameters": {"type": "object", "properties": {"query": {"type":"string"}}, "required": ["query"]}
}]

This is a starting point, not a production system. The Vibe Coding course builds this into a full production application.

Frequently Asked Questions

Should I use the Assistants API or the Responses API?

The Responses API. The Assistants API is deprecated as of 2026. The Responses API is simpler, more flexible, and better supported.

What programming language should I use?

Python is the best-supported language for the OpenAI API. JavaScript/TypeScript is the second choice. Both have official SDKs.

How much does it cost to build and run an AI assistant?

Development and testing costs are minimal (typically under $5). Production costs depend on usage and model choice. At GPT-5.6 Luna prices ($0.20 per million input tokens, $1.20 per million output) a simple request costs a small fraction of a cent; on Terra it is closer to a cent or two.

Want to Go Deeper?

This article is part of the Rupert Chesman AI Learning Hub. Explore structured courses, tools, and resources to build real AI fluency.

Explore Courses

About the Expert

Rupert Chesman · AI Educator · Filmmaker · Author

Rupert Chesman is an AI educator and filmmaker with years of experience teaching AI and creating AI courses — with over 700 students taught in the past year alone. He turns complex AI concepts into practical, immediately applicable skills across corporate workshops, online courses and live intensives. His courses cover everything from prompt engineering to agentic workflows and AI-native leadership.

Continue Reading

Free Weekly Insights

Get More AI Guides

Join 700+ students taught this year. Weekly tips, new articles, and practical frameworks. No spam, ever.

No spam. Unsubscribe anytime. Free cheat sheets on signup.