AI Model Wiki

    Skip to main content
    8 min read
    Lesson 5 of 6

    Multimodal APIs and Beyond Text

    From the course Building with AI APIs

    Modern AI APIs go far beyond text generation. Understanding the full spectrum of capabilities helps you build richer applications.

    Vision / Image Understanding

    Send images to AI models for analysis:

    const response = await openai.chat.completions.create({
      model: "gpt-5",
      messages: [{
        role: "user",
        content: [
          { type: "text", text: "Describe this image in detail" },
          { type: "image_url", image_url: { url: "https://example.com/photo.jpg" } }
        ]
      }]
    });
    

    Use cases: product image analysis, document OCR, chart interpretation, accessibility descriptions, visual QA.

    Image Generation

    Generate images from text descriptions:

    const image = await openai.images.generate({
      model: "dall-e-3",
      prompt: "A minimalist logo for a tech startup called 'Flux'",
      size: "1024x1024",
      quality: "hd"
    });
    const imageUrl = image.data[0].url;
    

    Speech-to-Text (Transcription)

    Convert audio to text with Whisper:

    const transcription = await openai.audio.transcriptions.create({
      model: "whisper-1",
      file: audioFile,
      language: "en"
    });
    

    Use cases: meeting transcription, podcast show notes, voice commands, accessibility.

    Text-to-Speech

    Generate natural-sounding audio from text:

    const audio = await openai.audio.speech.create({
      model: "tts-1-hd",
      voice: "nova",
      input: "Welcome to our application!"
    });
    

    Use cases: audiobook narration, accessibility, voice assistants, language learning.

    Embeddings

    Convert text to numerical vectors for search and similarity:

    const embedding = await openai.embeddings.create({
      model: "text-embedding-3-small",
      input: "How do I reset my password?"
    });
    // Returns a 1536-dimensional vector
    

    Use cases: semantic search, recommendations, clustering, RAG (Retrieval-Augmented Generation).

    Building a RAG System

    RAG combines embeddings with chat completions for knowledge-grounded answers:

    1. Index — Embed your documents and store vectors in a database (pgvector, Pinecone)
    2. Retrieve — When a user asks a question, find the most relevant document chunks
    3. Generate — Pass retrieved context + question to a chat model
    4. Cite — Include source references in the response

    RAG is the standard pattern for building AI systems that answer questions about your specific data.

    Key Takeaways

    • •Vision APIs analyze images for OCR, description, and visual QA
    • •Image, speech-to-text, and text-to-speech APIs expand beyond text
    • •Embeddings enable semantic search, recommendations, and RAG systems
    • •RAG (Retrieval-Augmented Generation) is the standard for knowledge-grounded AI
    • •Combine multiple API types to build rich multimodal applications
    0 of 6 lessons marked complete

    Progress is kept in this browser only.