StoryboardAI Engineering

The model call

One web request out, one reply back. Your own server always sits in the middle.

What is a model call?

Using an AI model means sending it a web request. The request says which model to use, carries the text it should read, and sets a cap on how long the reply may be. The reply comes back as text, along with a count of how much was read and written.

The person using your product never talks to the model directly. Their message goes to your server, and your server makes the call. That keeps the secret key off their device, and it gives your code the chance to decide what the model sees and what happens with its reply.

Everything else in AI engineering is something your code does just before or just after this one request.

One model call, from request to reply.Step 1: Your server builds the request. Step 2: It is sent with a secret key. Step 3: The model writes a reply. Step 4: Reply and token count return.1Your server buildsthe request2It is sent with asecret key3The model writes areply4Reply and tokencount return
One model call, from request to reply.

Why does a model call matter?

Every AI product, however elaborate, is built from this one operation. Chat, search, agents and voice assistants are all arrangements of model calls with ordinary code between them. If you understand what goes into one call and what comes out, the rest of AI engineering becomes a question of what to send and what to do with the reply.

How does a model call work?

  1. Your code builds a request: the name of a model, a limit on the length of the reply, and the text to respond to.
  2. The request is sent over the internet to the model provider, with a secret key that proves who is paying.
  3. The model reads the text as tokens and writes a reply, one token after another.
  4. The reply comes back with a count of the tokens read and written, which is what you are billed for.
  5. Your code decides what to do with the reply: show it, check it, or use it to make the next call.

When should you use a model call?

Use it when

  • You need language understood or written: answering, summarising, sorting, extracting, translating
  • The task is hard to describe as fixed rules

Think twice when

  • Plain code can do the job exactly, such as adding numbers or matching a pattern
  • The answer must be identical every time and provably correct

Where does a model call sit in a real system?

The call is made from your own server, never from a customer's phone or browser, because the secret key must stay private. The server sits between the person and the model: it receives the message, adds whatever the model needs to see, makes the call and passes the reply back.

What goes wrong with a model call?

  • Putting the secret key in an app or web page, where anyone can copy it and spend your money.
  • Forgetting the reply limit, so that an answer is cut off in the middle of a sentence.
  • Assuming the model remembers the previous call. It does not.

What does a model call look like in practice?

A shop's server sends a request naming a model, a limit of 300 tokens, and the text "What should I wear for a rainy hike?". About a second later it receives 120 tokens of advice, and a note that 14 tokens were read and 120 written. At typical prices that call cost a fraction of a cent.

Watch it happen

These stories show the model call at work, one step at a time.