CoursesBuilding AI Applications

Models and the API

The request an application actually sends: messages and roles, the parameters that change the answer, the token budget that sets the bill, and the errors a production client must survive.

Lessons
7
Exercises
40
Minutes
42

Start The Request

  1. 1

    The Request

    After this lesson you can read a chat API request as what it is: a stateless call that carries the whole conversation every time, with three roles that mean different things.

    DebugMultiple choiceTrace
    5 exercises
    5 min
  2. 2

    Parameters That Change the Answer

    After this lesson you can set temperature, max_tokens and the system message for a task on purpose, and read the stop reason to know whether you got a whole answer.

    DebugFill blankMultiple choice
    5 exercises
    5 min
  3. 3

    Tokens, Budget and Cost

    After this lesson you can size a request's token budget, explain why a long conversation costs more every turn, and estimate a feature's bill before it ships.

    Code orderMultiple choiceTrace
    5 exercises
    6 min
  4. 4

    Errors, Rate Limits and Retries

    After this lesson you can tell which API errors to retry, how to back off, and how to make a retry safe when the first attempt may have succeeded.

    DebugMultiple choiceTrace
    5 exercises
    5 min
  5. 5

    Images and Documents as Input

    After this lesson you can send an image or a document to a model, predict what it costs and what it will get wrong, and put the checks between what the model says it sees and anything that acts on it.

    DebugCode orderMultiple choice
    5 exercises
    6 min
  6. 6

    Checkpoint: The RequestCheckpoint

    Roles, parameters, budget and errors in fresh situations.

    Fill blankMultiple choice
    7 exercises
    6 min
  7. 7

    Boss: The First EndpointBoss

    One endpoint from first request to first incident: roles, parameters, budget, truncation, errors and a privacy near-miss.

    DebugMultiple choiceTrace
    8 exercises
    9 min