Memuat
Memuat
Watch every step above performed live, with English narration.
1 plays
Class book
Page 1 / 5
Cover: Claude from Zero to Expert Class #91: The Claude API Without the Headache
Click a page or use ◀ ▶ to turn · swipe on mobile · to enlarge
Want to go deeper?
Join one of our courses or ask us directly on WhatsApp.
Picked from the software, topic, and level of “Claude from Zero to Expert Class #91: The Claude API Without the Headache”.
Other ways we can help with Claude.
Learn with a mentor
Scheduled AI & Machine Learning courses with live guidance and a certificate.

Midjourney Course: Create Stunning AI Images from Text
★ 4.9

DALL-E Course: Creating Professional AI Images from Text
★ 4.9

Stable Diffusion Course: AI Art from Beginner to Professional
★ 4.9
Have it built for you
No time to learn Claude? Our team can do the project for you.

AI Image Creation with Stable Diffusion — Unlimited Custom Visual Production
★ 4.9

AI Image & Video Creation with Leonardo AI — All-in-One Visuals for Business
★ 4.9

AI Image Creation with Midjourney — Cinematic AI Art for Business
★ 4.9
Get notified about new Claude classes
At most one email a week. Unfollow anytime with one click.
The full narration of this video. The current sentence is highlighted while the video plays; click any sentence to jump there.
Hi, and welcome to the API and Your Own Agent session. Starting now, we don't just chat with Claude; we build Claude into tools of our own. In this episode we get to know the Claude API without the headache: what an API is, how it differs from claude.ai, what tokens are, and how to keep your API key secret.
Until now we've used Claude through the claude.ai app or Claude Code. We do the typing, and we read the answers ourselves. API stands for application programming interface. The idea is simple: it's an official doorway that lets a program ask Claude for answers, with nobody typing on a screen. Picture a restaurant. Customers don't walk into the kitchen. Take the Sunset Coffee bot: it receives a customer's question, such as the shop's opening hours. The bot then writes a request and sends it through the API, like a waiter carrying the order slip to the kitchen. In the kitchen, Claude reads that request and writes an answer. The answer goes back to the bot, and the bot passes it on to the customer. It all happens in a few seconds, without Laras or Dimas touching their phones. So what can we build? First, a Q&A bot on Telegram or a website that answers customers' routine questions. Second, an AI step inside an automation, for example in n8n: summarizing reviews or sorting incoming messages. Third, bulk document processing, such as writing hundreds of product descriptions at once. We'll touch on all three in this session. Think about your own business or job. Which questions get answered again and again every day? That's your first candidate for a program that uses Claude.
Now, how is it different from claude.ai? The claude.ai app is used by people, through a chat window. The API is used by programs, such as bots, scripts, or automations. The way you pay is different too. Claude.ai uses a subscription plan, while the API is paid by usage and billed separately. A claude.ai subscription doesn't automatically give you API access. API settings live in the Anthropic developer console, not in your regular chat account settings. So claude.ai is great for everyday work, while the API is for services that run on their own and serve many people. Rates, model names, and usage limits change often. Always check Anthropic's official pricing page and documentation, and don't rely on numbers from videos or social media posts. One term you'll hear a lot is token. A token is a small piece of text. One word can be one token or several tokens. Input tokens are everything we send: the instructions and the question. Output tokens are the answer Claude writes. API costs are calculated from both, and output tokens usually have a different rate from input tokens. We'll cover how to calculate this in the cost episode later.
Let's peek inside one request. Part one, the model: the version of Claude to use. The latest model list is in the official documentation, and we choose based on the task. Part two, the system instructions. These are standing rules, much like the Project instructions we already know: the role, the tone, and the limits. Part three, the user message: the question coming in at that moment, for example from a customer. Part four, the answer length limit. It stops answers from running too long, and it also keeps costs down. We don't need to memorize the format. Raka, the student we've followed since the Claude Code sessions, opens a new folder called bot Sunset Coffee and asks Claude Code to show him a sample request. Claude Code replies that it's only showing an example and hasn't saved any files. That's a good habit: we know exactly what's happening. Here's the example. Look at the four lines: the model, the token limit, the system instructions, and the customer's message. Exactly the four parts we just covered. Claude Code then explains each part in simple words. It also leaves out the model name on purpose, because model names change over time. Raka is asked to pick one from the latest documentation.
Now the most important part of this episode: the API key. The API key is a secret key that proves a request comes from your account. All usage is billed to that account. Create the key in the Anthropic console by following the official documentation, because the steps can change. Rule two: keep the key only in a special file called .env on your own computer. Programs read this file, but it never gets shared. Rule three: never paste the key into any chat, including to Claude or Claude Code. Anyone who sees the key can use it, and the bill goes to your account. Rule four: never upload the key to GitHub, a public Drive, or a WhatsApp group. There are malicious programs that constantly scan the internet for leaked keys. Rule five: set a spending limit in the console, and if you suspect a leak, revoke the key right away and create a new one. Let's practice. Raka asks Claude Code to set up the folder so the key stays safe, and makes it clear that he shouldn't be asked to paste the key into the terminal. Claude Code creates a sample file called .env.example. It only contains the variable name and a hint, not the real key. It also creates a .gitignore file, which lists the files that must never be uploaded. The .env file is on that list. As usual, Claude Code asks for permission before writing files. Raka reads the list of changes first, then chooses Yes. Finally, Claude Code gives a tip: copy the sample file to a .env file, then paste your own key in with an editor. The key never passes through the conversation. Notice the working pattern. Claude Code writes all the code and settings files, but anything secret we still handle ourselves, by hand. This division of roles holds until the end of the class.
Raka puts the key into the .env file himself, then asks for a small test script that sends one question and shows the token count. Claude Code writes a short script, about eighteen lines long. Then it runs the script to check the connection. The answer appears: Sunset Coffee's opening hours, along with the number of input and output tokens. These token numbers are what we'll use later to calculate costs. Claude Code confirms that the script reads the key from the .env file and doesn't print it on screen. This folder is now ready to be our bot's home. If the test script fails, don't panic. Usually the key isn't saved yet, billing in the console isn't set up, or there's a typo. Copy the error message, but first delete anything that looks like a key, then ask Claude Code to explain. Here's the map of our session. Today we got to know the API, tokens, and the API key. Next, Claude Code writes a Telegram Q&A bot for Sunset Coffee's customers. Then we connect Claude to n8n, so Claude becomes one step inside an automation. After that, we calculate token costs and learn how to save. Finally, security: prompt injection and limits on agents. The screens in this video are simulations, so console and terminal menu names may differ slightly from yours.
We've met the Claude API, seen how it differs from claude.ai, learned the four parts of a request, tokens, and five rules for protecting your API key. Raka's project folder is also ready and safe. In the next episode, Claude Code writes the first Telegram Q&A bot for Sunset Coffee, and we test it right from a phone. See you there!
Try these on your own after watching to lock in what you learned.
Type a question or keyword; we find the part of this episode that explains it and jump the video there.
Notes are saved with the current video time and are only visible to you.
Stuck on a step? Ask here; the instructor and other learners can answer.
No questions yet.

Cerdas Inovasi Digital Team
Software developers, BIM & 3D engineers, and AI practitioners
We build software, BIM models, games and AI automations for clients every day, and turn that hands-on work into step-by-step classes: every step is shown on screen and comes with a PDF guide you can keep.
See our clients →