
3.4 Programming (for Digital Content Creation)
Topic Activity
Integrating an AI API into a Simple Learning Tool
Aim of the activity
To introduce educators to the concept of using Artificial Intelligence through APIs (Application Programming Interfaces) to enhance educational content and create simple, intelligent learning tools. Participants will learn how to connect to an AI service (OpenAI API) using a ready-made code template, experiment with prompts, and reflect on educational applications and ethical considerations.
Target Group
Duration
90–120 minutes (recommended as one extended session or two 60-minute sessions)
Objective
To introduce educators to the concept of using Artificial Intelligence through APIs (Application Programming Interfaces) to enhance educational content and create simple, intelligent learning tools. Participants will learn how to connect to an AI service (OpenAI API) using a ready-made code template, experiment with prompts, and reflect on educational applications and ethical considerations.
Materials necessary to execute activity
For Trainer Preparation:
· Trainer computer with projector or screen-sharing capability
· Pre-created example Google Colab notebook (provided below)
· Slides introducing APIs and educational use cases
· OpenAI account (free API key available at https://platform.openai.com)
For Participants:
· Laptop or computer with internet connection
· Google account (to access Google Colab)
· The shared Colab link or downloadable Python script template (provided by the trainer)
· Optional: Access to https://platform.openai.com/signup to obtain an API key
Steps for implementation
Step 1: Introduction to APIs and AI Tools (15–20 min)
1. Explain the concept of an API:
o Use a simple analogy: “An API is like a waiter in a restaurant. You (the user) place an order (your prompt), the waiter (API) takes it to the kitchen (AI service), and then brings back the dish (AI response).”
o Mention that educators can use APIs to make learning tools smarter—like automatically generating definitions, summaries, or quiz questions.
2. Show examples of API use in education:
o Translation apps (Google Translate uses APIs)
o Chatbots for student support
o Automated writing feedback systems
3. Explain the tool you’ll use today:
o Google Colab — a browser-based coding platform (no installation needed).
o OpenAI API — the “brain” that will generate text responses.
Trainer’s tip: Keep the explanation light and interactive. Reassure participants that no coding experience is required—they will copy and modify existing code.
Step 2: Access the Template (10 min)
1. Trainer shares the Google Colab link (e.g. a prepared notebook such as) https://colab.research.google.com/drive/1gTexampleLink
2. Participants open it in their browser (must be logged into a Google account).
3. The notebook has three prewritten cells:
1. Install and import libraries
2. Enter API key
3. Send a prompt to the AI model
Trainer shows how each cell can be executed using the ▶ Run button.
Step 3: Set Up the API Key (10–15 min)
1. Trainer explains: “To use the AI, we need an access key that tells the system who you are.”
2. Demonstrate how to create an OpenAI account at https://platform.openai.com/signup.
3. After login, click View API Keys → Create new secret key.
4. Copy the key (a string of letters and numbers).
5. Paste it into the second cell in Colab, replacing:
openai.api_key = "YOUR_API_KEY_HERE"
Trainer’s tip: For data safety, remind participants not to share keys publicly. If possible, provide your own key for class demonstration to avoid confusion.
Step 4: Run the Example Code (20–25 min)
1. In the third code cell, participants see this sample:
import openai
# Connect to OpenAI
response = openai.ChatCompletion.create(
model="gpt-3.5-turbo",
messages=[
{"role": "system", "content": "You are an educational assistant."},
{"role": "user", "content": "Explain the water cycle for 10-year-old students."}
]
)
print(response['choices'][0]['message']['content'])
· Trainer walks through each part:
· model: tells which AI brain is used
· messages: sets up conversation roles
· content: the user’s prompt
· Click ▶ Run.
· Output appears below, showing AI’s text (e.g., “The water cycle is how water moves around the Earth...”).
· Encourage participants to modify the user content (e.g., change topic or audience):
· “Explain photosynthesis for teenagers.”
· “Summarize the causes of World War I in three sentences.”
Step 5: Experiment and Reflect (20–25 min)
1. Participants test new prompts, such as:
o “Create 3 quiz questions about the human body.”
o “Translate this paragraph into simple English.”
o “Generate a fun classroom activity for learning fractions.”
2. Trainer explains that this same technique can power chatbots, feedback tools, or quiz generators.
3. Discussion:
o What kinds of educational tasks could benefit from AI APIs?
o What are the ethical or data protection concerns?
o How can educators stay transparent about AI use?
4. Optional extension: Participants add a new “system” message like:
{"role": "system", "content": "You are a quiz generator for language learners."}
Then run again to observe how output changes.
Step 6: Group Sharing (10–15 min)
· Participants share one creative or useful example they generated.
· Trainer collects ideas on a Padlet or shared document (e.g., “AI for feedback,” “AI for question generation”).
Wrap up by linking to further exploration (e.g., Hugging Face APIs, no-code AI tools like Poe.com, or Replit).
Adaptation Tips
On-site:Trainer demonstrates on projector while participants follow along on laptops. Trainer circulates to assist with copy-pasting code and troubleshooting errors.
Online:Trainer shares their screen in Zoom/Teams, provides the Colab link in chat, and supports participants through breakout rooms. Participants share results by copy-pasting outputs into chat or Padlet.
Hybrid:Trainer demonstrates in person while remote participants join via screen sharing and shared Colab notebook. All participants test and modify prompts collaboratively in real time.
Trainer Tips for Non-Technical Educators
· Run the example yourself once before class to confirm it works.
· Always use a shared demo API key (not personal ones from participants).
· Reassure learners that copying and modifying existing code is part of the process — understanding comes gradually.
· Focus on pedagogical implications, not coding mechanics.
· Encourage exploration: one participant’s curiosity often inspires the group.
Skills developed with the activity
By the end of the activity, participants will:
1. Understand what APIs are and how they connect software tools.
2. Use a ready-made Google Colab notebook to send requests to the OpenAI API.
3. Successfully generate educational content (explanations, quiz questions, or summaries).
4. Identify potential classroom applications of AI APIs.
5. Demonstrate awareness of data privacy and ethical considerations when using AI tools.
6. Gain confidence to explore other AI integrations or automation projects in the future.
Competences Developed
· DigCompEdu Area 2.2: Creating and modifying digital resources
· DigCompEdu Area 2.3: Managing, protecting, and sharing digital resources
· DigCompEdu Area 5.2: Analysing evidence – using AI for adaptive learning feedback
· DigCompEdu Area 6.1: Information and media literacy – critical understanding of AI-generated content
Methodology
- On-site
- Online
- Hybrid
Evaluation
Links & References
Funded by the European Union. Views and opinions expressed are however those of the author(s) only and do not necessarily reflect those of the European Union or the European Education and Culture Executive Agency (EACEA). Neither the European Union nor EACEA can be held responsible for them.

