# Model vs Model API vs Application

> What a model, a model API and an application are, how one request moves between them, and who owns each part, for your AI interview.

**In short:** The model is the trained network that writes the text. The model API is the hosted service your code calls to use it, billed per token. The application is the product you build around both, with prompts, data, tools and checks.

AI and LLM interview question Q037, LLM fundamentals. Beginner, occasional (our estimate). From Venkat R. Murty's free Interview Kit: https://designervenkat.online/interview/ai/model-vs-model-api-vs-application

## Say it in 30 seconds

The model is the trained network that writes the text. The model API is the hosted service my code calls to use it, billed by the token. The application is what I build around both: the prompt, the data, the tools and the checks. The model only writes text, so the product risk often sits in the application.

## Say it in 2 minutes

Three things get mixed up here. The model is the trained network, a huge set of learned numbers that turns text into a reply. The model API is the hosted service I call to reach it. My code sends a request over the internet, the provider runs the model, and a reply comes back. The provider bills for the tokens that go in and come out.

The application is everything I build around them. That means the instructions, the data the model may read, the tools it may ask to use, the checks in my code, the screen people see, and the logs. By default the API keeps no memory between calls, so the application keeps the chat history and sends all of it each time. Some providers can keep the chat on their side, such as Anthropic's message threads (still in beta) or OpenAI's Responses API, so check the one you use.

A realistic case: an insurer's claims assistant, with made-up numbers. The model summarises a 40-page claim file. The API key lives on the server, and the team watches the weekly bill. The application pulls the file from the claims system, blocks any payout tool, and logs every call.

Switching the model is one line of config, but the prompts and tests were tuned to the old one, so I re-test first. Often the product risk sits in the application, because that is where data and tools meet.

## What are a model, a model API and an application, in plain words?

People mix up three words in interviews, and they are three different things. The model is the trained network that writes the text. The model API is the hosted service you call to use it. The application is the product you build around both.

Anthropic builds the Claude models. You don't install them on your laptop. Your code sends a request to the provider over the internet, the provider's computers run the model, and the reply comes back.

Think of a delivery firm. The engine is the model, the part that does the work. The rental desk that lends you a van and bills you by the mile is the API. Your routes, your driver rules, your cargo checks and the app your customers use are the application. Here is the same idea in an AI product.

- **Model:** The trained network: a huge set of learned numbers, called weights, that turns text into a reply.
- **Model API:** A hosted service. Your code sends text over the internet and gets a reply back.
- **Application:** Your product around the model: prompts, data, tools, checks, screens and logs.
- **Token:** A small piece of text, often part of a word. Providers count tokens and bill for them.

## How do the three layers work together on one request?

One question takes a trip through all three. Read the chart from left to right.

*Diagram, One request, three layers: The person talks to your app. The app sends one request to a model API, which hands it to the model. The model's reply then goes back through your app's checks.*
1. The question reaches your app.
2. The app sends the instructions, the chat so far and the question as one request.
3. The API passes the request to the model, which writes the reply.

1. **The app builds the request:** It joins your instructions, the chat so far and the new question. Outside text is marked as data, not as orders.
2. **The API receives it:** It checks the key and the limits, passes the request to the model, and counts the tokens in and out.
3. **The model writes the reply:** It reads the whole request and writes the answer one token at a time. It can't act on anything by itself.
4. **The app checks and shows it:** Your code checks any tool call the reply asks for (the model asking your code to run a step, such as looking up a claim), keeps a log of the exchange, and only then shows the answer.

Anthropic's guide to building agents calls the basic building block an LLM with retrieval, tools and memory added, and it advises keeping the design simple. The guide's own note says much of its tooling has changed since December 2024.

> "The basic building block of agentic systems is an LLM enhanced with augmentations such as retrieval, tools, and memory." (Anthropic, Building effective agents)
>
> "we recommend finding the simplest solution possible, and only increasing complexity when needed." (Anthropic, Building effective agents)

## Why does the model API forget the last question?

By default the model API keeps no memory between calls. A chatbot seems to remember you, but the application is sending the earlier chat again each time.

> "The Messages API is stateless, which means that you always send the full conversational history to the API." (Anthropic, Messages API)
>
> "While each text generation request is independent and stateless, you can still implement multi-turn conversations by providing additional messages as parameters to your text generation request." (OpenAI, conversation state)

So by default the memory lives in your application. You store the history and send all of it on every call. A longer history means more tokens in on every call, and tokens are what the provider bills.

Here is a small stand-in for a hosted model. The first two calls go through the application, and the third sends one message on its own, the way a careless app might.

```python
# A made-up claims assistant at a mid-size insurer. By default the model API keeps no memory,
# so the app keeps the chat and sends all of it with every call.
def model_api(messages):
    # Stand-in for a hosted model: it only sees what arrives in this request.
    return f"Reply: I can see {len(messages)} message(s) in this request."

history = [{"role": "system", "content": "You help claims staff. Never approve a payout."}]

def ask_app(text):
    history.append({"role": "user", "content": text})
    reply = model_api(history)
    history.append({"role": "assistant", "content": reply})
    return reply

print(ask_app("Claim 4412: water damage in the kitchen, reported 9 Nov."))
print(ask_app("Is the excess taken off before the payout?"))
print(model_api([{"role": "user", "content": "Is the excess taken off before the payout?"}]))
```

