0Pricing
Claude Architect · Lekcja

Rodzina modeli Claude

Wybór odpowiedniego modelu pod kątem kosztu, szybkości i możliwości

Rodzina modeli Claude to bezpłatna lekcja Claude Architect na CoddyKit. To lekcja 1 z 4. Możesz przeczytać całą lekcję poniżej za darmo — a potem ćwiczyć ją interaktywnie w przeglądarce z wbudowanym edytorem kodu i tutorem AI dostępnym 24/7. To część ścieżki edukacyjnej Claude Architect, a Twój postęp synchronizuje się między webem a aplikacją CoddyKit. Kurs Claude Architect zawiera 4 lekcji w sumie.

Części tej lekcji nie zostały jeszcze przetłumaczone i są wyświetlane po angielsku.

Meet the Model Family

Every Claude API request begins with one decision: which model? That single field sets your cost, your latency, and your intelligence ceiling for the whole call.

The current family spans three tiers:

  • Opus — the most capable, for the hardest, long-horizon work.
  • Sonnet — the best balance of speed and intelligence.
  • Haiku — the fastest and cheapest, for simple high-volume tasks.

As a Claude Certified Architect, picking the right tier per workload is a core skill. Let's build the decision framework.

The model field is just a string

You select a model by passing its model ID as a string. The request also keeps no state — the model is stateless, so you send the full message history on every turn.

The exact ID strings matter. A typo (for example claude-sonnet-4.6 instead of claude-sonnet-4-6) returns a 404 not_found_error, not a silent fallback.

import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=1024,
    messages=[{"role": "user", "content": "Hello, Claude"}],
)
print(response.content[0].text)

Opus — top of the family

Claude Opus 4.8 (claude-opus-4-8) is the most capable model. Reach for it when correctness on a hard problem outweighs cost and speed:

  • Large multi-step refactors and overnight coding runs.
  • Deep research and long-horizon agentic loops.
  • Complex reasoning where a cheaper model would degrade quality.

It offers a 1M-token context window at standard pricing and up to 128K output tokens. Pricing: $5 / 1M input, $25 / 1M output.

response = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=64000,
    thinking={"type": "adaptive"},
    output_config={"effort": "high"},
    messages=[{"role": "user", "content": "Refactor this service end to end."}],
)

Sonnet — the balanced workhorse

Claude Sonnet 4.6 (claude-sonnet-4-6) is the best combination of speed and intelligence. It's the default choice for most production traffic:

  • Chat, classification, content generation, extraction.
  • Tool-heavy workflows that need fast turnaround.
  • Anything where Opus would be overkill but Haiku might miss nuance.

It has a 1M-token context window and up to 64K output tokens. Pricing: $3 / 1M input, $15 / 1M output — cheaper than Opus on both ends.

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=8192,
    messages=[{"role": "user", "content": "Classify this support ticket."}],
)

Haiku — fast and cheap at scale

Claude Haiku 4.5 (claude-haiku-4-5) is the fastest and most cost-effective model. Use it for simple, high-volume tasks where latency and price dominate:

  • Lightweight classification and routing.
  • Short summaries and formatting fixes.
  • Sub-agents doing narrow, well-scoped work.

Its context window is 200K tokens (smaller than the 1M of Opus and Sonnet), with up to 64K output tokens. Pricing: $1 / 1M input, $5 / 1M output — the cheapest tier.

response = client.messages.create(
    model="claude-haiku-4-5",
    max_tokens=256,
    messages=[{"role": "user", "content": "Is this email spam? Answer yes or no."}],
)

The three-way tradeoff

Picking a model is always a tradeoff across three axes:

  • Capability — Opus > Sonnet > Haiku for hard reasoning.
  • Speed — Haiku is fastest, Opus is most deliberate.
  • Cost — Haiku ($1/$5) < Sonnet ($3/$15) < Opus ($5/$25) per 1M tokens.

The architect's instinct: start at the cheapest tier that meets the quality bar, then move up only where evals show you need it. Don't reflexively default everything to Opus — you'll burn budget on tasks Sonnet or Haiku handle just as well.

Match the tier to the task

A practical routing heuristic for a multi-stage system:

  • Coordinator / planner doing complex decomposition → Opus.
  • Main worker handling tool calls and synthesis → Sonnet.
  • Narrow sub-agents (classify, grep-and-summarize) → Haiku.

This mirrors how production agents stay affordable: spend Opus-level intelligence only where the decision is hard, and push routine, parallel work down to cheaper models.

Don't switch models mid-conversation

Models are cache-scoped. Prompt caching is a prefix match, and the cache is keyed per model — so switching the model string mid-conversation invalidates the entire cache and you reprocess everything at full price.

The architect-grade pattern: keep one model on the main loop, and if a sub-task needs a cheaper model, spawn a sub-agent for it rather than swapping the model on the live thread.

# Main loop stays on Opus; cheap discovery work goes to a Haiku sub-agent
main = client.messages.create(
    model="claude-opus-4-8",
    max_tokens=16000,
    messages=history,  # cached prefix preserved
)

