As soon as someone explains how an AI works inside a product, two letter salads almost always come up: API and SDK. Both sound technical, and both mean something very down-to-earth at their core. Let's take this slowly, with two everyday images you can hold on to.

API, the order counter

The abbreviation API stands for Application Programming Interface, roughly "programming interface" in plain English. That's a term that looks more complicated on paper than it is in everyday use.

Analogy

Picture a restaurant. You don't walk into the kitchen yourself, grab a pot, or go looking for onions. You tell the waiter: "One Pizza Margherita, please." The waiter goes into the kitchen, comes back, and puts the pizza in front of you. You don't need to know how the oven works. You only need to know how to order. That's exactly what an API is: an order counter between you and a system whose inner workings you don't need to worry about.

Concretely, in the AI context: companies like Anthropic, OpenAI, or Google run huge data centers where their models operate. These models are so large that you can't run them on your laptop. Instead, the companies provide an API, an order counter on the internet where you send your request.

For example, you send "Write me a poem about Hamburg" to a particular web address. On the other end, the model runs, responds, and sends the text back to you. You never touched the model itself. You just placed an order.

REST API and JSON. The format of the order

In the vast majority of cases, the AI API works as a so-called REST API. That's a very specific way of sending orders over the internet, following fixed rules, with a fixed address and fixed commands like "fetch this" or "send that".

And the format the order is packaged in is called JSON, pronounced like "Jason". This is basically just a particular way of writing down structured data: keys and values inside curly brackets. You don't need to memorize the exact syntax; the important image is just this: JSON is the order slip the request is written on.

Example

A JSON order slip might roughly look like this: "Model: Claude. Question: Write me a poem about Hamburg. Maximum length: 200 words." You send that to the API, and you get a JSON reply slip back with the poem on it.

The API key, your ID card

So the API knows who's ordering, you need an API key. That's a long, secret string of characters you get when you sign up with the provider. You send this key along with every order.

Careful

Treat your API key like a credit card number. If it falls into the wrong hands, someone can run up AI requests on your bill, and that can get expensive. Never upload it to public code repositories, never post it in chats, never leave it visible in screenshots.

What happens during an API call?
From your code to the AI's answer and back, in four steps.
1
Your code
You build a request: prompt + API key.
2
API server
Receives the request, checks the key.
3
AI model
Generates the answer token by token.
4
Answer comes back
Your code receives JSON with the text.
An SDK turns this exact process into a single line of code. You write client.messages.create(...), and the SDK handles all four steps.

SDK, the toolbox

Now for the second term. SDK stands for Software Development Kit. Again, a word that sounds scarier than it needs to be.

Analogy

Imagine you want to hang up a shelf. You could get some iron, fire up a forge, and cast your own screws. Or you go to the hardware store and buy a ready-made toolbox with screws, wall plugs, and a power drill. The SDK is that ready-made toolbox: pre-built building blocks that let you get started right away instead of building everything by hand.

Concretely: if you want to write a program in Python or JavaScript that talks to the Anthropic AI, you could in theory painstakingly assemble a JSON order slip every single time, send it to the API address, receive the response, unpack the JSON again, and catch errors. That's tedious.

Instead, you install the Anthropic SDK, a ready-made library for your programming language. Then you simply write client.messages.create(...), and the SDK takes care of all the order-slip busywork in the background.

What does that look like?

Here's a tiny example in Python. Don't worry, you don't need to understand it, just take a look:

from anthropic import Anthropic

client = Anthropic(api_key="your-key-here")

answer = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=200,
    messages=[{"role": "user", "content": "Write a poem about Hamburg."}]
)

print(answer.content[0].text)

Five lines of proper code, and you have a finished AI answer. Without the SDK, that would easily be 30 lines full of connection code, JSON fiddling, and error handling.

API vs. SDK, side by side

API

  • The order counter itself, a web address on the internet.
  • Language-neutral. You can order from any programming language (Go, Rust, PHP, even from the command line).
  • You have to assemble the order slip (JSON) yourself.
  • Stays stable. Every SDK is built on top of it.
  • Good if your language doesn't have an official library.

SDK

  • The toolbox for a specific language (e.g. Python or JavaScript).
  • Wraps the API calls in convenient functions.
  • You write short, readable code.
  • Catches standard errors automatically.
  • Good for 95% of all cases; in Python or JS, just always use the SDK.

So which one do I use?

The rule of thumb is pleasantly short:

Key takeaway

If there's an official SDK for your programming language, use the SDK. Full stop. You save time, your code gets cleaner, and you don't have to fuss with JSON details. Only if you're working in a language for which no SDK exists (or you can't install the SDK for some reason) do you reach for the API directly.

In practice, that means: Python and JavaScript developers use the SDK almost every time. Anyone working in a more exotic language like Rust, Elixir, or Crystal often builds their own small API wrapper. And if you just want to quickly test something from the terminal, you use a tool called curl to send an order slip straight to the API.

The SDK is the friendly shell. The API is the actual counter. Both talk to the same model.

What the API can do

The AI API isn't just "question in, answer out". Through the same interface you can also:

All of this works both directly via the API and via the SDK, it's just that the SDK makes it more pleasant.

Example

A German online shop wants to build a chatbot that answers customer questions. The developers install the Anthropic SDK in their existing Python web application. With a few lines of code, every customer question goes to the AI model via the API and comes back with a friendly answer. The model runs in Anthropic's data center. The shop doesn't see any of that and doesn't need to worry about it. That's the whole magic, right there.

And the costs?

One point many beginners overlook: using the API costs money. You pay per token, meaning per small chunk of text that goes in and out. A few cents per thousand words, depending on the model. Barely noticeable for a single hobby script, but a real cost item for a production application with thousands of users.

Which is why: think first, then order. Are you really sending necessary context? Do you need the full 200,000-word model, or is a smaller one enough? Questions like these suddenly become relevant.

In three sentences

What you now know

  • An API is an order counter on the internet: you send a request, get the AI's answer back, without running the model yourself.
  • An SDK is a ready-made toolbox for a specific programming language that packages API orders for you conveniently.
  • If there's an SDK for your language: use the SDK. Otherwise talk to the API directly. Treat the API key like a password.