Output:

```text
Reply: I can see 2 message(s) in this request.
Reply: I can see 4 message(s) in this request.
Reply: I can see 1 message(s) in this request.
```

The third reply shows the problem. The model sees one message, while the application's history holds five: the system rule and four chat turns. Nothing in the API kept the earlier turns, because the API keeps no memory by default.

## Can one model run in more than one way?

Yes. Meta's page for its open-weight model, Muse Spark Open, says you can serve it yourself, run it on hosted APIs, or fine-tune it. Open weights mean the trained network is shared, so you can run it on hardware you control.

- **Hosted API:** The provider runs the model. Quick to start and billed per token, and your data goes to their service under their terms.
- **Self-hosted:** Your team runs the model on its own servers or cloud. More work to operate, and you decide where the data sits.
- **Fine-tuned:** You train the model further on your own examples. Costs more to build, and you must re-test it after each change.

So choosing a model and choosing how to reach it are two separate decisions. An interviewer wants you to name both.

### How would you build a claims assistant on a model API?

An insurer wants claims staff to get a summary of a claim file, often 20 to 40 pages with photos and notes from the claims officer. Made-up numbers: about 3,000 claims a week. Each layer owns different risks.

- **The model:** Reads the claim text and writes the summary. It can't pay anything out, and the application keeps bank details out of its request.
- **The model API:** The company's key stays on the server, never in the browser. The team sees the weekly token bill and sets a monthly limit.
- **The application:** Pulls the file from the claims system, marks it as data, blocks any payout tool, and logs every call.
- **The team:** Checks a sample of summaries against the file each week, and re-tests the set before any model change goes live.

> **Tip:** In the interview, say which layer each risk sits in. A leaked key is an application and server problem. A wrong summary is a model problem, and you catch it with tests.

## What does the interviewer want to hear?

**A strong answer covers**

- [ ] The model: the trained network that writes the text.
- [ ] The model API: the hosted door you call, billed per token.
- [ ] The application: your prompts, data, tools, checks and logs.
- [ ] By default the API keeps no memory, so your app sends the history again.
- [ ] One model can run hosted, self-hosted or fine-tuned.
- [ ] Often the product risk sits in the application layer.

**Common traps**

- Trap: "The model is the app, so swapping it changes nothing else." Better: The prompts, output format and tests were tuned to the old model. Re-test before you switch.
- Trap: "The API remembers the chat for me." Better: By default the API keeps no memory. Your app keeps the history and sends it again, unless you use a provider feature that keeps the chat for you.
- Trap: "A bigger model fixes the product." Better: A bigger model can help, but often the gap is in the app: missing data, weak checks or no logs.

## Can you spot the problem?

**Spot the problem:** The claims assistant forgets the first question a claims officer asked by the second reply. Which line causes it?

A. reply = model_api(history)
B. history.append({"role": "assistant", "content": reply})
C. reply = model_api([{"role": "user", "content": text}])
D. return reply

**Answer:** C. That line sends only the new question, so the model never sees the earlier turns. The first line is right: the whole history goes in every call, because the API keeps no memory by default.

**Quick check:** You change the model name in the config from one version to the next. What comes first?

A. Switch production straight away, the prompts still work
B. Re-run the claims test set and check the output format
C. Let the claims staff spot-check a few answers by eye, then go live
D. Turn off the logs so the change is not judged

**Answer:** B. A new version can change wording, format and judgement. Your tests catch that before users do, because the prompts and checks were tuned to the old model.

## Can you answer these from memory?

**Flash cards**

- **What is the model?** The trained network, a set of learned numbers, that writes the text.
- **What is a model API?** A hosted service. It takes your request, runs the model and bills the tokens.
- **What is the application?** Your product around the model: prompts, data, tools, checks, screens and logs.
- **Does the API remember earlier calls?** By default, no. Your app sends the full history, unless you use a provider feature that keeps the chat.
- **Can one model run hosted and self-hosted?** Yes. Meta's open-weight model page lists self-hosting, hosted APIs or fine-tuning.
- **Where does product risk often sit?** Often in the application: data access, tool checks and logs. Test the whole system.

## Likely follow-up questions

- Q025 Open-weight vs closed API models: trade-offs? https://designervenkat.online/interview/ai/open-weight-vs-closed-api-models
- Q030 Why are input and output tokens priced differently? https://designervenkat.online/interview/ai/why-are-input-and-output-tokens-priced-differently
- Q031 System vs user vs assistant messages? https://designervenkat.online/interview/ai/system-vs-user-vs-assistant-messages
- Q102 Why do prompts break when you switch models? https://designervenkat.online/interview/ai/why-do-prompts-break-when-you-switch-models
- Q238 How do you keep API keys away from the model? https://designervenkat.online/interview/ai/how-do-you-keep-api-keys-away-from-the-model
- Q336 Hosted API vs self-hosted open weights for an enterprise? https://designervenkat.online/interview/ai/hosted-api-vs-self-hosted-open-weights

## Learn it in depth

- [Model APIs side by side](https://designervenkat.online/learn/ai-engineering/model-apis)
- [Closed vs Open Source Models](https://designervenkat.online/learn/ai-engineering/closed-vs-open-source-models)
