> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gloo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# AI 104: Building with Gloo

> AI 104 is a hands-on course for developers: build a real application on the Gloo AI API, from streaming and conversations to tools, images, cost and production readiness.

## From Ideas to a Working App

In AI 101 you learned what models are and how they work. In AI 102 you learned to write prompts that get good answers. In AI 103 you learned how RAG lets a model answer from your own content.

This course is where you write the code. Each lesson takes one thing a real application needs, explains what it is and why it matters, and gives you a small example you can run against the Gloo AI API. By the end, you'll know how to build an app that streams answers, keeps a conversation going, returns data your code can trust, calls your own functions, understands how coding agents work, handles images, points people to helpful resources, stays within budget and keeps working when something goes wrong.

***

## Who This Course Is For

This course is for developers who have done AI 101 to 103, or who already know the ideas, and want to build on Gloo. You should be comfortable making an HTTP request and reading JSON. The examples use Python with the OpenAI SDK, plus cURL. The [SDKs and Libraries](https://docs.gloo.com/api-guides/sdks-and-libraries.md) guide shows the same setup in Node.js.

***

## Before You Start

You'll need three things:

1. **A Gloo AI account with credit.** The [Developer Quickstart](https://docs.gloo.com/getting-started/quickstart-developers.md) takes you from sign-up to your first request.
2. **An API key.** Create one on the [API Keys page](https://docs.gloo.com/studio/manage-api-credentials.md) in Gloo AI Studio and set it as the `GLOO_API_KEY` environment variable.
3. **The OpenAI SDK.** Gloo's API is OpenAI-compatible, so the official SDK works when you point it at Gloo:

```bash theme={null}
pip install openai
```

```python theme={null}
import os
from openai import OpenAI

client = OpenAI(
    api_key=os.environ["GLOO_API_KEY"],
    base_url="https://platform.ai.gloo.com/ai/v2/direct",
)
```

Most lessons use [Direct Responses](https://docs.gloo.com/api-guides/direct-responses.md) so the examples show the model's own output. Gloo has two main kinds of endpoint: **direct** endpoints add nothing between you and the model and bill the model's rate, while **guarded** endpoints give you guardrails, output moderation and values alignment (`tradition`) at the model's rate plus 6.5%. When a lesson needs Gloo's guardrails, or a feature documented on another endpoint, it says so. [Endpoint Types](https://docs.gloo.com/api-guides/endpoint-types.md) compares them all.

***

## The Lessons

> [card] [Lesson 1: Streaming Responses](https://docs.gloo.com/ai-learning-center/gloo-ai-104/streaming-responses.md)
>
> Show the answer as the model writes it.

> [card] [Lesson 2: Conversations That Remember](https://docs.gloo.com/ai-learning-center/gloo-ai-104/conversations-that-remember.md)
>
> Keep history, stay inside the context window and trim old turns.

> [card] [Lesson 3: Structured Output](https://docs.gloo.com/ai-learning-center/gloo-ai-104/structured-output.md)
>
> Get JSON back and check it before you use it.

> [card] [Lesson 4: Tools and MCP](https://docs.gloo.com/ai-learning-center/gloo-ai-104/tools-and-mcp.md)
>
> Let the model call your functions, and connect your coding assistant to Gloo's docs.

> [card] [Lesson 5: Coding Agents](https://docs.gloo.com/ai-learning-center/gloo-ai-104/coding-agents.md)
>
> How an agent plans, acts and checks its work, and where a person approves.

> [card] [Lesson 6: Images In and Out](https://docs.gloo.com/ai-learning-center/gloo-ai-104/images-in-and-out.md)
>
> Send images to a model and generate new ones.

> [card] [Lesson 7: Recommendations](https://docs.gloo.com/ai-learning-center/gloo-ai-104/recommendations.md)
>
> Suggest relevant books, articles and videos from your content.

> [card] [Lesson 8: Cost and Speed](https://docs.gloo.com/ai-learning-center/gloo-ai-104/cost-and-speed.md)
>
> Token pricing, prompt caching, choosing a model and reasoning effort.

> [card] [Lesson 9: Production-Ready](https://docs.gloo.com/ai-learning-center/gloo-ai-104/production-ready.md)
>
> Rate limits and retries, failover and routing, and model lifecycle.

***

## How Each Lesson Works

Every lesson follows the same pattern:

* **Core Concepts** explain the idea in plain words.
* **Get Started** gives you a small example to run.
* **Good to Know** covers the details that catch people out.
* **Learn more** links to the full guide or reference, so you can go deeper.
* **What's next** points you to the next lesson.

Each lesson also has a **Try it on Gloo** tip, after its key takeaway, that points to the place in the docs where you'll use the idea.

> [!TIP]
>
> **Try it on Gloo:** if you haven't made a request yet, start with the [Developer Quickstart](https://docs.gloo.com/getting-started/quickstart-developers.md), then come back for Lesson 1.

***

## What's next

Start with Lesson 1, where you'll make the answer appear word by word instead of all at once.

> [card] [Lesson 1: Streaming Responses](https://docs.gloo.com/ai-learning-center/gloo-ai-104/streaming-responses.md)
>
> Show the answer as the model writes it.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.