0Pricing
Claude Architect · Lesson

Tokens, Context Windows & Cost

Why full history is sent every turn and what it costs.

Claude Has No Memory

Here is the most important idea in this lesson: the Claude API keeps NO state between turns.

The model does not remember your last message. Each API call starts fresh. So how do chatbots seem to remember?

You send the full conversation history in every single request. The messages field carries the whole back-and-forth, every time.

What a Request Carries

A Claude API request has a few key fields:

  • model — which Claude model to use
  • max_tokens — the cap on the reply length
  • system — the system prompt
  • messages — the FULL history every turn
  • tools / tool_choice — optional tool config

Notice messages grows over time. Turn 1 sends 1 message. Turn 10 sends all 19 prior messages plus the new one.

resp = client.messages.create(
    model="claude-sonnet-4-5",
    max_tokens=1024,
    system="You are a support agent.",
    messages=[
        {"role": "user", "content": "My order is late."},
        {"role": "assistant", "content": "I can help. What is your order ID?"},
        {"role": "user", "content": "It's #4821."},
    ],
)

All lessons in this course

  1. The Claude Model Family
  2. Anatomy of an API Request
  3. Stop Reasons Explained
  4. Tokens, Context Windows & Cost
← Back to Claude Architect