Modules/Module 7/Lesson 6
Lesson 6 of 6 ~10 min read

AI APIs Explained

Lesson 7.6 — AI APIs Explained in Plain English

Server racks with glowing lights in a data centre

You have probably encountered the word "API" and had it explained to you as "application programming interface" — which tells you nothing useful. Here is a better explanation. And more importantly, here is how to know whether you have reached the point where using an API directly makes sense for you.


The Waiter Analogy

Imagine you are in a restaurant. You know what you want to eat, and the kitchen knows how to make it. But you cannot walk into the kitchen yourself — the kitchen has rules, equipment, and processes you don't understand, and it cannot have random people wandering through.

The waiter is the intermediary. You tell the waiter what you want in a language you both understand (the menu). The waiter goes to the kitchen, translates your order into kitchen instructions, and brings back what you asked for.

An API is the waiter.

When you use ChatGPT's website, you are using a polished interface that handles the complexity behind the scenes. The underlying AI model (GPT-4) sits in OpenAI's servers — the "kitchen." The API is the system that lets any piece of software communicate directly with that kitchen: send a request, receive a response.

When developers build applications using AI, they are not embedding a copy of ChatGPT into their app. They are connecting their app to the API — sending requests, receiving responses, and displaying the results in their own interface.


Why This Matters for You

If you are:

  • Using no-code tools like Zapier, Voiceflow, or Poe — those tools are calling the API for you behind the scenes. You never see it.
  • Building your own application with code — you will use the API directly.
  • Deciding whether to hire a developer — understanding APIs helps you have an informed conversation about what is needed.

The question of when to use the API directly rather than a no-code tool comes down to three things: control, cost, and complexity.


When You've Outgrown No-Code

No-code tools are the right choice for most beginners and many intermediate builders. But there are clear signs that you need more:

Sign you need the API directlyWhy
You need custom logic that Zapier can't expressAPI + code gives you unlimited logic
You're hitting rate limits or cost ceilings on no-code toolsDirect API is typically cheaper at scale
You need to process thousands of items automaticallyNo-code tools have throughput limits
You want to build a product you own and control completelyNo-code tools can change their terms, pricing, or shut down
You need to handle sensitive data on your own infrastructureSelf-hosting via API keeps data in your control
You want to fine-tune a model on your own dataRequires direct API access

If two or more of these apply to you, it is worth either learning basic coding or working with a developer.


The Main AI APIs

ProviderAPI nameModels availableBest for
OpenAIOpenAI APIGPT-4o, GPT-4o-mini, o1, DALL-E, WhisperGeneral purpose; widest ecosystem
AnthropicClaude APIClaude 3.5 Sonnet, Claude 3 Haiku, Claude 3 OpusLong documents; careful reasoning; safety-focused
GoogleGemini APIGemini 1.5 Pro, Gemini FlashMultimodal; large context window; Google ecosystem
MetaLlama via Replicate, Together AILlama 3, Code LlamaOpen source; self-hosting; cost-effective
MistralMistral APIMistral Large, Mistral 7BEuropean data residency; efficient
Stability AIStable Diffusion APIVarious image generation modelsImage generation; open weights

Pricing: What APIs Actually Cost

API pricing is typically based on tokens — roughly, a token is about three-quarters of a word. You pay for the tokens you send (input) and the tokens you receive (output).

ModelInput costOutput costExample: process 1,000 emails (300 words each)
GPT-4o$2.50 / 1M tokens$10 / 1M tokens~$1.50
GPT-4o-mini$0.15 / 1M tokens$0.60 / 1M tokens~$0.09
Claude 3.5 Sonnet$3 / 1M tokens$15 / 1M tokens~$1.80
Claude 3 Haiku$0.25 / 1M tokens$1.25 / 1M tokens~$0.15
Gemini 1.5 Flash$0.075 / 1M tokens$0.30 / 1M tokens~$0.05

What this means practically: For most personal and small business use cases, API costs are very low — often pennies to a few dollars per month. The economics only become important at significant scale (hundreds of thousands of requests per month).

Free credits are available for new accounts on most platforms ($5–$18 is typical), which is enough to build and test most projects.


How a Simple API Call Works

Here is what happens when a developer makes an API call, stripped of jargon:

  1. Your application sends a message to the API endpoint (a web address)
  2. The message includes: your API key (proves you are allowed to use this), the model you want to use, the messages you are sending
  3. The API authenticates your key, sends your request to the AI model
  4. The model generates a response
  5. The API sends the response back to your application as structured data (JSON)
  6. Your application displays, stores, or processes that response

In Python (the most common language for AI projects), a basic call looks like this:

from openai import OpenAI

client = OpenAI(api_key="your-api-key-here")

response = client.chat.completions.create(
    model="gpt-4o-mini",
    messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Summarise this text in three bullet points: [text]"}
    ]
)

print(response.choices[0].message.content)

This is the whole skeleton of an AI application. Everything else is what you do with the response — display it, save it, pass it to another function.


When to Hire a Developer

If you want to build something that requires direct API use and you don't want to learn coding, the right answer is often to hire a developer. Here is guidance on when that makes sense and what to look for:

Hire a developer when:

  • The thing you want to build is genuinely complex (multiple integrations, custom data handling, user authentication)
  • You need it to be reliable and maintainable over time
  • The commercial value justifies the cost
  • You've already validated the concept with a no-code prototype

What to look for in a developer for AI projects:

  • Comfortable working with at least one major AI API (OpenAI, Anthropic, or Google)
  • Experience with Python (the most common language for AI backend work)
  • Can explain what they're building in plain English
  • Understands prompt engineering and context management (not just API integration)

What to prepare before hiring:

  • A clear written specification of what the tool should do
  • Examples of inputs and expected outputs
  • Your budget and timeline
  • A working prototype (even in a no-code tool) if possible — this dramatically reduces ambiguity

Typical costs: For a simple AI-powered tool (a specific chatbot, an automated processing workflow), expect £1,500–£5,000 for a competent freelancer. More complex applications cost significantly more.

Key takeaway: You do not need to learn to code to use AI well. But understanding what APIs are, what they cost, and when they become necessary helps you make informed decisions about when to build yourself, when to use no-code tools, and when to hire.


Practice Task

If you are curious about APIs, sign up for a free OpenAI account and generate an API key. Do not use it for anything yet — just look at the usage dashboard and the pricing page. Familiarising yourself with the structure of API pricing and the concept of tokens is valuable even if you never write a line of code.


You've finished all the lessons in Module 7. Take the quiz to test your knowledge →