scout = client.messages.create(
    model="claude-haiku-4-5",  # separate call, separate cache
    max_tokens=1024,
    messages=[{"role": "user", "content": "Summarize these 5 files."}],
)

Control cost with effort, not model swaps

You don't always have to change the model to change cost. On Opus 4.8 and Sonnet 4.6, the effort parameter tunes how much the model thinks and spends, inside output_config:

  • low — terse, fewer tool calls, latency-friendly.
  • high — the default; thorough.
  • max — Opus-tier only, when correctness beats cost.

Pair it with adaptive thinking (thinking={"type": "adaptive"}) and let the model decide how much to reason per request. Note: budget_tokens is removed on these models — use adaptive thinking instead.

response = client.messages.create(
    model="claude-sonnet-4-6",
    max_tokens=8192,
    thinking={"type": "adaptive"},
    output_config={"effort": "low"},  # cut cost without dropping a tier
    messages=[{"role": "user", "content": "Draft a release note."}],
)

Mind the context window and output cap

Capability isn't only intelligence — it's also how much the model can hold and produce:

  • Opus 4.8 / Sonnet 4.6: 1M-token context window.
  • Haiku 4.5: 200K-token context window.

If a workload must reason over a very large codebase or document set in a single call, Haiku's smaller window may rule it out regardless of cost. Also stream any request with large max_tokens (above ~16K) — non-streaming calls risk SDK HTTP timeouts.

with client.messages.stream(
    model="claude-opus-4-8",
    max_tokens=128000,  # large output -> must stream
    messages=[{"role": "user", "content": "Generate the full migration plan."}],
) as stream:
    message = stream.get_final_message()

Batch API: a cost lever, not a model tier

Cost optimization isn't only about model choice. The Message Batches API runs requests at 50% off, within a window of up to 24 hours.

The catch — it's not for blocking or time-sensitive work: there is no latency SLA, and multi-turn tool calling isn't supported. Use it for overnight reports and audits; never for a pre-merge check or anything a user is waiting on. For those, pick a fast model (often Haiku or Sonnet) on the standard API instead.

batch = client.messages.batches.create(
    requests=[
        {"custom_id": "row-1", "params": {
            "model": "claude-haiku-4-5",
            "max_tokens": 256,
            "messages": [{"role": "user", "content": "Classify row 1"}],
        }},
    ],
)

Quick Check: choosing a model

A scenario-style question on matching the model to the constraint.

Recap: choosing across the family

Key takeaways for the exam and for production:

  • Opus 4.8 ($5/$25, 1M context) — hardest reasoning, long-horizon agents; use sparingly.
  • Sonnet 4.6 ($3/$15, 1M context) — the balanced default for most traffic.
  • Haiku 4.5 ($1/$5, 200K context) — fast, cheap, high-volume simple tasks.
  • Start at the cheapest tier that meets the quality bar; move up only where evals demand it.
  • Tune cost with effort and adaptive thinking before swapping tiers.
  • Don't switch models mid-conversation — it invalidates the cache; spawn a cheaper sub-agent instead.
  • Use the Batches API (50% off) for non-blocking jobs only — never for time-sensitive checks.

Często zadawane pytania

Czy lekcja „Rodzina modeli Claude” jest bezpłatna?

Tak — pełny tekst „Rodzina modeli Claude” jest dostępny za darmo tutaj w sieci. Aby ćwiczyć ją interaktywnie (wbudowany edytor kodu i tutor AI dostępny 24/7) i odblokować resztę kursu Claude Architect, przejdź na CoddyKit PRO. Kurs Claude Architect zawiera 4 lekcji w sumie.

Co nauczysz się w „Rodzina modeli Claude”?

Wybór odpowiedniego modelu pod kątem kosztu, szybkości i możliwości Ćwiczysz Claude Architect z praktycznym kodem, który uruchamiasz bezpośrednio w przeglądarce, a tutor AI dostępny 24/7 odpowiada na Twoje pytania podczas pracy nad lekcją.

Czy potrzebuję doświadczenia, aby zacząć Claude Architect?

Nie wymagamy żadnego doświadczenia. Claude Architect w CoddyKit jest strukturyzowany dla początkujących i zaawansowanych użytkowników, więc możesz zacząć tutaj lub od początku i uczyć się w swoim tempie. To lekcja 1 z 4.

Ile czasu zajmuje lekcja „Rodzina modeli Claude”?

Większość lekcji CoddyKit trwa około 5–10 minut. Każda lekcja to mały, interaktywny krok, dzięki czemu robisz systematyczne postępy i zawsze wracasz dokładnie do tego samego miejsca — na webie i w aplikacji.

Czy mogę pisać i uruchamiać kod w tej lekcji Claude Architect?

Tak. Każda lekcja Claude Architect zawiera wbudowany edytor kodu, więc piszesz i uruchamiasz prawdziwy kod bezpośrednio w przeglądarce i od razu otrzymujesz sprzężenie zwrotne od AI — bez konfiguracji na komputerze.

Wszystkie lekcje w tym kursie

  1. Rodzina modeli Claude
  2. Budowa żądania API
  3. Wyjaśnienie przyczyn zatrzymania
  4. Tokeny, okna kontekstu i koszt
← Powrót do Claude Architect