DEV Community

diwushennian4955
diwushennian4955

Posted on

I Built an AI Course Generator That Creates Images + Audio for $0.003 — Here's How

instructional-agents just landed on PyPI — a research-backed LLM agent system for automated course material generation (accepted at EACL 2026). It's impressive for text content. But modern e-learning needs more: course diagrams, audio narration, and video.

That's where NexaAPI comes in.

What is instructional-agents?

From the PyPI listing and GitHub repo:

  • Based on: ADDIE instructional design model
  • Generates: Syllabus, slides, scripts, assessments
  • Multi-agent: Specialized LLM agents collaborate
  • Published at: EACL 2026 Main Conference
  • Requires: OpenAI API key

It's a solid system for text-based course generation. The gap? No image generation, no audio narration, no video.

The Missing Piece: Multimedia

Real courses need:

  • 📊 Diagrams — visual explanations of concepts
  • 🎙️ Audio narration — text-to-speech for accessibility
  • 🎬 Video — explainer content

NexaAPI fills all three gaps with a single API key.

Python: Add Images to Your Course Agent

# pip install nexaapi instructional-agents
from nexaapi import NexaAPI

client = NexaAPI(api_key='YOUR_API_KEY')
# Get free key at https://nexa-api.com

def generate_course_visual(topic: str, lesson_title: str):
    """Generate an educational diagram for a lesson."""
    prompt = f'Educational diagram explaining {topic}, clean infographic style, suitable for students, white background, labeled'
    response = client.images.generate(
        model='flux-schnell',  # check nexa-api.com for current models
        prompt=prompt,
        width=1024,
        height=768
    )
    image_url = response.data[0].url
    print(f'Course visual for "{lesson_title}": {image_url}')
    return image_url

def generate_audio_narration(text: str, lesson_title: str):
    """Generate TTS narration for course content."""
    response = client.audio.speech(
        model='tts-1',  # check nexa-api.com for TTS models
        input=text,
        voice='alloy'
    )
    print(f'Audio narration for "{lesson_title}" generated')
    return response

# Example usage
lesson = 'photosynthesis in plants'
title = 'Biology 101: Photosynthesis'

visual = generate_course_visual(lesson, title)
audio = generate_audio_narration(
    'Photosynthesis converts sunlight into energy using CO2 and water.',
    title
)
print(f'Cost: ~$0.003 per image — cheapest AI image API available')
Enter fullscreen mode Exit fullscreen mode

JavaScript: Same Thing in Node.js

// npm install nexaapi
import NexaAPI from 'nexaapi';

const client = new NexaAPI({ apiKey: 'YOUR_API_KEY' });

async function generateCourseVisual(topic, lessonTitle) {
  const response = await client.images.generate({
    model: 'flux-schnell',
    prompt: `Educational diagram explaining ${topic}, clean infographic style, white background`,
    width: 1024,
    height: 768
  });
  const imageUrl = response.data[0].url;
  console.log(`Course visual for "${lessonTitle}": ${imageUrl}`);
  return imageUrl;
}

async function generateAudioNarration(text, lessonTitle) {
  const response = await client.audio.speech({
    model: 'tts-1',
    input: text,
    voice: 'alloy'
  });
  console.log(`Audio for "${lessonTitle}" generated`);
  return response;
}

// Run
(async () => {
  const visual = await generateCourseVisual('photosynthesis', 'Biology 101');
  const audio = await generateAudioNarration(
    'Photosynthesis converts sunlight into energy.',
    'Biology 101'
  );
  console.log('Full multimedia course material generated!');
  console.log('Cost: ~$0.003/image — cheapest AI API for edtech');
})();
Enter fullscreen mode Exit fullscreen mode

Why NexaAPI for EdTech?

Feature instructional-agents NexaAPI Add-on
Text course generation
Course diagrams ✅ $0.003/image
Audio narration ✅ TTS API
Video generation ✅ Yes
Free tier Needs OpenAI key ✅ Yes
56+ models

Get Started

👉 Free API key: https://nexa-api.com — no credit card
👉 RapidAPI: https://rapidapi.com/user/nexaquency
👉 Python SDK: https://pypi.org/project/nexaapi/
👉 Node SDK: https://www.npmjs.com/package/nexaapi
👉 instructional-agents: https://pypi.org/project/instructional-agents/


Source: https://pypi.org/project/instructional-agents/ | Fetched: 2026-03-26

Top comments (0)