Swipe
SwipeSwipe
Swipe Apps

Paths

Motivation

Information

Reading the Response · Lesson 7 of 9

The Response Isn't Just Text

A free lesson from Swipe AI · Building With AI APIs, level 2 · updated October 2026

By the Swipe team, founded by Colin · how we make lessons

🤖
The answer is in there somewhere — your code just has to know where to look. 🔍

You already know the response that comes back from an API call is structured data, not just plain text. That means the actual answer isn't the whole response — it's sitting inside one specific field of it, alongside other fields like usage information. Your code has to read that specific field to get anything useful out of the response.

Think back to Level 1's example response: it had an output field with the actual generated text, plus a tokens_used field for billing info. Grabbing the entire response object and treating it as 'the answer' would mean displaying billing metadata to a user right along with the actual text — clearly not what you want.

Same response shape as Level 1, viewed as "everything sent back":

response: {
            output: "Photosynthesis converts light into chemical energy.",
            tokens_used: 41,
            finish_reason: "complete"
          }

The answer your code actually wants is just the "output" field — everything else is metadata about the call.
Only one field here is "the answer" — the rest describes the call itself.
Quick check

Why can't your code just treat the entire response object as 'the answer'?

Fill in the blank

A response often includes both the actual generated content and extra ____ like token counts.

True or false

An API response is typically just one long block of plain text with no internal structure.

Keep your streak going in Swipe AI

Swipe through every level of Building With AI APIs on your iPhone — with XP, stars, streaks, a personal advisor and the full track beyond these free levels.

Get the Swipe apps →