02.9 Model Landscape
There are hundreds of LLMs you could build on, from a dozen serious providers, reachable in at least four different ways, at prices that differ by a factor of a thousand. New models ship every week and old ones are switched off on a schedule. This lesson gives you a map of that landscape and, more importantly, a durable way of reading it: how providers organize their models into families and tiers, what separates closed from open-weight models, which capabilities to compare, how to reach a model, how pricing really works, how to read model cards and benchmarks without being fooled, how versions are retired, what happens to your data, and a practical framework for choosing a model and a fallback. The concepts will stay true for years. The specific models will not, so every dated fact sits in a clearly marked "as of October 2026" or "as of November 2026" table or passage (the dates show when each fact was last checked), with instructions for checking the current value yourself.
What you'll learn
- How to think about the landscape along three axes: who makes a model, how you reach it, and what it can do
- The difference between closed (proprietary) and open-weight models, and what "open" does and doesn't mean
- How providers name models and organize them into families, generations and tiers, and how tiers trade quality against speed and cost
- The current (as of November 2026) model families from OpenAI, Anthropic, Google, xAI, Mistral, Meta and others, and the leading open-weight families: Qwen, DeepSeek, Gemma, gpt-oss, Llama/Muse, Kimi, GLM, MiniMax, Nemotron and more
- Open-weight licences and what to check before shipping a product on one
- The capability checklist: modalities, context window, max output, reasoning, tool use, structured output, multilingual quality, speed and knowledge cutoff
- Every way to access a model: direct provider APIs, cloud platforms (AWS Bedrock, Google's Gemini Enterprise Agent Platform, Microsoft Foundry), OpenRouter as a unified gateway, and self-hosting with Ollama, llama.cpp and vLLM
- How LLM pricing works: per million tokens, input vs output vs cached input, reasoning tokens, batch and priority tiers, long-context and regional surcharges, and image/audio pricing
- How to read pricing pages, model cards and system cards
- What the major benchmarks measure, why their numbers mislead, how leaderboards work, and why your own evaluations matter most
- Versioning and lifecycle: aliases vs snapshots, deprecation schedules and pinning in production
- Data privacy and compliance at overview level: training use, retention, zero data retention, residency, and marking AI-generated content
- A practical decision framework for choosing a model, a cheat sheet by use case, and a preview of model routing
What you don't need
- Any API keys. Every runnable sample in this lesson uses OpenRouter's public model catalogue, the Hugging Face Hub, or a model on your own laptop. Provider samples that need keys are included for reference and clearly labelled.
- To memorize model names. They'll change. Learn the patterns and the questions, and look the names up when you need them.
Setup
The runnable samples need Python 3.11+ and two small libraries:
uv add httpx huggingface_hub # or: pip install httpx huggingface_hubFirst time? Create a project with uv init llm-basics && cd llm-basics, then run scripts with uv run python file.py.
For the optional provider samples (they need API keys, which are covered in Module 03):
uv add openai anthropic google-genai python-dotenv
# or, without uv: pip install openai anthropic google-genai python-dotenvThe provider samples were checked against openai 3.x, anthropic 2.x and google-genai 2.x as of November 2026 (Module 03 gives the exact releases). An unversioned install gives you the newest release, and google-genai 3.x changes its default Gemini API version and HTTP library (03.1, 4.5), so if a sample does not match, check the SDK's changelog.
Put any keys you have in a .env file as OPENAI_API_KEY, ANTHROPIC_API_KEY, and optionally GEMINI_API_KEY and OPENROUTER_API_KEY. Never commit that file.
For the optional local-model sample in 5.7, install Ollama and run ollama pull qwen2.5:0.5b (about 400 MB).
What you must be able to do after this lesson#
- Compare closed-model and open-weight options on cost, control and privacy
- Compare models on the capabilities that matter for a task
- Read a model card and a benchmark critically
- Compare prices across providers
- Choose a model for a task and justify the choice
Why this matters for an AI engineer#
Choosing a model is one of the highest-leverage decisions you make on any AI feature. It sets your quality ceiling, your latency floor, your unit economics, your data-protection posture and how often you'll be forced to migrate. You'll constantly hear statements like these:
| You'll hear... | You'll understand it after... |
|---|---|
| "Just use the best model." / "Which one is best?" | Part 1: How to think about the landscape |
| "Can we use an open-source model instead?" | 1.2 Closed vs open-weight models |
| "Haiku is the cheap one, Opus is the smart one." | 1.3 Families, generations and tiers |
| "What's the current lineup from OpenAI / Google / Anthropic?" | Part 2: Closed-model providers |
| "Qwen and DeepSeek are as good as the closed models now." | Part 3: Open-weight model families |
| "Legal needs to review the model licence." | 3.3 Open-weight licences |
| "Does it take audio? Can it return JSON? Does it support tools?" | Part 4: Capabilities to compare |
| "We're an AWS shop, so we'll use Bedrock." | 5.3 Cloud platforms |
| "Just go through OpenRouter and you get every model." | 5.4 OpenRouter: a unified gateway |
| "Let's run it ourselves on our own GPUs." | 5.7 Self-hosting open weights |
| "It's $2 per million tokens." (Is that cheap?) | Part 6: Pricing |
| "It scores 90% on SWE-bench and tops the leaderboard." | Part 7: Model cards, system cards and benchmarks |
| "Our app broke because the model was retired." | Part 8: Versioning and lifecycle |
| "Does the provider train on our customers' data?" | Part 9: Data privacy and compliance |
| "Which model should we use for this feature?" | Part 10: Choosing a model |
Part 1: How to think about the landscape#
1.1 Three axes: who makes it, how you reach it, what it can do#
It's tempting to picture the model landscape as a single ranked list with "the best model" at the top. That picture is wrong, and it leads to bad decisions. A more useful picture has three independent axes:
flowchart LR
subgraph who ["1. Who makes it"]
C["Closed labs<br/>OpenAI, Anthropic, Google, xAI..."]
O["Open-weight labs<br/>Qwen, DeepSeek, Meta, Mistral, Google Gemma..."]
end
subgraph how ["2. How you reach it"]
A1["Provider API"]
A2["Cloud platform<br/>(Bedrock, Agent Platform, Foundry)"]
A3["Gateway<br/>(OpenRouter)"]
A4["Self-host<br/>(Ollama, vLLM, llama.cpp)"]
end
subgraph what ["3. What it can do"]
W["Tier, modalities, context,<br/>reasoning, tools, speed, price"]
end
C --> A1 & A2 & A3
O --> A1 & A2 & A3 & A4
A1 & A2 & A3 & A4 --> W- Who makes it. A small number of labs train frontier models. Some keep the weights secret and sell access (closed or proprietary models). Others publish the weights for anyone to download (open-weight models). This determines what you're allowed to do with the model and who you depend on.
- How you reach it. The same model can often be reached in several ways: the maker's own API, a cloud platform you already use, a gateway that fronts many providers, or (for open weights) your own hardware. The route determines your bill, your data-processing terms, which features you get and how reliable the service is. Closed models can't be self-hosted, which is why the arrow is missing in the diagram.
- What it can do. Within any family there are bigger and smaller models (tiers), and each model has a specific set of capabilities: which inputs and outputs it handles, how much text it can read, whether it reasons, whether it can call tools, how fast it is and what it costs.
"Which model is best?" has no answer until you add "...for this task, under these constraints". A model that wins on hard coding benchmarks can be the wrong choice for a high-volume classifier where a model 40 times cheaper is just as accurate. A model with the best quality may be unusable because your data can't leave the EU, or because its licence forbids your use case.
1.2 Closed vs open-weight models#
Lesson 01, section 4.7 explained what's inside a downloadable model: weights, a config, tokenizer files and a model card. Whether you can download those files is the single biggest divide in the landscape:
| Closed / proprietary | Open-weight | |
|---|---|---|
| What you get | API access only. The weights never leave the provider. | The weight files, to download and run anywhere the licence allows |
| Examples (October 2026) | GPT-6, Claude, Gemini, Grok | Qwen, DeepSeek, Gemma, gpt-oss, Llama, Kimi, GLM, Mistral Small |
| Who runs it | The provider (or a cloud platform they license it to) | You, or any inference host you choose |
| Quality | Usually the frontier for the hardest tasks | Close behind, sometimes level on specific tasks; the gap has varied between months and about a year |
| Cost model | Pay per token | Pay per token to a host, or pay for GPUs and operations yourself |
| Data control | Your data goes to the provider, under their terms | Can stay entirely on your own infrastructure |
| Customization | Prompting; some providers offer fine-tuning on selected models | Full fine-tuning, quantization, distillation, any modification the licence allows |
| Lifecycle | The provider retires it on their schedule | Nobody can take a downloaded model away from you |
| Ops burden | None | Significant if you self-host (GPUs, scaling, monitoring, security) |
| Licence | Terms of service | A licence file, ranging from fully permissive to restrictive (3.3) |
Three terms that get confused:
- Open weights: the trained parameters are published. This is what almost every "open" LLM actually is.
- Open source in the strict sense: the Open Source Initiative's Open Source AI Definition (published in 2024) requires not only the weights but also enough information about the training data, and the full training code, for someone skilled to build a substantially equivalent system. Very few large models meet it, because labs rarely publish their training data.
- Source-available / custom licence: the weights are downloadable, but the licence restricts use (for example by company size, revenue or field of use). Many people still call these "open". Read the licence (3.3).
1.3 Families, generations and tiers#
Every major provider organizes its models the same way, even though the names look nothing alike:
| Layer | What it means | Examples |
|---|---|---|
| Family | The product line | GPT, Claude, Gemini, Grok, Qwen, Llama |
| Generation / version | A new round of training, usually with better capability per dollar | GPT-5 → GPT-6, Claude 4.x → Claude 5.x, Gemini 3.x → Gemini 4 |
| Tier | Size or capability level within a generation | Claude Haiku / Sonnet / Opus / Fable; Gemini Flash-Lite / Flash / Pro-class |
| Variant | A specialized flavour of a model | -mini, -codex, -image, -live, -tts, -Instruct, -Thinking |
| Snapshot | One frozen, versioned release with its own ID and retirement date | claude-sonnet-4-5-20250929, canonical_slug: anthropic/claude-sonnet-5.5-20260928 |
Tiers: the core trade-off
Within a generation, providers almost always sell three to four tiers. Larger tiers are smarter but slower and more expensive. When a provider sells four, two of them usually sit in the middle (an "upper-mid" tier such as Claude Opus 5.5 or GPT-6.1 Sol, and a mid tier such as Claude Sonnet 5.5 or GPT-6.1 Terra), as the snapshot in 2.5 shows:
| Tier | Typical names | Good at | Trade-off |
|---|---|---|---|
| Frontier / flagship | Opus, Fable, Astra, Carbon, Argon, Pro, Max | The hardest reasoning, long-horizon agents, complex coding, subtle writing | Highest price, slowest, sometimes lower rate limits |
| Mid / workhorse | Sonnet, Sol, Terra, Flash | Most production workloads: chat, RAG, coding assistants, agents | The usual sweet spot of quality per dollar |
| Small / fast | Haiku, Luna, Flash-Lite, Nano, Mini | High-volume, latency-sensitive work: classification, extraction, routing, autocomplete | Weaker on multi-step reasoning and ambiguous instructions |
The price gap between tiers is large. As of November 2026, OpenAI's smallest current model costs $0.10 per million input tokens and its largest $10, a 100× difference, and Anthropic's lineup spans $0.10 to $8 (80×) (Part 2). Speed differs too: smaller models generate tokens faster and usually start answering sooner. On easy tasks the quality difference can be zero. On hard tasks it can be the difference between working and not working.
1.4 Specialized models#
Not every model is a general chat model. Providers also sell models tuned or built for one job, and an AI product often combines several:
| Kind | What it does | Examples (October 2026) | Covered in |
|---|---|---|---|
| Reasoning models | Think before answering (most flagships now do this by default) | Nearly every current flagship; see lesson 08 | Lesson 08 |
| Coding models | Tuned for code, terminals and repositories | OpenAI's -codex variants, Mistral's Devstral and Codestral, Qwen3-Coder |
Module 08A |
| Embedding models | Turn text (or images) into vectors for search | gemini-embedding-2, OpenAI and Cohere embedding models |
Lesson 03, Module 06 |
| Rerankers | Re-order search results by relevance | Cohere Rerank | Module 07 |
| Image generation / editing | Text (and images) in, images out | GPT-Image-2.5 (gpt-image-2.5-sunburst, gpt-image-2.5-flare), Gemini "Nano Banana" image models, Grok Imagine |
Module 09 |
| Speech-to-text / text-to-speech | Transcription and voice synthesis | gpt-transcribe, gemini-3.5-transcribe, gemini-3.8-flash-tts, Mistral Voxtral |
Module 09 |
| Realtime / live voice | Low-latency, speech-to-speech conversation | gpt-realtime-2.1, gpt-live-1, gemini-3.8-live |
Module 09 |
| Video and music generation | Generate video or audio clips | gemini-omni-1.1-flash, Lyria, Grok Imagine video |
Module 09 |
| Safety / moderation classifiers | Flag harmful content or prompt attacks | gpt-oss-safeguard, Llama Guard 4, Nemotron content safety, Mistral Moderation |
Module 12 |
| OCR / document models | Extract text and structure from scans and PDFs | Mistral OCR | Module 05 |
| Restricted-access models | Capability-gated models for vetted organizations | Anthropic's Claude Mythos models and OpenAI's GPT-5.6 Cyber, offered through verification programmes; Google announced Gemini 4 Carbon on 28 October 2026 for a subset of cyber defenders first, widening gradually to trusted partners through its Fairwind Program (Google's announcement post), and its Gemini API changelog says gemini-4-carbon reached general availability on 10 November 2026, two weeks later (2.3). Gated first, then general availability, is the usual path |
— |
This lesson focuses on general-purpose text models, the core of most applications. The specialized ones follow the same landscape logic: tiers, pricing per unit, lifecycles and the need to evaluate on your own data.
1.5 The landscape moves fast: separate durable from dated#
To give a sense of pace: in the twelve months before this lesson was written, Anthropic released (by its own model list) Claude Opus 4.5, 4.6, 4.7 and 4.8, Sonnet 4.6, 5 and 5.5, Opus 5 and 5.5, Fable 5, 5.1 and 5.2, and Haiku 5.5. OpenAI went from GPT-5.1 through 5.2, 5.4, 5.5 and 5.6 to the GPT-6 series. Google went from Gemini 3 (November 2025) through 3.1, 3.5, 3.6, 3.7 and 3.8 to Gemini 4. Open-weight labs moved just as quickly.
So this lesson separates two kinds of knowledge:
| Durable (learn it) | Dated (look it up) |
|---|---|
| Families, tiers and the quality/speed/cost trade-off | Which model is in which tier today |
| What each capability means and how to check it | Each model's exact context window and features |
| How pricing is structured and how to model cost | Today's prices |
| How licences, lifecycles and data policies work | Today's licence terms, retirement dates and policies |
| How to read benchmarks and run your own evals | Today's leaderboard |
| The decision framework | Today's recommended picks |
How to keep up without drowning:
- Bookmark each provider's models page, pricing page, deprecations page and changelog (links in Further resources).
- Use machine-readable catalogues instead of blog posts: each provider's Models API (4.10) and OpenRouter's catalogue (4.9).
- Re-run your own evaluation suite when a candidate model ships, rather than reacting to launch-day claims (7.6).
- Don't chase every release. Switching models has a cost (re-testing, prompt tweaks, regressions). A good cadence for most teams is a scheduled review (say, quarterly) plus an unscheduled one when a deprecation notice arrives.
Part 2: Closed-model providers (as of November 2026)#
Reference
2.1 OpenAI#
OpenAI's 2026 lineup uses codenames for its tiers. The current general-purpose models, per OpenAI's models page:
| Model | API ID | OpenAI's description | Context | Max output | Knowledge cutoff | Input / cached / output price | Reasoning levels |
|---|---|---|---|---|---|---|---|
| GPT-6 Astra | gpt-6-astra |
"Our most capable model for the most demanding work." | 1.05M | 128K | 30 Apr 2026 | $10 / $1 / $50 | low → max (always reasons) |
| GPT-6.1 Sol | gpt-6.1-sol |
"Near-Astra performance for complex work at a lower cost." | 1.05M | 128K | 30 Apr 2026 | $2 / $0.10 / $10 | low → max (always reasons) |
| GPT-6.1 Terra | gpt-6.1-terra |
"A fast, efficient model for visual reasoning, precise computer use, and clear, natural writing." | 1.05M | 128K | 1 Jun 2026 | $1 / $0.05 / $5 | none → max |
| GPT-6 Luna | gpt-6-luna |
"Our most efficient model for focused, high-volume tasks." | 1.05M | 128K | 18 May 2026 | $0.10 / $0.01 / $0.50 | none → max |
Notes:
- All four accept text and image input and produce text output, and support function calling, structured outputs, web search, file search and computer use.
- "1.05M context" includes the output. GPT-6 Luna's model page, for example, lists a maximum input of 922,000 tokens.
- Prompts over 272K input tokens are billed at higher long-context rates (6.6).
- Older GPT-5.x and GPT-4.x models are still listed but many are deprecated, with shutdowns scheduled into 2027 (8.2).
- OpenAI also sells specialized models: GPT-Image-2.5 (image generation), GPT-Realtime-2.1 and GPT-Live 1 (voice), GPT-Transcribe (speech-to-text), and restricted-access models such as GPT-5.6 Cyber for vetted security work.
- Open weights: OpenAI's
gpt-oss-120bandgpt-oss-20b(released August 2025, Apache 2.0) are covered in Part 3.
2.2 Anthropic#
Anthropic's Claude family has four current tiers. Note that Fable sits above Opus. From Anthropic's models overview:
| Model | API ID | Anthropic's description | Relative latency | Input / output price | Thinking | Default effort |
|---|---|---|---|---|---|---|
| Claude Fable 5.2 | claude-fable-5-2 |
"For demanding reasoning and long-horizon agentic work" | Moderate | $8 / $40 | Adaptive, always on | high |
| Claude Opus 5.5 | claude-opus-5-5 |
"For long-running agentic coding and knowledge work" | Moderate | $4 / $20 | Adaptive, always on | medium |
| Claude Sonnet 5.5 | claude-sonnet-5-5 |
"The best combination of speed and intelligence" | Fast | $2 / $10 | Adaptive; can't be disabled, but up-front thinking can be skipped with between_tools at effort high or below (lesson 08, 3.2) |
high |
| Claude Haiku 5.5 | claude-haiku-5-5 |
"For high-volume, latency-sensitive tasks such as classification, extraction, and routing" | Fastest | From $0.10 / from $0.50 | Adaptive; can be disabled at effort high or below |
medium |
Shared by all four: a 1M-token context window, 128K max output (up to 300K through the Batch API with a beta header, on Opus 5.5, Sonnet 5.5 and Haiku 5.5), text and image input (including PDFs), text output, tool use and structured outputs, and a reliable knowledge cutoff of June 2026. Anthropic's own advice: "start with Claude Opus 5.5 for most workloads", and move to Fable 5.2 when evaluations at higher effort still fall short.
Notes:
- Haiku 5.5's "from" price: prompts over 100,000 tokens are billed at higher rates ($0.50 / $2.50). The other current models bill the full 1M context at the standard rate (6.6).
- Claude Fable 5.2 was released on 9 November 2026 and replaces Fable 5.1 ($10 / $50), which Anthropic's model page now marks "Active (legacy)": still available, with retirement not sooner than 1 September 2027 (checked 11 November 2026). Fable 5.2 is cheaper, and Anthropic lists its comparative latency as Moderate. Other lessons in this path that name
claude-fable-5-1still run; useclaude-fable-5-2for new work. - Cache reads are cheaper than the usual 10% of the input price on the newest models: 5% on Opus 5.5 and Sonnet 5.5, 2.5% on Fable 5.2 and 5.1 (6.3).
- Claude Mythos 5.2 (same specifications and price as Fable 5.2; Mythos 5.1 is the previous version) is a limited-availability model offered only to organizations verified through Anthropic's programmes (such as its Cyber Verification Program). This "restricted tier above the public flagship" pattern is spreading: see the restricted-access row in 1.4.
- Anthropic's models are also offered on AWS (Amazon Bedrock and the Anthropic-operated Claude Platform on AWS), Google Cloud and Microsoft Foundry (5.3).
- Anthropic has no open-weight models.
2.3 Google#
Google's Gemini family is natively multimodal: the general models accept text, images, video, audio and PDFs in a single request.
| Model | API ID | Role | Context | Max output | Input / output price | Free tier? |
|---|---|---|---|---|---|---|
| Gemini 4 Carbon | gemini-4-carbon |
Google's strongest reasoning model; generally available since 10 Nov 2026 | 1M (as listed) | 65K by default, up to 1M as listed (check the model page for non-streaming limits) | $2 / $10 until 30 Nov 2026, then $4 / $20 | No |
| Gemini 4 Argon | gemini-4-argon |
Efficient frontier reasoning model (Google: faster and lower token spend per turn than Carbon) | 1,048,576 (input + output) | 65,536 per request by default; up to the full window with long decode (lesson 07, 2.3) | $2 / $10 until 30 Nov 2026, then $4 / $20 | No |
| Gemini 3.8 Flash | gemini-3.8-flash |
Fast workhorse for agentic and long-horizon work | 1,048,576 | 65,536 | $0.75 / $3.75 until 31 Dec 2026, then $1.50 / $7.50 | Yes |
| Gemini 3.5 Flash-Lite | gemini-3.5-flash-lite |
Cheapest general model | 1,048,576 | 65,536 | $0.30 / $2.50 | Yes |
Notes:
- Output prices include thinking tokens. Thinking is controlled by levels (
low,medium,high; 3.6 Flash and 3.5 Flash-Lite also acceptminimal, which returns an error on 3.8 Flash and Argon) (lesson 08, 3.3). - Notice the dated introductory prices: Carbon, Argon and 3.8 Flash have all announced price increases. This is a live example of why prices must be parameters, never constants (6.8).
- Google's API models page doesn't list knowledge cutoffs, but the Google DeepMind model cards do (Gemini 3.8 Flash: March 2026, with some domains only to January 2025). Check the model card, or test with questions about recent events if it matters to you (4.8).
- Other current Gemini models include Gemini 3.6 Flash, 3.1 Flash-Lite and Gemini 3.1 Pro (
gemini-3.1-pro-preview, still a preview), live-voice models (gemini-3.8-live), TTS and transcription models, image models (gemini-nano-banana-2.1,gemini-3.1-flash-image), the multimodalgemini-embedding-2, Lyria music models, and agent products such as Deep Research. Gemini 4 Carbon (gemini-4-carbon, the first row of the table) is the stronger sibling of Argon and has the same introductory price. Google's launch post (28 October 2026) said access would start with a subset of cyber defenders, widening to trusted partners through its Fairwind Program, with no date for developers generally. The Gemini API changelog entry of 10 November 2026 then says Carbon reached general availability, with introductory pricing through 30 November 2026, and Google's models and pricing pages list it with no access restriction and no free tier (checked 11 November 2026). Google's pages don't say whether every account sees it yet, so list the models your key can use (4.10) or send one request before you plan around it. - Google's model docs label each model stable, preview, latest or experimental (8.1).
- Open weights: Google's Gemma family is covered in Part 3.
2.4 Other providers worth knowing#
| Provider | Current models (October 2026) | Why you might care |
|---|---|---|
| xAI | Grok 4.7 (500K context, $2 / $6, knowledge cutoff May 2026), Grok 4.3 (1M context, $1.25 / $2.50), Grok 4.20 reasoning and non-reasoning variants, plus Grok Imagine image/video and Grok Voice | Competitive pricing on output tokens, long context. Prompts at or above 200K tokens cost double. Also on Bedrock and Google Cloud |
| Mistral AI | Mistral Medium 3.5 (multimodal, agentic and coding), Mistral Large 4 (very large mixture-of-experts; API preview 6 October 2026, open weights 29 October 2026), Mistral Small 4 and Ministral 3 (open weights), Devstral 2 (open weights; Mistral's model overview marks the hosted API model deprecated and retired from 31 July 2026, with Medium 3.5 as the replacement) and Codestral (code), Voxtral (audio), Mistral OCR | A France-based provider that mixes closed and open-weight models; strong document/OCR and audio offerings |
| Meta | Muse Wonder and Muse Spark 1.3 (closed API models, per press coverage), Muse Spark Open (open weights, 15 October 2026), plus the older open Llama 4 Scout and Maverick (2025) | The Muse family succeeds Llama. Meta now ships both closed and open models |
| Amazon | Nova 2 Lite, Nova Pro / Lite / Micro, Nova 2.5 Sonic (voice), Nova Canvas and Reel (image/video) on Bedrock; Nova Premier is still listed by some gateways but not in Bedrock's current model list | First-party models on AWS Bedrock |
| Cohere | Command A Plus, Command A, Embed v5 (Embed v4 is still listed), Rerank v5 (older Rerank 3.5 is still listed) | Enterprise focus: RAG, multilingual, embeddings and reranking. Like Mistral and Meta, it mixes closed and open: Command A's weights are published under a non-commercial licence (CC BY-NC 4.0) |
| Alibaba (Qwen) | Max, Plus and Flash tiers through Alibaba Cloud Model Studio, for example qwen3.8-flash and qwen3.7-plus; its models page also lists a qwen4-max-preview. Tier names change often, so check the Model Studio list |
The closed API tier above Qwen's open-weight models |
| DeepSeek, Moonshot (Kimi), Z.ai (GLM), MiniMax | First-party APIs for their open-weight models (Part 3) | Very low prices; the same weights are also served by many third-party hosts |
| Perplexity | Sonar, Sonar Pro, Sonar Reasoning Pro, Sonar Deep Research | Search-grounded answers with citations through an API. Perplexity's page says Sonar Chat Completions support ended on 27 September 2026 and these models are now served through its Agent API |
2.5 Side-by-side snapshot#
The two providers this learning path uses most, lined up by tier (standard tier list prices, USD per MTok, November 2026):
| Tier | OpenAI | Anthropic |
|---|---|---|
| Frontier | GPT-6 Astra: $10 / $50 | Claude Fable 5.2: $8 / $40 |
| Upper-mid | GPT-6.1 Sol: $2 / $10 | Claude Opus 5.5: $4 / $20 |
| Mid | GPT-6.1 Terra: $1 / $5 | Claude Sonnet 5.5: $2 / $10 |
| Small / fast | GPT-6 Luna: $0.10 / $0.50 | Claude Haiku 5.5: $0.10 / $0.50 |
| Context window | 1.05M | 1M |
| Max output | 128K | 128K |
| Input modalities | Text, image | Text, image (PDF) |
| Free API tier (as of November 2026) | A Free usage tier exists in allowed countries, with a $100 monthly usage limit; model coverage isn't stated (lesson 03.1, 3.1) | No standing free tier; new users get "a small amount of free credits to test the API" |
| Tier | Google (Gemini) |
|---|---|
| Frontier | Gemini 4 Carbon or Argon: $2 / $10 (intro) |
| Upper-mid | — |
| Mid | Gemini 3.8 Flash: $0.75 / $3.75 (intro) |
| Small / fast | Gemini 3.5 Flash-Lite: $0.30 / $2.50 |
| Context window | 1,048,576 |
| Max output | 65,536 (Argon and Carbon: more with long decode) |
| Input modalities | Text, image, video, audio, PDF |
| Free API tier (as of November 2026) | Yes, on Flash and Flash-Lite (data may be used to improve products, 9.2) |
Part 3: Open-weight model families (as of November 2026)#
Reference
3.1 Why open weights matter#
Open-weight models give you options closed models can't:
| Benefit | Why it matters |
|---|---|
| Data control | Run on your own servers, in your own region, even fully offline. Nothing leaves your network |
| No forced migration | A downloaded model can't be deprecated. You upgrade when you choose |
| Customization | Fine-tune, quantize, distil or merge models (Module 11C and Module 13A) |
| Provider choice | Dozens of hosts compete to serve popular open models, which drives prices down (5.4) |
| Cost at scale | At high, steady utilization, your own GPUs can beat per-token prices (5.7) |
| Transparency | You can inspect the architecture, tokenizer and config, and reproduce results exactly |
And costs:
- You own the operations: GPUs, scaling, monitoring, security patches and uptime.
- Quality for the hardest tasks is usually still somewhat behind the closed frontier.
- The largest open models are huge: several of the October 2026 flagships have 750 billion to 2.8 trillion total parameters, which need a multi-GPU server even when quantized (lesson 01, 4.4).
- Licences vary and some restrict commercial use (3.3).
3.2 The major families#
Total parameter counts below are read from each model's Hugging Face metadata (safetensors totals, rounded); licences and release months were re-checked against the Hugging Face model cards in November 2026, except Muse Spark Open, whose repository is gated and whose figures here rest on press coverage of Meta's release. Names like 35B-A3B mean 35 billion total and about 3 billion active per token: a mixture-of-experts model (lesson 01, 4.6).
| Family (maker) | Notable current models | Sizes | Licence | Notes |
|---|---|---|---|---|
| Qwen (Alibaba) | Qwen3.8 27B (Aug 2026); Qwen3.6 27B and 35B-A3B (Apr 2026); Qwen3.5 9B, 27B, 35B-A3B, 122B-A10B, 397B-A17B (Feb 2026); Qwen3.8-2.4T-A95B | From under 1B to 2.4T | Apache 2.0 for most; some models (Qwen3.8-Flash-Next, ~180B, and the 2.4T model) use custom Qwen licences, such as qwen-community-1.0 |
The broadest range of sizes; strong multilingual support; recent models accept images and video. Among the most-downloaded open models |
| DeepSeek | DeepSeek-V4-Pro (~1.6T total, Apr 2026); DeepSeek-V4.1-Flash (~763B total, Sep 2026) | Very large MoE | MIT | 1M-token context; extremely low hosted prices; open since V3 and R1 |
| Gemma (Google) | Gemma 4: E2B, E4B, 12B (June 2026), 26B-A4B, 31B (2026) | ~5B to 31B | Apache 2.0 | Small, efficient, multimodal (image and video input; audio on E2B, E4B and 12B); 128K context (E2B, E4B) to 256K (12B, 26B-A4B, 31B); good laptop and edge options. "E2B" means about 2B effective parameters on device |
| gpt-oss (OpenAI) | gpt-oss-20b (~21B), gpt-oss-120b (~117B), gpt-oss-safeguard | 21B, 117B (MoE) | Apache 2.0 | Text-only reasoning models with adjustable reasoning levels; the 20B runs on a good laptop |
| Llama → Muse (Meta) | Muse Spark Open (~816B total, 42B active, 15 Oct 2026); Muse Glimmer 30B (Aug 2026); Llama 4 Scout (~109B total, 17B active) and Maverick (2025) | 30B to 816B | Muse Spark Open: custom Muse Model License; Muse Glimmer 30B: Apache 2.0; Llama 4: custom Llama 4 Community License | Llama models and Muse Spark Open are gated on Hugging Face (you must request access and accept the licence). Muse Spark Open's model card (11 November 2026) says its licence needs a separate agreement with Meta if you offer the model to third parties as a service and earn more than $20M in 12 months, exempts internal use and powering your own product's features, and requires attribution ("Built with Muse Spark Open"): read it in full |
| Mistral | Mistral Small 4 (~119B, 2026), Ministral 3 (3B, 8B, 14B), Devstral 2 (123B in its name; about 125B in the Hugging Face weights), Mistral Large 4 | 3B to ~1T | Small 4, Ministral 3, Large 3: Apache 2.0; Large 4: custom Mistral Ecosystem Open Weight License; Devstral 2 (123B): a custom modified-MIT licence with conditions (read it) | European lab; Ministral models are strong small choices |
| Kimi (Moonshot AI) | Kimi K3 (~2.8T total, Jun 2026), Kimi K3.1-Pro (~2.8T, Nov 2026), Kimi K2.x | Trillion-scale MoE | Custom licence | 1M context; positioned for agentic and coding work |
| GLM (Z.ai) | GLM-5.3 (~753B), GLM-5.3-Flash (~321B, multimodal), Aug 2026 | Large MoE | GLM-5.3-Flash: MIT; GLM-5.3: listed as a custom licence on Hugging Face (so check the licence file) | 1M context; very low hosted prices |
| MiniMax | MiniMax M3 (~427B), M3.1 Flash | Large MoE | Custom MiniMax community licence | 1M context, multimodal input |
| Nemotron (NVIDIA) | Nemotron 3 Nano 30B-A3B, Super 120B-A12B, Ultra 550B-A55B; Nemotron 3.5 | 30B to 550B | NVIDIA's open-model licences (the Ultra model lists OpenMDW-1.1) | Range includes reasoning, vision-language and content-safety models |
| Others | IBM Granite 4.2 8B (Apache 2.0), Microsoft Phi-4 14B (MIT), Tencent Hy3 (~299B, Apache 2.0), Xiaomi MiMo V2.6 (MIT), Liquid LFM 2.5, Cohere North Mini Code | — | Mostly permissive | Specialist and small models; worth checking for edge and enterprise use |
3.3 Open-weight licences#
The licence decides whether you can legally ship your product. They fall into rough groups:
| Licence type | Examples | Commercial use | Typical conditions |
|---|---|---|---|
| Permissive (OSI-approved) | Apache 2.0 (Qwen, Gemma 4, gpt-oss, Mistral Small 4), MIT (DeepSeek, GLM-5.3-Flash, Phi-4) | ✅ Yes | Keep the licence and copyright notice. Apache 2.0 also includes a patent grant |
| Custom "community" licences | Llama 4 Community License, Muse Model License, custom Qwen licences (such as qwen-community-1.0), Kimi, MiniMax, Mistral's Large 4 and Devstral 2 licences |
✅ Usually, with limits | Thresholds on company size, user count or revenue; required attribution ("Built with..."); naming rules for derivatives; an acceptable use policy |
| Non-commercial / research | CC BY-NC 4.0 (for example Mistral's Voxtral TTS) | ❌ No | Research and personal use only |
| Model-specific open licences | OpenMDW, NVIDIA's open-model licences | ✅ Usually | Read for redistribution and attribution terms |
Before you ship on an open-weight model, check:
- Commercial use allowed for your kind of company and product?
- Thresholds: monthly active users, revenue or company size limits? (The Llama licences, for example, have long required a separate licence from Meta above 700 million monthly active users.)
- Attribution: must your product display a notice?
- Acceptable use policy: does your use case fall into a prohibited category?
- Outputs: are there restrictions on using the model's outputs to train other models? (Closed providers' terms raise the same question: see 9.6.)
- Derivatives: if you fine-tune, which licence does your fine-tune carry, and are there naming rules?
- Geography: some licences or policies restrict users or entities in certain regions.
- Gating: do you have to accept terms on Hugging Face before downloading? (Shown as
gatedin the metadata, 7.1.)
3.4 Sizes and what they need#
Combine the sizes above with the memory rule from lesson 01, 4.4 (memory for weights ≈ parameters × bytes per parameter):
| Size class | Examples | Weights at 4-bit | Where it runs |
|---|---|---|---|
| Tiny (under 4B, or ~2B effective) | Qwen 0.5B–4B, Gemma 4 E2B, Ministral 3B | Under ~3 GB | Phones, browsers, any laptop, CPU |
| Small (7B–35B) | Qwen3.5 9B, gpt-oss-20b, Gemma 4 12B and 31B, Qwen3.6 35B-A3B | ~4–18 GB | A good laptop, or one consumer GPU |
| Medium (70B–150B) | gpt-oss-120b, Mistral Small 4, Llama 4 Scout | ~35–75 GB | One or two data-centre GPUs, or a large-memory workstation |
| Frontier-scale (400B–2.8T) | DeepSeek-V4, Kimi K3, GLM-5.3, Muse Spark Open | ~200 GB to over 1 TB | A multi-GPU server; in practice usually reached through a hosted API |
Remember the mixture-of-experts rule: memory follows total parameters, speed follows active parameters. Qwen3.6 35B-A3B needs memory for 35B but generates about as fast as a 3B dense model, which is why "A3B"-style models are popular for local use.
3.5 Reading open model names#
Open-weight model names pack in a lot of information. The common suffixes:
| You see | It means |
|---|---|
-Base, or no suffix on some families |
A base (pretrained) model: continues text, doesn't follow instructions well (lesson 06) |
-Instruct, -it, -Chat |
Instruction-tuned: the version you want for applications |
-Thinking, -Reasoning, -R1 |
A reasoning variant (lesson 08) |
-VL, -Vision, -Omni |
Accepts images (VL = vision-language), or many modalities (Omni) |
-Coder, -Code |
Tuned for programming |
27B, 120B, 2.4T |
Total parameters |
A3B, A17B, A95B |
Active parameters per token (mixture-of-experts) |
E2B, E4B |
"Effective" parameters (Gemma's on-device models) |
16E, 8x7B |
Number of experts |
-2507, -0813, -1017 |
A date-stamped release (July 2025, 13 August, 17 October) |
-FP8, -BF16, -AWQ, -GPTQ, -GGUF, Q4_K_M |
Precision or quantization format (lesson 01, 4.5) |
Part 4: Capabilities to compare#
4.1 The capability checklist#
When you compare models, these are the properties that decide whether a model can do your job at all, and how well. Ask every question for every candidate:
| Capability | The question to ask | Where to find it |
|---|---|---|
| Input modalities | Can it read text, images, PDFs, audio, video? | Model page; input_modalities in catalogues |
| Output modalities | Can it produce text only, or also images or audio? | Model page; output_modalities |
| Context window | How many tokens (input + output) fit in one request? | Model page; context_length, max_input_tokens |
| Max output | How long can one answer be? | Model page; max_completion_tokens, max_tokens |
| Reasoning | Does it think before answering? Is it mandatory or optional? Which effort levels? | Model page; reasoning object; lesson 08 |
| Tool use | Can it call functions you define? Built-in server tools (web search, code execution)? | Model page; supported_parameters contains tools |
| Structured output | Can it guarantee JSON that matches your schema? | Model page; structured_outputs |
| Multilingual quality | How good is it in your languages, and how many tokens do they cost? | Your own evals; lesson 02 |
| Speed | Time to first token, tokens per second, total latency at your prompt sizes | Your own measurements; Artificial Analysis; OpenRouter endpoint stats |
| Knowledge cutoff | How recent is its built-in knowledge? | Model page or transparency/system card |
| Price | Input, output, cached input, reasoning, batch, long-context and regional rules | Pricing page (Part 6) |
| Reliability | How often does it error, overload or rate-limit, and is there an SLA? | Provider status page and its history; enterprise contract terms; OpenRouter endpoint uptime stats |
| Rate limits | Requests and tokens per minute at your account tier | Provider console / rate-limit docs (Module 03) |
| Batch and caching | Discounted batch processing? Prompt caching? | Pricing page |
| Fine-tuning | Can you fine-tune it, and where? | Model page (Module 13A) |
| Data handling | Retention, training use, ZDR, regions | Data policy pages (Part 9) |
| Lifecycle | Is it GA, preview or deprecated? When does it retire? | Deprecations page (Part 8) |
4.2 Modalities#
A modality is a kind of data: text, image, audio, video. "Multimodal" models accept more than one. Input and output are separate questions: almost every current general model reads images, but very few general models write images or audio. That's still mostly the job of specialized models (1.4).
As of October 2026 (from provider pages and OpenRouter's catalogue):
| Model family | Text in | Image in | PDF in | Audio in | Video in | Output |
|---|---|---|---|---|---|---|
| OpenAI GPT-6 / 6.1 | ✅ | ✅ | ✅ | ❌ (use realtime or transcription models) | ❌ | Text |
| Anthropic Claude 5.x | ✅ | ✅ | ✅ | ❌ | ❌ | Text |
| Google Gemini 4 / 3.x | ✅ | ✅ | ✅ | ✅ | ✅ | Text |
| xAI Grok 4.x | ✅ | ✅ | ✅ (files) | ❌ | ❌ | Text |
| Qwen3.5+ open models | ✅ | ✅ | — | Omni variants | ✅ | Text |
| gpt-oss | ✅ | ❌ | ❌ | ❌ | ❌ | Text |
Image and audio inputs are converted into tokens and billed as tokens, so a single high-resolution image can cost as much as a page of text (6.10). Building multimodal and voice apps is Module 09.
4.3 Context window and max output#
Lesson 07, Part 2 covers context windows in depth. For comparing models, remember four things:
- Context window and max output are different numbers. As of November 2026, the big three all advertise about 1M tokens of context, but max output ranges from 65,536 (Gemini by default, and up to the full window with long decode on Gemini 4, lesson 07, 2.3) to 128K (OpenAI and Anthropic). A model that can read a whole book can't necessarily write one in one go.
- Some providers count input and output together against the window (Google calls it a "unified input and output token limit"). Others publish a separate maximum input.
- Advertised isn't the same as usable. Quality often degrades well before the limit, especially when the relevant facts are in the middle of a long prompt (lesson 07, 5.1).
- Long prompts can cost more per token on some models (6.6), and always cost more in total and take longer.
4.4 Reasoning support#
Most current flagships are reasoning models that generate hidden "thinking" tokens before they answer (lesson 08). When comparing, check:
- Mandatory or optional? In OpenRouter's October 2026 catalogue, GPT-6 Astra, GPT-6.1 Sol, Claude Fable 5.1, Opus 5.5, Sonnet 5.5 and Gemini 4 Argon reason on every request (Anthropic documents the same for Fable 5.2): thinking can't be switched off (
mandatory: true), while GPT-6 Luna, GPT-6.1 Terra and Claude Haiku 5.5 accept an effort ofnone. For the authoritative answer, check the provider's own Models API (Anthropic'scapabilities.thinking.types, for example), not a catalogue: on 1 November 2026 OpenRouter listed Opus 5.5's default effort ashigh, while Anthropic documentsmedium. - Which effort levels exist (
minimal/none/low/medium/high/xhigh/max) and which is the default. Defaults differ even within one provider: Anthropic's Opus 5.5 defaults tomedium, Sonnet 5.5 tohigh. - How thinking is billed: as output tokens, at the output price (6.4). A reasoning model can be cheaper per token yet more expensive per task.
4.5 Tool use and structured output#
Tool use (also called function calling) lets the model ask your code to run a function and use the result. Structured output guarantees the response matches a JSON schema you supply. Both are essential for agents and data extraction, and both are covered properly in Module 03 and Module 08A.
For model selection, the questions are simply: is it supported, how reliable is it (does the model call the right tool with valid arguments?), and are there server-side tools (web search, code execution, file search, computer use) the provider runs for you, at extra cost (6.10)? As of October 2026, every current general model from OpenAI, Anthropic and Google supports both tool use and structured outputs. Smaller open models and older models are where support gets patchy, and on gateways support can depend on which host serves the request (5.4).
4.6 Multilingual quality#
All major models are multilingual, but quality is not uniform:
- Quality is usually best in English and other high-resource languages, and drops for lower-resource languages, especially for reasoning, idioms and formal register.
- The same sentence costs different numbers of tokens in different languages, and different tokenizers handle the same language very differently (lesson 02). A language that takes three times as many tokens is three times as expensive and fills the context window three times as fast.
- Benchmarks such as multilingual versions of MMLU (for example MMMLU and Global-MMLU) give a rough signal, but they're often translations of English questions.
What this means for you: if your users speak Tamil, Hindi, Arabic or Indonesian, build your evaluation set in those languages, with native speakers judging the outputs, and measure tokens per message in those languages for cost.
4.7 Speed#
"Fast" has three separate meanings, and they matter for different products:
| Metric | What it is | Matters most for |
|---|---|---|
| Time to first token (TTFT) | Delay before the first output token arrives | Chat UIs, voice (lesson 05 covers streaming) |
| Output speed (tokens per second) | How fast tokens arrive once generation starts | Long answers, code generation |
| End-to-end latency | Total time for the whole request, including thinking | Pipelines, agents with many steps, batch jobs |
Speed depends on the model's size, the host's hardware and load, your prompt length, and especially reasoning effort, since thinking tokens are generated before the visible answer starts. Providers now sell speed as a product:
- OpenAI's Fast tier (renamed from "Priority" on 30 July 2026) and Ultrafast tier, at higher prices.
- Anthropic's fast mode for Fable 5.2 and Opus models, at premium pricing.
- Google's Priority tier for Gemini.
- On OpenRouter, the
:nitrosuffix routes to the highest-throughput hosts (5.4). - Some inference hosts run open-weight models on specialized hardware for much higher output speed. Groq, Cerebras and SambaNova, for example, all appear as endpoints for models such as
openai/gpt-oss-120bin OpenRouter's catalogue; compare them on its endpoint statistics.
Measure speed yourself, from your region, at your real prompt sizes. Published numbers (for example from Artificial Analysis or OpenRouter's endpoint statistics) are useful for shortlisting.
4.8 Knowledge cutoff#
A model only knows what was in its training data (lesson 01, 7.3). Providers increasingly publish two dates. Anthropic, for example, distinguishes:
- Reliable knowledge cutoff: "the date through which the model's knowledge is most extensive and reliable" (June 2026 for all current Claude models).
- Training data cutoff: the broader range of data used in training.
As of November 2026, OpenAI lists cutoffs between 30 April and 1 June 2026 for its GPT-6-series models, xAI lists May 2026 for Grok 4.7, and Google's API model pages don't state one for Gemini 4 Carbon or Argon (check the Google DeepMind model card). Some catalogues, such as OpenRouter's, include a knowledge_cutoff field, but it's often null for new models.
4.9 Try it: explore the live model catalogue#
OpenRouter publishes a catalogue of every model it serves, with capabilities and live prices, at https://openrouter.ai/api/v1/models. Its API reference documents a bearer token, but as of November 2026 the endpoint also answers without one, which makes it a free way to explore the landscape. (If it starts asking for a key, create a free OpenRouter account and send Authorization: Bearer <key>.)
First, look at what one catalogue entry contains:
import httpx
# OpenRouter's public catalogue: every model it can route to, with live prices.
URL = "https://openrouter.ai/api/v1/models"
models = httpx.get(URL, timeout=30).json()["data"]
print(f"Models in the catalogue: {len(models)}")
# Look at one entry to see what the catalogue tells you about a model
m = next(m for m in models if m["id"] == "anthropic/claude-haiku-5.5")
print("\nid: ", m["id"])
print("context_length: ", m["context_length"])
print("max output: ", m["top_provider"]["max_completion_tokens"])
print("input modalities:", m["architecture"]["input_modalities"])
print("output modalities:", m["architecture"]["output_modalities"])
print("pricing (USD per token):", m["pricing"])
print("supports tools? ", "tools" in m["supported_parameters"])
print("reasoning: ", m["reasoning"])Models in the catalogue: 456
id: anthropic/claude-haiku-5.5
context_length: 1000000
max output: 128000
input modalities: ['text', 'image', 'file']
output modalities: ['text']
pricing (USD per token): {'prompt': '0.0000001', 'completion': '0.0000005', 'web_search': '0.01', 'input_cache_read': '0.00000001', 'input_cache_write': '0.000000125', 'input_cache_write_1h': '0.0000002', 'overrides': [{'min_prompt_tokens': 100000, 'prompt': '0.0000005', 'completion': '0.0000025', 'input_cache_read': '0.00000005', 'input_cache_write': '0.000000625', 'input_cache_write_1h': '0.000001'}]}
supports tools? True
reasoning: {'mandatory': False, 'supported_efforts': ['max', 'xhigh', 'high', 'medium', 'low', 'none'], 'default_effort': 'medium'}How to read it:
- Prices are USD per single token, as strings.
'0.0000001'per token × 1,000,000 = $0.10 per million, matching Anthropic's pricing page. Multiply by a million to compare with pricing pages. input_cache_read,input_cache_writeandinput_cache_write_1hare the prompt-caching prices (6.3);web_searchis per search.overridesholds conditional prices: here, prompts of 100,000+ tokens switch to $0.50 / $2.50, exactly Haiku 5.5's long-prompt rule.reasoningtells you thinking is optional (mandatory: False) and lists the effort levels.
Now use the catalogue as a shortlisting tool. Suppose your feature needs image input, tool calling, schema-guaranteed JSON and at least 400K tokens of context, and a typical request is 3,000 tokens in and 500 out:
import httpx
models = httpx.get("https://openrouter.ai/api/v1/models", timeout=30).json()["data"]
def per_million(price_per_token: str) -> float:
"""OpenRouter quotes USD per single token, as a string. Convert to USD per 1M tokens."""
return float(price_per_token) * 1_000_000
def is_plain_model(m: dict) -> bool:
"""Skip routers (negative 'variable' prices), aliases (~...), and :batch / :free variants."""
mid = m["id"]
return (
not mid.startswith(("~", "openrouter/"))
and ":" not in mid
and float(m["pricing"]["prompt"]) >= 0
)
# Your requirements: images in, tool calling, JSON-schema output, at least 400K context
def meets_requirements(m: dict) -> bool:
params = m["supported_parameters"]
return (
"image" in m["architecture"]["input_modalities"]
and "tools" in params
and "structured_outputs" in params
and (m["context_length"] or 0) >= 400_000
)
# A typical request for this app: 3,000 input tokens and 500 output tokens
IN_TOKENS, OUT_TOKENS = 3_000, 500
def cost_per_1k_requests(m: dict) -> float:
p = m["pricing"]
per_request = (IN_TOKENS * float(p["prompt"]) + OUT_TOKENS * float(p["completion"]))
return per_request * 1_000
candidates = [m for m in models if is_plain_model(m) and meets_requirements(m)]
print(f"{len(candidates)} of {len(models)} catalogue entries meet the requirements\n")
print("Cheapest 8 for this workload:")
print(f"{'model':42s} {'in $/M':>7s} {'out $/M':>8s} {'context':>9s} {'$ per 1k req':>12s}")
for m in sorted(candidates, key=cost_per_1k_requests)[:8]:
print(f"{m['id']:42s} {per_million(m['pricing']['prompt']):7.2f} "
f"{per_million(m['pricing']['completion']):8.2f} {m['context_length']:>9,} "
f"{cost_per_1k_requests(m):12.2f}")
print("\nLargest context windows among the candidates:")
for m in sorted(candidates, key=lambda m: -m["context_length"])[:4]:
print(f"{m['id']:42s} {m['context_length']:>10,} tokens")110 of 456 catalogue entries meet the requirements
Cheapest 8 for this workload:
model in $/M out $/M context $ per 1k req
z-ai/glm-5.3-flash 0.02 0.14 1,048,576 0.12
qwen/qwen3.5-flash-02-23 0.07 0.26 1,000,000 0.33
openai/gpt-5-nano 0.05 0.40 400,000 0.35
minimax/minimax-m3.1-flash 0.07 0.30 1,048,576 0.38
deepseek/deepseek-v4.1-flash 0.04 0.50 1,048,576 0.39
particle-ai/particle-1 0.05 0.50 1,048,576 0.40
meta/muse-spark-1.3-contributor 0.10 0.20 1,048,576 0.40
meta/muse-spark-1.2-contributor 0.10 0.20 1,048,576 0.40
Largest context windows among the candidates:
x-ai/grok-4.20 2,000,000 tokens
meta-llama/llama-4-scout 1,310,720 tokens
openai/gpt-6.1-terra-pro 1,050,000 tokens
openai/gpt-6.1-terra 1,050,000 tokensWhat this shows, and what it doesn't:
- Hard requirements cut the field fast: 110 of 456 entries pass four simple filters. That's what step 2 of the decision framework does (10.2).
- Cost per request, not price per token, is the number to sort by, because input and output prices differ. Your workload's input/output ratio changes the ranking.
- Cheapest isn't best. This list says nothing about quality. Several of these are small or older models. The shortlist is the input to an evaluation, never the decision (7.6).
- Read the small print. Variants such as Meta's "contributor" tier or OpenAI's
-proentries (the same model with a higher reasoning mode) can have very different terms or costs per task than their names suggest. Read each entry'sdescription. - Catalogues can disagree with the source. OpenRouter lists
x-ai/grok-4.20at 2M tokens of context, while xAI's own models page lists 1M for the Grok 4.20 models. When a number matters, confirm it on the provider's page.
4.10 Check capabilities in code#
Each first-party provider also has a Models API that lists the models your account can use. They report different things:
| Provider | Call | Useful fields (October 2026) |
|---|---|---|
| OpenAI | client.models.list() |
id, created, owned_by, and shutdown_date once a model is scheduled for shutdown |
| Anthropic | client.models.list() |
id, display_name, max_input_tokens, max_tokens, lifecycle (active / deprecated / retired), retires_at, line (haiku, sonnet, opus, fable, mythos), and a capabilities object (batch, citations, effort levels, image and PDF input, structured outputs, thinking types, server tools) |
| Google Gemini | client.models.list() |
name, display_name, input_token_limit, output_token_limit, supported_actions, thinking |
import os
from dotenv import load_dotenv
load_dotenv() # reads OPENAI_API_KEY, ANTHROPIC_API_KEY, GEMINI_API_KEY from .env
# --- OpenAI: ids, plus a shutdown date once a model is scheduled for retirement ---
if os.getenv("OPENAI_API_KEY"):
from openai import OpenAI
for m in OpenAI().models.list():
if m.id.startswith("gpt-6"):
print("openai ", m.id, "| shutdown:", m.shutdown_date)
# --- Anthropic: limits, lifecycle and a capabilities object per model ---
if os.getenv("ANTHROPIC_API_KEY"):
import anthropic
for m in anthropic.Anthropic().models.list(limit=20):
caps = m.capabilities
print("anthropic", m.id, "|", m.lifecycle, "| in:", m.max_input_tokens,
"| out:", m.max_tokens, "| structured outputs:", caps.structured_outputs.supported,
"| retires:", m.retires_at)
# --- Gemini: token limits and which API methods each model supports ---
if os.getenv("GEMINI_API_KEY"):
from google import genai
gemini = genai.Client() # keep the client in a variable: a throwaway client can be garbage-collected mid-iteration
for m in gemini.models.list():
if "gemini-4" in m.name or "gemini-3.8" in m.name:
print("gemini ", m.name, "| in:", m.input_token_limit, "| out:", m.output_token_limit,
"| thinking:", m.thinking)openai gpt-6-astra | shutdown: None
openai gpt-6.1-sol | shutdown: None
openai gpt-6.1-terra | shutdown: None
openai gpt-6-luna | shutdown: None
anthropic claude-haiku-5-5 | active | in: 1000000 | out: 128000 | structured outputs: True | retires: None
anthropic claude-sonnet-5-5 | active | in: 1000000 | out: 128000 | structured outputs: True | retires: None
anthropic claude-sonnet-4-5-20250929 | deprecated | in: 200000 | out: 64000 | structured outputs: True | retires: 2026-11-30 00:00:00+00:00
gemini models/gemini-4-argon | in: 1048576 | out: 65536 | thinking: True
gemini models/gemini-3.8-flash | in: 1048576 | out: 65536 | thinking: TrueEach block only runs if the matching key is set, so the script is safe to run with any subset of keys. Anthropic's capabilities object is especially useful: its docs advise reading fields such as line from the API rather than guessing from the model ID. OpenRouter is not in this table because its catalogue (above) already covers every model it serves.
Part 5: Ways to access models#
Deep-dive
5.1 The four routes#
flowchart TB
app["Your application"]
app -->|"one SDK per provider"| direct["Direct provider APIs<br/>api.openai.com, api.anthropic.com,<br/>generativelanguage.googleapis.com"]
app -->|"your cloud account"| cloud["Cloud platforms<br/>AWS Bedrock, Google Agent Platform,<br/>Microsoft Foundry"]
app -->|"one key, OpenAI-compatible"| gw["Gateway: OpenRouter"]
app -->|"your own hardware"| self["Self-hosted open weights<br/>Ollama, llama.cpp, vLLM"]
gw --> p1["OpenAI / Anthropic / Google"]
gw --> p2["Inference hosts serving open weights<br/>(DeepInfra, Fireworks, Together...)"]
cloud --> m1["Claude, GPT, Gemini (platform-dependent)<br/>plus open-weight models"]| Route | You get | Best when | Watch out for |
|---|---|---|---|
| Direct provider API | The newest models and features first, the provider's own SDK and docs | You've standardized on one or two providers | A separate account, bill, key and SDK per provider; check whether an uptime SLA is offered, and on which plan |
| Cloud platform | Models inside your existing cloud account: its billing, IAM (identity and access management), networking, regions and compliance | Your company already runs on AWS, Google Cloud or Azure | Features can lag the direct API; different model IDs, prices and retirement dates |
| Gateway (OpenRouter) | Hundreds of models behind one key and one OpenAI-compatible API, with fallbacks | Exploring, comparing, multi-model products, resilience | Another company in your data path; per-host differences; a platform fee |
| Self-hosting | Full control of open-weight models on your hardware | Strict data control, offline use, very high steady volume, customization | You run the operations; only open-weight models |
These routes aren't exclusive. A common production setup uses a direct API for the primary model, a cloud platform or gateway for the fallback, and a small self-hosted model for a privacy-sensitive step.
5.2 Direct provider APIs#
Calling OpenAI, Anthropic or Google directly is the default in this learning path, and Module 03 covers all three APIs in depth. For model selection, know this:
- New models and features arrive here first, often weeks or months before cloud platforms.
- Each provider has its own API shape (OpenAI's Responses and Chat Completions APIs, Anthropic's Messages API, Google's
generateContent) and its own SDK. - Compatibility layers exist. Anthropic and Google both offer endpoints that accept OpenAI SDK requests, which makes quick comparisons easy. They don't expose every provider-specific feature (Anthropic's docs note, for example, that its
inference_geodata-residency parameter isn't available through its OpenAI SDK compatibility endpoint), so use the native SDK for production. - Account tiers set your rate limits. New accounts start with low limits that rise with spend (Module 03).
5.3 Cloud platforms#
The three hyperscalers resell models from many labs inside their clouds. As of October 2026:
| Platform | What it is | Models available (examples) |
|---|---|---|
| Amazon Bedrock (AWS) | AWS's managed model service | Claude 5.x and 4.x, OpenAI GPT-6 and GPT-5.x and gpt-oss, Amazon Nova, Meta Llama, Mistral, DeepSeek, Qwen, Google Gemma, Kimi, MiniMax, GLM, Grok, Cohere, NVIDIA Nemotron, plus image and embedding models |
| Claude Platform on AWS | Anthropic's own platform, billed through AWS Marketplace | Claude models with the first-party Claude API's features and lifecycle |
| Gemini Enterprise Agent Platform (Google Cloud; formerly Vertex AI, renamed in April 2026) | Google Cloud's AI platform; its Model Garden hosts first- and third-party models | Gemini, Claude (Google-managed and Anthropic-managed options), Grok, Meta Muse, DeepSeek, GLM, and open models |
| Microsoft Foundry (formerly Azure AI Foundry) | Microsoft's AI platform on Azure | OpenAI models (as "Azure OpenAI in Foundry Models"), Claude, and a large catalogue of open and partner models |
Why enterprises choose them:
- Procurement and billing: usage lands on the existing cloud bill and counts towards committed-spend agreements.
- Identity and networking: the cloud's IAM roles instead of API keys, private networking, and audit logs.
- Regions and residency: pick the region where inference runs (Part 9).
- Compliance: the cloud's certifications and its data-processing terms. On Bedrock and the Google-managed Claude offering, the cloud provider is the data processor, not Anthropic.
Trade-offs to check:
- Different model IDs. For example, Claude Opus 5.5 is
claude-opus-5-5on the Claude API butanthropic.claude-opus-5-5on Bedrock. - Different lifecycles. Anthropic's docs state that Bedrock and Google-managed Claude "set their own retirement schedules", so a model can retire on a different date there.
- Different prices. Regional endpoints (guaranteed in-region processing) cost about 10% more than global endpoints on Bedrock and Google Cloud, for Claude 4.5 and later models.
- Feature lag. Beta features may not be available yet. Check the platform's own model page.
5.4 OpenRouter: a unified gateway#
OpenRouter is a gateway: one account, one API key and one OpenAI-compatible endpoint (https://openrouter.ai/api/v1) in front of hundreds of models from dozens of providers. You call it with the standard openai SDK by changing base_url.
How it works
- Model IDs are
vendor/model, for exampleanthropic/claude-sonnet-5.5,openai/gpt-6-luna,deepseek/deepseek-v4.1-flash. - One model, many endpoints. Each model can be served by several providers (hosts). Closed models are served by their maker, and sometimes by cloud platforms too. Popular open-weight models are served by many independent inference companies, at different prices, speeds and quantization levels.
- Routing. By default OpenRouter load-balances across a model's endpoints. Its docs describe comparing "effective price" with throughput, time to first token, rate limits, reliability and tool-call quality, then picking among the best at random, weighted by their share.
- Variants change routing or pricing:
:free(free, rate-limited versions of some models),:nitro(sort by throughput, and also make priority-tier endpoints eligible),:floor(sort by price, and also make flex-tier endpoints eligible) and, in the October 2026 catalogue,:batchentries at batch prices. A:batchentry is a catalogue listing, not something you add to a request: OpenRouter's own Batch API looks it up from the plain model ID (6.5). - Floating aliases such as
~anthropic/claude-sonnet-latestalways point at the newest model in a line (8.1). - Auto Router (
openrouter/auto) picks a model for each prompt. Per OpenRouter's docs (checked 11 November 2026), it first narrows the pool by your guardrails, data-retention setting, capabilities andallowed_models/excluded_modelslists; a fast decision model then rates the request (task type, difficulty, whether speed matters, vision and so on) and a routing policy weighs that rating against live prices, cache status and benchmark performance to choose both a model and a reasoning effort. You pay "the standard rate for whichever model is selected", with no extra fee, and the response'smodelfield says which model answered. It is a black box driven by general benchmarks and prices, not your data; 11B.5, 2.11 has the details.
Try it: one model, many prices
OpenRouter also publishes each model's endpoints. Compare a closed model with an open-weight one:
import httpx
def endpoints(model_id: str) -> list[dict]:
url = f"https://openrouter.ai/api/v1/models/{model_id}/endpoints"
return httpx.get(url, timeout=30).json()["data"]["endpoints"]
def show(model_id: str, limit: int = 8) -> None:
eps = sorted(endpoints(model_id), key=lambda e: float(e["pricing"]["prompt"]))
print(f"\n{model_id}: {len(eps)} endpoints (cheapest input price first)")
print(f" {'endpoint tag':30s} {'quant':8s} {'in $/M':>7s} {'out $/M':>8s}")
for e in eps[:limit]:
p = e["pricing"]
print(f" {e['tag']:30s} {e['quantization']:8s} "
f"{float(p['prompt']) * 1e6:7.3f} {float(p['completion']) * 1e6:8.3f}")
show("google/gemini-3.8-flash") # a closed model: only Google serves it
show("deepseek/deepseek-v4.1-flash") # an open-weight model: many independent hostsgoogle/gemini-3.8-flash: 7 endpoints (cheapest input price first)
endpoint tag quant in $/M out $/M
google-ai-studio/flex unknown 0.375 1.875
google-vertex/global/flex unknown 0.375 1.875
google-ai-studio unknown 0.750 3.750
google-vertex/global unknown 0.750 3.750
google-vertex/us unknown 0.825 4.125
google-ai-studio/priority unknown 1.350 6.750
google-vertex/global/priority unknown 1.350 6.750
deepseek/deepseek-v4.1-flash: 41 endpoints (cheapest input price first)
endpoint tag quant in $/M out $/M
morph/fp8 fp8 0.022 0.192
open-inference/fp4 fp4 0.043 1.040
wafer/us mxfp4 0.045 0.500
relace unknown 0.070 0.500
decart/fp4 fp4 0.090 0.180
sail-research/fp4/us fp4 0.090 0.250
sail-research/fp4 fp4 0.090 0.250
reka unknown 0.105 0.840This one output teaches four lessons:
- A closed model has one maker but several price points. Gemini 3.8 Flash appears through Google AI Studio (the Gemini API) and Google's cloud platform, in flex (half price, lower priority), standard and priority tiers, and a US-region endpoint at exactly 10% more. These match Google's own pricing page (Part 6).
- An open-weight model is a commodity. Forty-one hosts serve DeepSeek V4.1 Flash, with input prices varying about fivefold even among these eight.
- "The same model" isn't always the same. The cheapest hosts often run it at FP8, FP4 or MXFP4 quantization (lesson 01, 4.5), which can change quality, especially on long or tricky tasks.
unknownmeans the host didn't declare a precision. - The model-level price is just one endpoint's price. The catalogue's model-level entry for Gemini 3.8 Flash lists $0.825, the US-region price, not the cheapest (you'll see it again in 6.13). Look at endpoints when cost matters.
Controlling routing: provider preferences and fallbacks
You control routing with two request fields (sent through the OpenAI SDK's extra_body):
models: a list of model IDs in priority order. If the first fails (OpenRouter's docs list context-length errors, moderation flags, rate limiting and downtime), the next is tried. You're "billed at the rate of the model that actually handled the request", which is reported in the response'smodelfield.provider: preferences for which hosts may serve the request. Key fields:order(try these hosts first),allow_fallbacks,only/ignore,sort("price","throughput"or"latency"),max_price,quantizations(a list of allowed precisions, for example["fp8", "bf16"]),preferred_min_throughputandpreferred_max_latency(soft preferences: slower endpoints are moved to the back of the queue, not excluded),require_parameters(only hosts that support every parameter you sent),data_collection: "deny"(exclude hosts that store or train on your data) andzdr: true(zero-data-retention endpoints only).
flowchart LR
req["Request<br/>models: [A, B, C]<br/>provider: {...}"] --> mA{"Model A"}
mA -->|"pick an endpoint by<br/>price, speed, uptime"| e1["Provider 1 for A"]
e1 -->|"error"| e2["Provider 2 for A"]
e2 -->|"all A endpoints fail"| mB{"Model B"}
mB --> e3["Provider for B"]
e1 -->|"success"| ok["Response<br/>model = who answered<br/>billed at that model's price"]
e2 -->|"success"| ok
e3 -->|"success"| okimport os
from dotenv import load_dotenv
from openai import OpenAI
load_dotenv()
client = OpenAI(base_url="https://openrouter.ai/api/v1", api_key=os.environ["OPENROUTER_API_KEY"])
response = client.chat.completions.create(
model="anthropic/claude-haiku-5.5", # first choice
messages=[{"role": "user", "content": "In one sentence: what is a model card?"}],
extra_body={
# Model fallbacks: tried in order if the first choice errors (downtime, rate limit...)
"models": ["anthropic/claude-haiku-5.5", "openai/gpt-6-luna", "google/gemini-3.8-flash"],
# Provider routing preferences for whichever model ends up serving the request
"provider": {
"data_collection": "deny", # only providers that don't store/train on your data
"zdr": True, # only zero-data-retention endpoints
"sort": "latency",
},
},
)
print("served by:", response.model) # the model that actually answered (and was billed)
print("answer: ", response.choices[0].message.content)
print("usage: ", response.usage.prompt_tokens, "in /", response.usage.completion_tokens, "out")served by: anthropic/claude-haiku-5.5
answer: A model card is a document published with a machine-learning model that describes what it is for, how it was trained and evaluated, and its known limitations.
usage: 19 in / 33 outWhat it costs
As of November 2026, from OpenRouter's FAQ and pricing page:
- Inference prices are passed through from the underlying providers: "there is no markup on inference pricing".
- A platform fee is charged when you buy credits: 5.5% on the standard pay-as-you-go plan (8% on the Business plan; negotiated on Enterprise).
- Bring your own key (BYOK): you can attach your own provider keys. The first $25,000 of list-price usage per month is fee-free, then OpenRouter charges 5% of what the request would normally cost.
- Free models are limited to 20 requests per minute and 50 per day, rising to 1,000 per day once you've bought at least $10 of credits. If a
:freemodel falls back to a paid one, you pay the paid price.
Data handling
OpenRouter's FAQ says it does "zero logging of your prompts/completions" unless you opt in (opting in earns a 1% discount). It also says it works with providers to ensure prompts and completions are not logged or used for training, and excludes providers that log, or whose policies it can't confirm, unless you switch on the model-training toggle in your privacy settings. But each downstream provider has its own policy. Use the data_collection and zdr preferences, or the equivalent account settings, to restrict routing to hosts whose policies you accept (Part 9).
When to use a gateway, and when not to
| Use a gateway when... | Go direct when... |
|---|---|
| You're exploring or comparing many models | You've settled on one provider for a high-volume workload |
| You want automatic failover across providers | You need provider-specific features on day one |
| You want open-weight models without self-hosting | Your compliance review allows only named processors |
| You want one bill and one key | A 5.5% fee matters at your volume, or you have negotiated direct discounts |
5.5 Comparing the routes for one model#
The same model can have different IDs, prices and lifecycles depending on the route. For example, Claude Sonnet 5.5 as of October 2026:
| Route | Model ID | Price basis | Retirement schedule set by |
|---|---|---|---|
| Claude API (direct) | claude-sonnet-5-5 |
Anthropic list price | Anthropic: "not sooner than 28 September 2027" |
| Amazon Bedrock | anthropic.claude-sonnet-5-5 |
AWS pricing; regional endpoints +10% | AWS |
| Google Cloud (Google-managed) | claude-sonnet-5-5 |
Google Cloud pricing; regional/multi-region +10% | |
| Microsoft Foundry | claude-sonnet-5-5 (deployment name) |
Anthropic rates, billed through Azure Marketplace | Follows Anthropic's schedule |
| OpenRouter | anthropic/claude-sonnet-5.5 |
Provider price passed through, plus the credit-purchase fee | Follows the underlying providers |
5.6 Choosing a route#
A rule of thumb:
- Prototyping and learning: the OpenAI and Anthropic direct APIs, the providers' free tiers, or OpenRouter (optional: one key, every model).
- Production, one main provider, no cloud constraint: the direct API.
- Production inside an enterprise cloud: that cloud's platform, after checking the model and features you need are there.
- Data must never leave your infrastructure, or you need offline use: self-hosted open weights.
5.7 Self-hosting open weights#
Self-hosting means running an open-weight model on hardware you control: a laptop, an on-premises server or rented cloud GPUs. The three tools you'll hear about most:
| Tool | What it is | Best for | API |
|---|---|---|---|
| Ollama | A friendly app and CLI that downloads and runs models with one command (ollama run qwen2.5:0.5b) |
Laptops, prototyping, local development | OpenAI-compatible, at http://localhost:11434/v1 |
| llama.cpp | The C/C++ inference engine behind many local tools; runs GGUF-format quantized models on CPUs, Apple Silicon and GPUs | Maximum portability, edge devices, fine control of quantization | llama-server exposes an OpenAI-compatible HTTP API |
| vLLM | A high-throughput GPU serving engine (its PagedAttention technique manages KV-cache memory efficiently) | Production serving to many concurrent users | vllm serve <model> exposes an OpenAI-compatible server |
Others you'll meet include LM Studio (a desktop app) and SGLang (another high-throughput server). Many model cards include ready-made instructions for these tools (7.1).
Because they all speak the OpenAI API, switching from a hosted model to a local one can be a one-line change:
from openai import OpenAI
# Ollama serves downloaded open-weight models behind an OpenAI-compatible API.
# The api_key is required by the SDK but ignored by Ollama.
client = OpenAI(base_url="http://localhost:11434/v1", api_key="ollama")
response = client.chat.completions.create(
model="qwen2.5:0.5b", # a 0.5B-parameter Qwen model, about 400 MB
messages=[{"role": "user", "content": "Name three primary colours. Reply in one line."}],
temperature=0,
seed=42,
)
print(response.choices[0].message.content)
print("tokens:", response.usage.prompt_tokens, "in /", response.usage.completion_tokens, "out")Red, Yellow, Blue.
tokens: 39 in / 7 outNothing left your machine: no API key, no per-token bill, no provider data policy to review.
A 0.5B model is tiny: fine for learning the mechanics and for simple, narrow tasks, but don't judge open-weight models by it. The same code works with gpt-oss:20b or a Qwen 9B–35B model if your machine has the memory (3.4).
When does self-hosting pay?
People often assume running your own model is cheaper. Often it isn't, because hosted open-weight prices are very low and GPUs cost money even when idle. The key variable is utilization: how much of the time your GPUs are busy.
def self_host_cost_per_million(gpu_hourly_usd: float, gpus: int,
tokens_per_second: float, utilization: float) -> float:
"""USD per 1M tokens on rented GPUs. Every input here is something YOU must measure or quote."""
tokens_per_hour = tokens_per_second * 3600 * utilization
return gpu_hourly_usd * gpus / tokens_per_hour * 1_000_000
# Made-up example numbers, purely to show the shape of the calculation
api_price = 0.60 # USD per 1M tokens (blended input+output) for a hosted open-weight model
for utilization in [0.05, 0.25, 0.75]:
own = self_host_cost_per_million(gpu_hourly_usd=4.0, gpus=2,
tokens_per_second=2_500, utilization=utilization)
verdict = "cheaper to self-host" if own < api_price else "cheaper to use an API"
print(f"GPUs busy {utilization:>4.0%} of the time: ${own:6.2f} per 1M tokens -> {verdict}")GPUs busy 5% of the time: $ 17.78 per 1M tokens -> cheaper to use an API
GPUs busy 25% of the time: $ 3.56 per 1M tokens -> cheaper to use an API
GPUs busy 75% of the time: $ 1.19 per 1M tokens -> cheaper to use an APIWith these (invented) numbers, the API wins even at 75% utilization, and that's before counting engineering time, monitoring and on-call. Your real numbers depend on the model, GPU type, batch sizes and prompt lengths, so measure them. The usual reasons to self-host are control (data, availability, versions) and customization, with cost a benefit only at high, steady volume. Module 11C covers serving, quantization and GPU sizing properly.
Part 6: Pricing#
LLM pricing looks simple ("$2 per million tokens") but has many moving parts. Get them wrong and your cost estimate can be off by 10× in either direction. Everything here is about structure, which changes slowly. The example prices are a dated snapshot (November 2026) to make the structure concrete.
6.1 The unit: per million tokens#
Prices are quoted in USD per million tokens (written /MTok, /1M or per 1M tokens). A token is roughly ¾ of an English word on OpenAI's tokenizer (lesson 02), so a million tokens is roughly 750,000 English words, about ten novels. On Claude's current tokenizer it's about 555,000 words, because the same text takes roughly 30 to 35% more tokens than on older Claude tokenizers (lesson 02, 7.1).
- $2 / MTok input means each input token costs $0.000002.
- OpenRouter's catalogue writes the same price per token, as the string
"0.000002"(4.9). - Cost of a request = (input tokens × input price + output tokens × output price) ÷ 1,000,000, plus the adjustments in the rest of this part.
6.2 Input vs output#
Output tokens cost more than input tokens, typically 2 to 8 times more (occasionally more; 5× is common). As of November 2026: GPT-6 Astra $10 in vs $50 out (5×), Claude Sonnet 5.5 $2 vs $10 (5×), Gemini 3.5 Flash-Lite $0.30 vs $2.50 (8.3×), Grok 4.7 $2 vs $6 (3×), Grok 4.3 $1.25 vs $2.50 (2×).
Why: the model processes all your input tokens together in one parallel pass (the prefill), but it generates output one token at a time, with a full forward pass for each (lesson 05). Output is slower and uses GPU time less efficiently, so it's priced higher.
What this means for you: the input/output ratio of your workload decides which model is cheapest. A RAG app that reads 20,000 tokens and answers in 200 is input-dominated. A code generator that reads 500 and writes 5,000 is output-dominated. Always cost a realistic request, not a price tag (6.13).
6.3 Cached input#
Most applications send the same long prefix (system prompt, tool definitions, documents) with every request. Prompt caching lets the provider reuse its processing of that prefix (lesson 07, 7.2 explains the mechanism), and cached input tokens are billed at a steep discount.
When you read a pricing page, the thing to notice is that cache reads and cache writes are separate line items, priced differently from normal input. A read costs a fraction of the input price: as of November 2026, 10% on most models, and less on some, such as Gemini 4 Carbon and Argon ($0.10 per MTok against $2.00 input, so 5%) compared with Gemini 3.8 Flash ($0.075 against $0.75, 10%). A write can cost more than normal input (1.25× or 2× on Anthropic, 1.25× or 2.5× on OpenAI's GPT-5.6 and later), and Google's explicit caches also charge for storage per hour (for example $0.50 per MTok per hour on 3.8 Flash). So a cost model needs three input prices, not one. Lesson 07, 7.3 has the module's single per-provider table of triggers, read and write prices, lifetimes and usage fields, and lesson 07, 7.4 shows how to structure prompts so the cache actually hits. Using caching well in production is Module 04 and Module 11B.
6.4 Reasoning tokens#
A reasoning model's hidden thinking tokens are billed as output tokens, at the output price, even when you never see them (lesson 08, 5.1). Google's pricing page states this explicitly ("Output price (including thinking tokens)"), and OpenRouter's catalogue has an internal_reasoning price field for it.
This is the biggest source of surprise bills. A request with 300 visible output tokens might generate 2,000 thinking tokens first, making it 7× more expensive than its answer length suggests (6.13 shows the effect, and lesson 08, 5.1 has a calculator across effort levels). Reasoning effort is therefore a cost knob as well as a quality knob. Your API response's usage object reports reasoning tokens, so measure them on real traffic.
6.5 Service tiers: batch, flex, standard, priority#
Providers sell the same model at different prices depending on how urgently you need the answer:
| Tier | What you trade | Typical price | Available from (November 2026) |
|---|---|---|---|
| Batch | Submit many requests as a job; results come back asynchronously, typically within 24 hours | 50% off input and output | OpenAI, Anthropic, Google, and OpenRouter's own Batch API (its models with a :batch catalogue entry; you send the plain model ID and OpenRouter resolves the entry; lesson 03.9, Part 10) |
| Flex | Synchronous requests at lower priority; slower and may be throttled when busy | Same as batch on OpenAI and Gemini | OpenAI, Google; :floor on OpenRouter includes flex endpoints |
| Standard | The default | List price | Everyone |
| Priority / fast | Faster or more reliable serving | About 1.8× (Gemini Priority), 2× (OpenAI Fast; Anthropic fast mode: $8 / $40 on Opus 5.5 and $16 / $80 on Fable 5.2), 6× (OpenAI Ultrafast, on Astra and 6.1 Sol only) | OpenAI, Anthropic, Google |
Batch discounts usually stack with caching, so a batch job with a cached prefix can cost a small fraction of the standard price. Anthropic additionally sells a committed-capacity Priority Tier for guaranteed throughput. Discounts and premiums don't always combine: Anthropic's fast mode isn't available through its Batch API, and its other price modifiers (cache multipliers, data-residency multipliers) apply on top of fast-mode prices.
6.6 Long-context surcharges#
Some models charge more per token once a prompt passes a threshold (as of November 2026):
| Model | Threshold | What changes |
|---|---|---|
| OpenAI GPT-6 and GPT-5.6 series (and some earlier models) | Over 272K input tokens | Higher rates for the whole request (GPT-6 Astra: $20 in / $75 out instead of $10 / $50) |
| Claude Haiku 5.5 | Over 100K prompt tokens | $0.50 / $2.50 instead of $0.10 / $0.50, for the whole request, cache reads included |
Google Gemini 3.1 Pro (gemini-3.1-pro-preview) |
Over 200K prompt tokens | $4 / $18 instead of $2 / $12. Gemini 4 Carbon, Argon and 3.8 Flash have no long-context tier |
| xAI Grok 4.x | 200K prompt tokens and above | Double the input, cached and output rates |
| Other current Claude models | None | Anthropic bills the full 1M window at standard rates ("a 900k-token request is billed at the same per-token rate as a 9k-token request") |
On OpenRouter, the model list's pricing.overrides field describes these tiers, for example {"min_prompt_tokens": 272000, "prompt": "0.00002", ...} on openai/gpt-6-astra.
Thresholds usually apply to the whole request once crossed, not only to the tokens above the line. Check whether your largest requests sit just over a threshold. Trimming a few thousand tokens can halve their cost.
6.7 Regional and data-residency uplifts#
Guaranteeing that inference happens in a particular region usually costs extra (as of November 2026):
- OpenAI: regional processing (data residency) endpoints carry a 10% uplift for eligible models released on or after 5 March 2026.
- Anthropic: setting
inference_geo: "us"applies a 1.1× multiplier to all token prices on Claude 4.6 and later models (on Haiku 5.5 that includes its higher over-100K-token rates). The default,"global", uses standard pricing. - Cloud platforms: regional endpoints on Bedrock and Google Cloud cost about 10% more than global endpoints for Claude models; the
google-vertex/usendpoint in 5.4 shows the same 10% for Gemini.
6.8 Price changes and introductory pricing#
Prices change, in both directions, and are sometimes announced with an end date:
- Google lists Gemini 4 Carbon and Argon at $2 / $10 "through Nov 30, 2026", rising to $4 / $20 on 1 December 2026, and Gemini 3.8 Flash at $0.75 / $3.75 through 31 December 2026, then $1.50 / $7.50.
- Anthropic launched Claude Sonnet 5 with introductory pricing, then made it the standard price and cancelled a planned increase.
- New generations are often cheaper than the ones they replace: Claude Haiku 5.5 costs a tenth of Claude Haiku 4.5's price.
What this means for you: never hard-code prices in your application as if they were permanent. Keep them in configuration, date them, and re-check them when you budget. That's why the cost function in 6.13 takes prices as parameters.
6.9 Tokenizers change the real price#
Price per token only compares like with like if the models count tokens the same way, and they don't. Different tokenizers split the same text into different numbers of tokens (lesson 02). Even one provider can change: Anthropic notes that Claude 4.7 and later models use a newer tokenizer that "produces approximately 30% more tokens for the same text" (compared with older Claude models).
What this means for you: compare cost per task (or per document, per conversation), measured with each model's own token counts, not price per million tokens.
6.10 Images, audio, video and tools#
At overview level (details in Module 09):
| Item | How it's usually billed | Examples (November 2026) |
|---|---|---|
| Image input | Converted to tokens (depends on resolution), billed at the input rate | All major providers |
| Audio input | Per token (often at a separate audio rate) or per minute | Gemini 3.5 Flash-Lite: audio at the same $0.30 as text; gpt-transcribe: $0.0045 per minute |
| Speech output (TTS) | Per million characters, or per audio token | OpenAI's older tts-1 models: $15 per 1M characters (deprecated, with removal scheduled for January 2027); gemini-3.8-flash-tts is a current per-token alternative |
| Realtime voice | Per audio token, or per minute | gpt-realtime-2.1: $32 / $64 per MTok of audio in / out (-mini: $10 / $20); GPT-Live: $0.05 per minute |
| Image generation | Per image, or per image token | gpt-image-2 and both GPT-Image-2.5 models: $30 per MTok of image output; Grok Imagine: $0.02–$0.04 per image |
| Video generation | Per second of video | Grok Imagine video: $0.02–$0.08 per second |
| Server-side tools | Per call, plus the tokens the tool adds to context | Web search: $10 per 1,000 searches (OpenAI, Anthropic); Gemini grounding with Google Search: 5,000 free per month across Gemini 3+ models, then $14 per 1,000 |
| Storage | Per GB per day, or per token per hour | OpenAI file search: $0.10 per GB per day after 1 GB free; Gemini explicit cache storage per hour |
6.11 Free tiers and what they cost you#
"Free" usually has a price in data or limits:
- Gemini API free tier (on Flash and Flash-Lite models): Google's terms say free-tier content is used to improve its products and that human reviewers may read, annotate and process API inputs and outputs; on the paid tier neither happens. (For users in the EEA, Switzerland and the UK, the paid-tier data terms apply to all usage.) Gemini 4 Argon has no free tier.
- OpenAI and Anthropic (as of November 2026): OpenAI's rate-limit guide lists a Free usage tier (available in allowed countries, with a $100 monthly usage limit) but doesn't say which models it covers, so check your organization's Limits page. Anthropic has no standing free tier; its pricing FAQ says "New users receive a small amount of free credits to test the API", and new organizations may start in a low-limit Evaluation tier. Details and links: lesson 03.1, 3.1.
- OpenRouter
:freemodels: 50 requests per day (1,000 after buying $10 of credits), and the underlying host may have its own data terms. - Credits for new accounts come and go. Treat them as a trial.
Free tiers are great for learning. Never put customer or confidential data through a tier whose terms allow training on it (Part 9).
6.12 How to read a pricing page#
Work through this checklist for each candidate model:
- Base rates: input and output per MTok, on the standard tier.
- Cached input: read price, write price (if any), cache lifetime, storage fees, minimum cacheable length.
- Reasoning: confirm thinking tokens are billed as output, and find the default effort.
- Thresholds: long-context surcharges and whether they apply to the whole request.
- Tiers: batch, flex and priority prices, and whether discounts stack.
- Region: residency or regional-endpoint uplifts.
- Modalities and tools: image, audio and tool-call prices if you use them.
- Dates: introductory prices with end dates, and announced changes.
- Route: whether the price differs on the cloud platform or gateway you'll actually use.
- Footnotes. The exceptions live there.
6.13 Try it: a cost model with prices as parameters#
This function estimates a monthly bill. Prices are inputs, never constants, and every lever from this part is a parameter:
# Save this file as s3_cost.py: the next sample imports from it.
from dataclasses import dataclass
@dataclass
class Prices:
"""USD per 1M tokens. Copy these from the provider's pricing page on the day you decide."""
input: float
output: float # reasoning/thinking tokens are billed at this rate too
cached_input: float # price of an input token read from the prompt cache
batch_discount: float = 0.5 # Batch APIs are typically 50% off; set 0 if unavailable
@dataclass
class Workload:
requests_per_day: int
input_tokens: int # per request, including system prompt and history
output_tokens: int # visible answer tokens per request
reasoning_tokens: int = 0 # hidden thinking tokens per request (billed as output)
cached_fraction: float = 0.0 # share of input tokens served from the cache
use_batch: bool = False
def monthly_cost(p: Prices, w: Workload, days: int = 30) -> float:
cached = w.input_tokens * w.cached_fraction
fresh = w.input_tokens - cached
per_request = (
fresh * p.input
+ cached * p.cached_input
+ (w.output_tokens + w.reasoning_tokens) * p.output
) / 1_000_000
if w.use_batch:
per_request *= 1 - p.batch_discount
return per_request * w.requests_per_day * days
if __name__ == "__main__":
# List prices copied from official pricing pages, November 2026 (standard tier, short prompts).
# They WILL change: re-check before you rely on them. Module 03 keeps the same figures in
# prices.yaml (03.7, Part 4), verified on 2026-11-04.
snapshot = {
"claude-haiku-5-5": Prices(input=0.10, output=0.50, cached_input=0.01),
"claude-sonnet-5-5": Prices(input=2.00, output=10.00, cached_input=0.10),
"claude-opus-5-5": Prices(input=4.00, output=20.00, cached_input=0.20),
"gpt-6-luna": Prices(input=0.10, output=0.50, cached_input=0.01),
"gpt-6.1-sol": Prices(input=2.00, output=10.00, cached_input=0.10),
"gemini-3.8-flash": Prices(input=0.75, output=3.75, cached_input=0.075),
}
support_bot = Workload(requests_per_day=20_000, input_tokens=4_000, output_tokens=300)
print("Support bot, 20k requests/day, 4,000 in / 300 out:")
for name, p in snapshot.items():
print(f" {name:18s} ${monthly_cost(p, support_bot):>10,.2f} / month")
# The same bot with levers pulled: 75% of the prompt is a cached system prompt
cached_bot = Workload(20_000, 4_000, 300, cached_fraction=0.75)
# A reasoning-heavy variant: 2,000 hidden thinking tokens per request
thinking_bot = Workload(20_000, 4_000, 300, reasoning_tokens=2_000)
# An overnight job that can wait: batch API
batch_job = Workload(20_000, 4_000, 300, use_batch=True)
p = snapshot["claude-sonnet-5-5"]
print("\nclaude-sonnet-5-5 with different levers:")
for label, w in [("baseline", support_bot), ("75% cached", cached_bot),
("+2k reasoning", thinking_bot), ("batch", batch_job)]:
print(f" {label:14s} ${monthly_cost(p, w):>10,.2f} / month")Support bot, 20k requests/day, 4,000 in / 300 out:
claude-haiku-5-5 $ 330.00 / month
claude-sonnet-5-5 $ 6,600.00 / month
claude-opus-5-5 $ 13,200.00 / month
gpt-6-luna $ 330.00 / month
gpt-6.1-sol $ 6,600.00 / month
gemini-3.8-flash $ 2,475.00 / month
claude-sonnet-5-5 with different levers:
baseline $ 6,600.00 / month
75% cached $ 3,180.00 / month
+2k reasoning $ 18,600.00 / month
batch $ 3,300.00 / monthRead the numbers:
- Tier choice dominates. The same workload costs $330 or $13,200 a month: a 40× spread. If the small tier passes your evaluation, that's the saving.
- Caching halves it. A cached system prompt cut the Sonnet bill from $6,600 to $3,180.
- Thinking nearly triples it. 2,000 hidden reasoning tokens per request took the bill from $6,600 to $18,600, which is why reasoning effort needs evaluating, not maximizing.
- Batch halves it, if the work can wait.
The model ignores some real-world details (the cache write surcharges, long-context thresholds, regional uplifts, retries and failed requests), and it uses one fixed request size. Extend it for your case, and replace guessed token counts with numbers measured from real traffic as soon as you have them.
You can feed the same function live prices instead of copied ones, using the OpenRouter catalogue. Save the previous sample as s3_cost.py in the same folder first, so the import works:
import httpx
from s3_cost import Prices, Workload, monthly_cost # the functions from the previous sample
catalogue = {m["id"]: m for m in
httpx.get("https://openrouter.ai/api/v1/models", timeout=30).json()["data"]}
def prices_from_openrouter(model_id: str) -> Prices:
p = catalogue[model_id]["pricing"]
per_m = lambda key: float(p.get(key, 0)) * 1_000_000 # USD/token -> USD/1M tokens
return Prices(input=per_m("prompt"), output=per_m("completion"),
cached_input=per_m("input_cache_read") or per_m("prompt"))
shortlist = ["anthropic/claude-haiku-5.5", "openai/gpt-6-luna", "google/gemini-3.8-flash",
"deepseek/deepseek-v4.1-flash", "qwen/qwen3.8-flash", "mistralai/mistral-small-2603"]
w = Workload(requests_per_day=20_000, input_tokens=4_000, output_tokens=300, cached_fraction=0.5)
print(f"{'model':32s} {'in':>6s} {'cached':>7s} {'out':>6s} {'monthly':>10s}")
for mid in shortlist:
p = prices_from_openrouter(mid)
print(f"{mid:32s} {p.input:6.3f} {p.cached_input:7.4f} {p.output:6.2f} ${monthly_cost(p, w):>9,.2f}")model in cached out monthly
anthropic/claude-haiku-5.5 0.100 0.0100 0.50 $ 222.00
openai/gpt-6-luna 0.100 0.0100 0.50 $ 222.00
google/gemini-3.8-flash 0.825 0.0825 4.12 $ 1,831.50
deepseek/deepseek-v4.1-flash 0.045 0.0060 0.50 $ 151.20
qwen/qwen3.8-flash 0.150 0.0160 0.47 $ 283.80
mistralai/mistral-small-2603 0.150 0.0150 0.60 $ 306.00Notice that Gemini 3.8 Flash shows $0.825, not Google's $0.75 list price. As 5.4 showed, the catalogue's model-level price for this model is its US-region endpoint's price. Live data is convenient, but you still need to know what each number means.
Part 7: Model cards, system cards and benchmarks#
7.1 Model cards#
A model card is the documentation that ships with a model, a practice proposed in the 2019 paper Model Cards for Model Reporting. For open-weight models it's the README.md in the model's repository (lesson 01, 4.7). Closed providers publish equivalent pages on their documentation sites. A good model card covers:
| Section | What it tells you | Why you care |
|---|---|---|
| Overview and intended use | What the model is for, and what it isn't | Out-of-scope uses are where it fails |
| Architecture and size | Dense or MoE, total and active parameters, context length | Hardware and speed (3.4) |
| Training data and cutoff | Data sources (often vaguely), languages, knowledge cutoff | Language support, recency |
| Training procedure | Pretraining, instruction tuning, RL, reasoning training (lesson 06) | Base vs instruct vs reasoning behaviour |
| Evaluation results | Benchmark scores, usually chosen by the maker | A starting point, not a verdict (7.4) |
| Usage instructions | Chat template, recommended sampling settings, how to enable reasoning or tools, serving commands | Wrong settings make a good model look bad |
| Limitations and risks | Known weaknesses, biases, safety evaluations | What to test and guard against |
| Licence | The terms of use | Whether you can ship (3.3) |
Model metadata on the Hugging Face Hub is machine-readable, so you can check licences and sizes in code without downloading any weights:
import re
from huggingface_hub import ModelCard, model_info
for repo in ["google/gemma-4-31B-it", "meta-llama/Llama-4-Scout-17B-16E-Instruct", "openai/gpt-oss-20b"]:
info = model_info(repo) # metadata only, no weights downloaded
card = info.card_data or {}
print(f"\n== {repo}")
print("licence: ", card.get("license"), card.get("license_name") or "")
print("gated: ", info.gated) # False, or 'auto'/'manual' = must accept terms first
print("parameters:", f"{info.safetensors.total / 1e9:.1f}B" if info.safetensors else "n/a")
print("task: ", info.pipeline_tag)
print("base model:", card.get("base_model"))
# The card itself is a README: read its section headings to see what it documents
card = ModelCard.load("openai/gpt-oss-20b")
prose = re.sub(r"```.*?```", "", card.text, flags=re.S) # drop code blocks first
headings = [line for line in prose.splitlines() if line.startswith("#")]
print("\ngpt-oss-20b model card sections:", headings[:12])== google/gemma-4-31B-it
licence: apache-2.0
gated: False
parameters: 31.3B
task: image-text-to-text
base model: ['google/gemma-4-31B']
== meta-llama/Llama-4-Scout-17B-16E-Instruct
licence: other llama4
gated: manual
parameters: 108.6B
task: image-text-to-text
base model: ['meta-llama/Llama-4-Scout-17B-16E']
== openai/gpt-oss-20b
licence: apache-2.0
gated: False
parameters: 20.9B
task: text-generation
base model: Nonefollowed by:
gpt-oss-20b model card sections: ['# Highlights', '# Inference examples', '## Transformers', '## vLLM', '## PyTorch / Triton', '## Ollama', '#### LM Studio', '# Download the model', '# Reasoning levels', '# Tool use', '# Fine-tuning', '# Citation']What to notice:
license: othermeans a custom licence (here, Meta'sllama4). That's your cue to read the licence file, not just the tag.gated: manualmeans you must request access and accept terms before downloading.- Llama 4 Scout is "17B" in its name but 108.6B in total: it's a mixture-of-experts model with 17B active parameters and 16 experts (
16E). Memory follows the 108.6B (3.4). base_modelshows lineage: the-it(instruction-tuned) Gemma was built from the basegoogle/gemma-4-31B. Fine-tunes list their parent here, which helps you trace licences.- The gpt-oss card includes serving instructions for Transformers, vLLM, Ollama and LM Studio, plus sections on reasoning levels and tool use: exactly the operational details you need.
7.2 System cards#
Frontier labs also publish system cards (sometimes called model cards or technical reports) when they release a major model. They're longer documents, mostly about safety and behaviour:
| Typically includes | What it means for an engineer |
|---|---|
| Capability evaluations on standard benchmarks, often with the exact settings used | Compare like with like: note effort level, tool access and number of attempts |
| Dangerous-capability evaluations (biological, chemical, cyber, autonomous replication) | Explains access restrictions, such as verification programmes for cyber-capable models |
| Safety-framework level under the lab's policy: Anthropic's Responsible Scaling Policy, OpenAI's Preparedness Framework, Google DeepMind's Frontier Safety Framework | Explains which safeguards are applied (for example extra classifiers that may block some requests) |
| Alignment and behaviour evaluations: honesty, sycophancy, refusal rates, over-refusal | Predicts how often the model will refuse or flatter your users |
| Agentic safety: prompt-injection robustness, behaviour with tools and computer use | Critical if you build agents (Module 08A, Module 12) |
| Hallucination and factuality measurements | Sets expectations for unsupported answers (lesson 10) |
| Red-teaming results and known limitations | Tells you what to test first |
How to read one, quickly: skim the summary; find the evaluations that resemble your task and note their settings; read the limitations and the prompt-injection section; note any safeguards that might affect legitimate requests in your domain. Then verify the parts that matter to you with your own tests. A system card describes the model the lab tested, under the lab's chosen settings.
7.3 What the major benchmarks measure#
A benchmark is a fixed set of tasks with an automatic scoring method. Here are the ones you'll see in model announcements, grouped by what they test, with their status as of 2026:
| Benchmark | What it measures | Status in 2026 |
|---|---|---|
| MMLU | Multiple-choice questions across 57 academic subjects | Saturated: frontier models all score near the top; rarely reported now |
| MMLU-Pro | A harder MMLU with ten answer options and more reasoning | Near saturation for frontier models; still useful for smaller ones |
| GPQA Diamond | Graduate-level "Google-proof" science multiple choice (198 questions) | Near saturation at the frontier |
| Humanity's Last Exam (HLE) | Thousands of expert-written questions at the edge of human knowledge, across many subjects | Still discriminating; check whether tools (search, code) were allowed |
| AIME | Problems from the American Invitational Mathematics Examination (integer answers) | Saturated for frontier reasoning models; past papers are online, so contamination risk is high |
| HumanEval | 164 short Python functions to write | Saturated and widely contaminated |
| LiveCodeBench | Competitive-programming problems collected continuously, with release dates | Contamination-resistant: you can score only problems published after a model's cutoff |
| SWE-bench Verified | Fix real GitHub issues in Python repositories; the patch must pass the tests (500 human-checked tasks) | Being retired: OpenAI stopped reporting it in February 2026, citing contamination and flawed tests, and recommends SWE-bench Pro. Verified and Pro scores aren't comparable |
| SWE-bench Pro | A harder, more contamination-resistant successor with longer, multi-file tasks | One of the main coding benchmarks in 2026 |
| Terminal-Bench | Complete real tasks in a command-line environment | Widely reported; versions change (results for different versions aren't comparable) |
| τ-bench / τ²-bench (tau-bench) | Agents serving a simulated customer with tools and a policy (retail, airline, telecom); measures reliability across repeated attempts | Key benchmark for customer-facing agents |
| OSWorld | Computer-use tasks in real desktop operating systems | Main benchmark for computer-use agents |
| ARC-AGI-2 / ARC-AGI-3 | Novel visual puzzles that test learning new rules from a few examples; ARC-AGI-3 (launched 25 March 2026) uses interactive game environments and scores learning efficiency against humans | ARC-AGI-3 is far from solved |
| GDPval | Real work products from many professional occupations, graded against expert work | Signals usefulness for knowledge work |
| BrowseComp | Agentic web research: find hard-to-locate facts by browsing | Widely reported for research and search agents |
| FrontierMath | Original, very hard research-level maths problems | Far from saturated |
| IFEval | Instructions with automatically checkable constraints ("exactly three bullet points") | Instruction following; near saturation |
| SimpleQA, AA-Omniscience | Short factual questions, scoring accuracy and penalizing confident wrong answers | Hallucination tendency (lesson 10) |
| MMMU | College-level questions that require understanding images | Multimodal reasoning |
| MRCR and other long-context tests | Finding and combining information spread across very long inputs | Long-context quality (lesson 07, 5.3) |
| Multilingual MMLU variants (MMMLU, Global-MMLU) | Knowledge questions in many languages | A rough multilingual signal (4.6) |
Composite indexes combine many benchmarks into one number. Artificial Analysis's Intelligence Index v5.0 (listed as v5.0.1 on its methodology page in November 2026), for example, averages nine evaluations in four equally weighted categories (25% each: knowledge work, coding, science and general), including Terminal-Bench 4.0, HLE-Diamond and AA-Omniscience, plus suites of its own (such as AA-Briefcase, FrontierCode 2.0 and CritPt) that don't appear in the table above.
7.4 Benchmark pitfalls#
Benchmark numbers are useful signals and terrible decisions. The main ways they mislead:
| Pitfall | What happens | Defence |
|---|---|---|
| Contamination | Test questions leaked into training data, so the score measures memory, not ability: the training/test split rule from lesson 01, 6.4 broken at internet scale | Prefer dated or private benchmarks (LiveCodeBench, held-out sets); your own data |
| Saturation | Everyone scores 90%+, so small differences are noise | Ignore saturated benchmarks for frontier comparisons |
| Benchmark-maxxing (Goodhart's law: "when a measure becomes a target, it ceases to be a good measure") | Models are tuned to score well on popular benchmarks, sometimes at the expense of general behaviour | Look for consistency across many benchmarks and your own tests |
| Different settings | Scores depend on reasoning effort, tool access, number of attempts (pass@1 vs pass@k, where pass@k means solved in at least one of k attempts), agent scaffold, prompt format and time limits | Compare only results run under the same harness and settings |
| Self-reported and cherry-picked | Labs choose which benchmarks to show, and run them themselves | Prefer independent evaluations; note what's missing |
| Version confusion | "Terminal-Bench" results from different versions, or "SWE-bench" vs "SWE-bench Verified" vs "Pro", get compared | Check the exact benchmark name and version |
| Noise | Small benchmarks have wide error bars; reruns vary | Treat differences of a few points as ties |
| Flawed or mis-graded items | The benchmark itself is wrong: tests that reject correct answers, or ambiguous questions. OpenAI's February 2026 audit of SWE-bench Verified found that at least 59.4% of the hard problems it audited had tests rejecting functionally correct solutions, and that frontier models could reproduce the original fixes (contamination) | Read published audits of the benchmarks you rely on, successors included, and spot-check failed items yourself |
| Task mismatch | The benchmark isn't your task. A coding benchmark says little about a Hindi customer-support bot | Build an eval from your own task (7.6) |
| Different serving | A benchmark run on the lab's full-precision model doesn't describe a host serving it at FP4 (5.4) | Test the exact endpoint you'll use |
7.5 Leaderboards#
Leaderboards aggregate results across models. The two you'll hear about most (as of October 2026):
Arena (at arena.ai; formerly LMArena, and before that Chatbot Arena, which started at LMSYS in 2023). Users type a prompt, see two anonymous answers side by side, and vote for the better one. Votes are turned into ratings with the Bradley–Terry model, a statistical model of pairwise comparisons similar to the Elo ratings used in chess. There are separate boards for text, coding, vision, search, image, video and more, and a "style control" adjustment, the default since 2025, reduces the advantage of longer, more heavily formatted answers.
- ✅ Measures what real people prefer, on prompts nobody can train on in advance.
- ⚠️ Preference isn't correctness: confident, well-formatted answers win votes even when wrong. The prompts are mostly short chats, not your workload. Labs can test many private variants before release, a practice criticized in the 2025 paper The Leaderboard Illusion.
Artificial Analysis runs standardized evaluations itself, under identical conditions (its methodology page says "All models are evaluated under identical conditions"), and publishes the Intelligence Index alongside measured speed and price for each model and host.
- ✅ Independent, consistent settings, and it puts quality next to cost and speed, which is how you actually choose.
- ⚠️ A composite index embeds someone else's weighting of what matters. It's still not your task.
You'll also see usage rankings, such as OpenRouter's, which show which models developers are spending the most tokens on. Popularity is a useful signal of what works for many people, and a poor signal of what works for you.
7.6 Why your own evals win#
Every pitfall above has the same cure: measure the candidate models on your own task, with your own data, under your own settings. This is the core discipline of AI engineering, and Module 10A teaches it properly. The minimum version for choosing a model:
- Collect 30–100 real examples of your task (real user questions, real documents), including the hard and weird ones.
- Define what "good" means for each: an exact expected answer, a checklist, a JSON schema, or a rubric for a human or an LLM judge.
- Run every shortlisted model with the same prompt (and with any per-model prompt adjustments you'd really ship).
- Record quality, cost per task and latency together, not just quality.
- Read the failures, not just the scores. Two models with the same score can fail in very different, more or less acceptable ways.
- Keep the set. It becomes your regression test when you change prompts, upgrade models or switch providers (Part 8).
Part 8: Versioning and lifecycle#
Reference
8.1 Aliases vs snapshots#
A snapshot is one frozen model version: the same weights every time you call it. An alias is a name that points to a snapshot and can be moved to a newer one. Providers handle this differently (as of October 2026):
| Provider | How IDs work |
|---|---|
| Anthropic | Since the Claude 4.6 generation, IDs are dateless (claude-sonnet-5-5) and each ID is itself a pinned snapshot. Anthropic's docs: the dateless ID "maps to a single, fixed model snapshot... When an updated version is available, it ships under a new model ID." Older models had dated IDs (claude-sonnet-4-5-20250929) plus convenience aliases (claude-sonnet-4-5) that resolve to the latest dated snapshot |
| OpenAI | Plain names are aliases for dated snapshots (OpenAI's deprecations page pairs, for example, gpt-5 with gpt-5-2025-08-07). Each model page lists its snapshots; for GPT-6 Luna, gpt-6-luna is currently the only one. chat-latest is a pure alias: it "points to the latest Instant model currently used in ChatGPT", is "regularly updated", and has no pinned snapshot, so OpenAI recommends against it for production |
| Google Gemini | Each model is labelled stable ("usually don't change"), preview ("may be used for production"), latest ("points to the latest release for a specific model variation") or experimental ("not suitable for production use"). A latest alias such as gemini-flash-latest is hot-swapped with every new release, with 2 weeks' email notice before a breaking change (8.2) |
| xAI | <modelname> points to the latest stable version, <modelname>-latest to the newest version, and <modelname>-<date> (for example grok-4.20-0309-reasoning) to a fixed release. xAI suggests the aliases for most users; pin the dated form in production |
| OpenRouter | vendor/model IDs plus a canonical_slug with a date (for example anthropic/claude-sonnet-5.5-20260928). Floating aliases start with ~ (~anthropic/claude-sonnet-latest, ~openai/gpt-luna-latest) and carry an alias_target showing where they currently point |
Aliases are convenient for prototypes and dangerous in production: the model behind your feature can change without a code change, and with it your outputs, costs and failure modes.
8.2 Lifecycle stages and notice periods#
flowchart LR
P["Preview / experimental<br/>may change or vanish quickly"] --> G["Active (GA)<br/>supported, recommended"]
G --> L["Legacy<br/>no more updates"]
L --> D["Deprecated<br/>works, retirement date announced"]
G --> D
D --> R["Retired / shut down<br/>requests fail"]Anthropic defines the stages as Active ("fully supported and recommended"), Legacy ("will no longer receive updates"), Deprecated ("still functional but no longer recommended", with a retirement date) and Retired ("Requests to retired models fail"). OpenAI uses "deprecation" for the retirement process and "shutdown" or "sunset" for the end.
Published notice periods (as of October 2026):
| Provider | Notice before retirement |
|---|---|
| OpenAI | At least 6 months for generally available models; at least 3 months for specialized variants (chat, Codex, deep research); preview models "may be retired with much shorter notice, such as 2 weeks" |
| Anthropic | "At least 60 days' notice before model retirement for publicly released models", by email and in the docs. Current models list a commitment of "not sooner than" a date about a year after launch (for example Claude Sonnet 5.5: not sooner than 28 September 2027) |
| Google Gemini | Preview models are deprecated with "at least 2 weeks notice"; a latest alias gets 2 weeks' email notice before a breaking change; experimental models are "not stable" and their availability is "subject to change". Dates are published on the models and deprecation pages. For example, Google's deprecations page says that from 1 December 2026 requests to gemini-2.5-pro will automatically route to gemini-3.8-flash and requests to gemini-2.5-flash to gemini-3.5-flash-lite, billed at the new model's rates (the changelog of 2 November 2026 warns of breaking changes, such as thinking_level replacing thinking_budget), while gemini-2.5-flash-lite is "not deprecated and remains available through the API until further notice" (checked 11 November 2026) |
| Cloud platforms | Set their own schedules, which can differ from the model maker's |
| OpenRouter | Models scheduled for removal carry an expiration_date in the catalogue |
Recent examples show the pace: on 14 October 2026, OpenAI announced shutdowns of several GPT-4o and GPT-4.1 snapshots for 14 January 2027, recommending gpt-6-luna as the replacement. On 30 September 2026, Anthropic announced that claude-sonnet-4-5-20250929 retires on 30 November 2026, recommending claude-sonnet-5-5.
8.3 Pinning in production#
Good practice, in order:
- Pin an exact snapshot ID for every production feature. Never ship a floating alias such as
-latestor~...-latest. - Keep model IDs in configuration, not scattered through code, with the provider, route and settings (effort level, max tokens) alongside each one.
- Record the model ID with every logged request, so you can tell which model produced which output.
- Subscribe to deprecation notices (provider emails, changelogs, deprecations pages) and audit usage (Anthropic's console, for example, can export usage by model and API key).
- Check lifecycles automatically in CI or a scheduled job (try it below).
- Migrate deliberately: run your eval set on the replacement, adjust prompts, ship to a small share of traffic (a canary), compare, then switch. Start well before the retirement date.
- Pin the host too on gateways when quality matters (OpenRouter's
provider.orderwithallow_fallbacks: false, or aquantizationsfilter).
Try it: a lifecycle check for your configured models
import datetime as dt
import httpx
# The model IDs your app is configured to use (normally loaded from a config file)
PINNED = {
"chat_primary": "anthropic/claude-sonnet-5.5",
"chat_fallback": "~anthropic/claude-sonnet-latest",
"classifier": "meta-llama/llama-3.1-70b-instruct",
"summarizer": "z-ai/glm-4.5",
"legacy_feature": "openai/gpt-4-32k",
}
catalogue = {m["id"]: m for m in
httpx.get("https://openrouter.ai/api/v1/models", timeout=30).json()["data"]}
today = dt.date(2026, 10, 30) # fixed so the output is reproducible; use dt.date.today() in CI
for role, model_id in PINNED.items():
m = catalogue.get(model_id)
if m is None:
print(f"❌ {role:15s} {model_id}: not in the catalogue (retired or renamed?)")
continue
if m.get("alias_target"):
print(f"⚠️ {role:15s} {model_id}: floating alias, currently -> {m['alias_target']['slug']}")
continue
expires = m.get("expiration_date")
if expires:
days = (dt.date.fromisoformat(expires) - today).days
print(f"⚠️ {role:15s} {model_id}: expires {expires} ({days} days left)")
else:
print(f"✅ {role:15s} {model_id}: pinned, no expiration announced")✅ chat_primary anthropic/claude-sonnet-5.5: pinned, no expiration announced
⚠️ chat_fallback ~anthropic/claude-sonnet-latest: floating alias, currently -> anthropic/claude-sonnet-5.5
⚠️ classifier meta-llama/llama-3.1-70b-instruct: expires 2026-11-03 (4 days left)
⚠️ summarizer z-ai/glm-4.5: expires 2026-12-31 (62 days left)
❌ legacy_feature openai/gpt-4-32k: not in the catalogue (retired or renamed?)Five configured models, four problems: a floating alias in production, a model leaving the gateway in four days, another in two months, and one already gone. This is the kind of check worth running every day in CI. For models you call directly, do the same with the providers' Models APIs: OpenAI's shutdown_date, and Anthropic's lifecycle and retires_at (4.10).
Part 9: Data privacy and compliance#
Every prompt you send contains data: your users' messages, your documents, sometimes personal or regulated information. Before a model goes into production, you need clear answers about what happens to that data. This part is an overview. Security and safety engineering is Module 12, and none of this is legal advice: involve your legal, security and compliance teams.
9.1 The questions to ask#
| Question | What to look for |
|---|---|
| Is my data used to train models? | Default for API traffic, and whether any setting or tier changes it |
| How long is it retained, and why? | Abuse-monitoring logs, stored conversation state, files, caches, batch inputs |
| Is zero data retention (ZDR) available? | Who qualifies, which endpoints and features are covered, which aren't |
| Where is it processed and stored? | Regions for inference and for data at rest; global vs regional routing |
| Who are the processors? | The provider, a cloud platform, a gateway and its downstream hosts, sub-processors |
| What contracts and certifications exist? | Data processing agreement (DPA), enterprise agreement, SOC 2 and ISO 27001 reports, HIPAA Business Associate Agreement (BAA), regional regulations such as the GDPR |
| Which product am I using? | API terms differ from consumer chat-app terms, even from the same company |
9.2 Provider snapshot#
As of October 2026, from each provider's official documentation (the Anthropic row's list of Covered Models was updated for Fable 5.2 in November):
| Provider | Training on API data | Retention | Zero data retention | Residency |
|---|---|---|---|---|
| OpenAI | Not used to train or improve models unless you explicitly opt in | Abuse-monitoring logs "retained for up to 30 days" by default; some features store data (for example stored responses, files, vector stores) | ZDR and Modified Abuse Monitoring, both "subject to prior approval by OpenAI". Several endpoints aren't ZDR-eligible (including Files, Batches, Assistants, vector stores, fine-tuning and Evals) | Regional storage in many regions (US, Europe, UK, Japan, India, Australia, Canada, Singapore, South Korea, UAE); regional processing in the US, Europe and UAE; non-US regions need approval |
| Anthropic | "Retained data is never used for model training without your express permission" | Prompts and outputs "not retained by default", except for Covered Models (Fable 5.2, 5.1 and 5, and Mythos 5.2, 5.1 and 5), which require 30-day retention. Under any arrangement, content flagged by trust-and-safety systems may be kept for up to 2 years, and data under legal hold as required | ZDR by arrangement with Anthropic's sales team, enabled per organization; not available for Covered Models unless expressly authorized, and not for some features (for example the code execution tool). HIPAA readiness with a signed BAA, which most organizations can enable self-serve in the Claude Console with Anthropic's standard BAA | inference_geo: "us" keeps inference in the US (1.1× price); workspace data at rest currently US only |
| Provider | Training on API data | Retention | Zero data retention | Residency |
|---|---|---|---|---|
| Google (Gemini API) | Unpaid tier: used to improve Google's products, and human reviewers may read inputs and outputs. Paid tier: not used. In the EEA, Switzerland and the UK, the paid-tier terms apply to all usage | Paid: prompts and responses logged "for a limited period of time" to detect policy violations; Grounding with Google Search stores prompts and outputs for 30 days | Through Gemini Enterprise Agent Platform (Google Cloud) enterprise controls | Through Google Cloud regions on Agent Platform; the Gemini API's terms say logged data may be stored or cached in any country where Google has facilities |
| OpenRouter | Routes by default only to providers that don't log or train on prompts, unless you switch on the model-training toggle in your privacy settings | Prompts and completions not logged unless you opt in; request metadata is logged | zdr: true routes only to zero-data-retention endpoints; data_collection: "deny" excludes hosts that store or train on data |
In-region routing through the eu.openrouter.ai / us.openrouter.ai base URLs (Business and Enterprise plans), or by restricting routing to region-specific endpoints (for example google-vertex/us-east5) with provider.only. The catalogue's region filter only narrows the model listing; it doesn't control where your request runs |
| Self-hosted | Your choice | Your choice | Your choice | Wherever you run it |
9.3 Cloud platforms and gateways change the processor#
When you call a model through a cloud platform, the cloud provider is usually the data processor, under your existing cloud agreement. Anthropic's docs state that on Amazon Bedrock and the Google-managed Claude offering, "the cloud provider is the data processor", while on Claude Platform on AWS, Microsoft Foundry and the Anthropic-managed Google Cloud offering, Anthropic is. Many enterprises choose cloud platforms precisely because their data-protection reviews already cover that cloud.
A gateway adds a party to the chain: your data goes to the gateway, then to whichever host serves the model. Your compliance review must cover both, and you should restrict routing to hosts whose terms you've accepted (5.4).
9.4 Consumer apps vs APIs#
The chat apps (ChatGPT, Claude.ai, the Gemini app) have different terms from the developer APIs. Depending on the plan and the user's settings, consumer conversations may be used for training. Anthropic's data page notes, for example, that its consumer Free, Pro, Max and Ultra plans aren't covered by API ZDR arrangements.
What this means for you: don't paste customer data, credentials or confidential code into a consumer chat app to "quickly test" something. Use the API, or an enterprise plan your company has approved.
9.5 Practical defaults#
- Use paid API tiers for anything beyond public test data.
- Send the minimum data needed: strip or mask personal data before it reaches the model where you can (Module 12).
- Choose the region before you launch, since moving later is painful.
- For regulated data (health, finance, government), start from the provider's enterprise and compliance offerings (BAA, ZDR, regional processing) or self-hosted open weights.
- Keep a record of which provider, route, model and data policy each feature uses. Auditors will ask.
9.6 Contracts, terms and regulation#
Privacy isn't the only legal question in model selection. At overview level, four more belong on your checklist (check each with your legal team; Module 12 goes further):
- Output-use restrictions. The major API providers' terms forbid using their outputs to develop competing models, which matters if you plan to distil or fine-tune on generated data. Open-weight licences vary (3.3). On OpenRouter,
provider.enforce_distillable_text: truerestricts routing to models whose authors have explicitly enabled text distillation. - IP and copyright indemnity. Several major providers have offered business customers indemnity against copyright claims over generated output (OpenAI's "Copyright Shield", for example, and indemnities in Anthropic's and Google Cloud's commercial terms), usually with conditions such as not disabling safety features. Check the current terms for your plan; it's a real procurement criterion.
- Regulation. The EU AI Act's obligations for providers of general-purpose AI models have applied since 2 August 2025, and further obligations fall on organizations that deploy AI systems, depending on the use case's risk level. The transparency duties for AI-generated content apply from 2 August 2026 (9.7); the EU's "AI Omnibus" amendment (Regulation (EU) 2026/1744, in force since 27 July 2026 per the European Commission's AI Act page) moved the high-risk deadlines to 2 December 2027 for Annex III systems and 2 August 2028 for systems embedded in regulated products, so check the Commission's current AI Act pages for the date that applies to you (Module 12, lesson 9 has the detail). Your compliance team may need documentation from the model provider. Sector rules (health, finance) and data-protection law such as the GDPR apply on top.
- Country availability. Providers publish lists of supported countries and regions. Check that every market you serve (and every country your team works from) is covered before you commit.
9.7 Marking AI-generated content: watermarking and provenance#
The questions so far run one way: what happens to the data you send. A newer set runs the other way: how can anyone tell that what you publish was made by a model? Providers increasingly mark generated media, for reasons of user trust and regulation.
- Watermarking. Google DeepMind's SynthID embeds an imperceptible watermark in AI-generated images, audio, video and text. It is built into Google's consumer products, and the text variant is open-sourced as a "logits processor" you can add to your own generation pipeline. OpenAI has announced that it is adding SynthID watermarking to generated images through a partnership with Google. Watermarking is probabilistic: it is designed to survive cropping, compression and format changes, but detection rates depend on how much the content was transformed, and a detected watermark is evidence, not proof — it can't tell you a text wasn't AI-written.
- Provenance metadata. The C2PA "Content Credentials" standard attaches cryptographically signed metadata to a file recording how it was created and edited. OpenAI has attached Content Credentials to generated images since 2024 and is a C2PA-conforming generator; Google is a C2PA steering member and embeds credentials in products ranging from Pixel cameras to its generative tools. Unlike a watermark inside the content itself, credentials are metadata that uploads, edits and format conversions can strip — which is why the two approaches complement each other.
- The regulatory pull. The EU AI Act's transparency obligations (Article 50) took effect on 2 August 2026: providers of generative AI systems must mark synthetic audio, image, video and text with effective, machine-readable marks that are detectable as AI-generated, and deployers must visibly label deepfakes and unreviewed AI text on matters of public interest. Systems placed on the market before that date have a grace period running to December 2026. Which marks are acceptable, and which outputs are exempt (for example machine-to-machine content and standard editing assistance), differs by modality and use case.
For an engineer the practical rules are: don't strip provenance signals when you post-process, re-encode or re-host generated media; expect labelling duties if you publish AI-generated content publicly; and treat the detail of detection, appeals and record-keeping as Module 12's territory. Each provider's coverage and policy is still evolving — as of November 2026, check their current documentation before relying on any of it.
Part 10: Choosing a model#
10.1 The decision framework#
flowchart TB
s1["1. Task requirements<br/>quality bar, modalities, context,<br/>tools, structured output, languages"] --> s2["2. Hard constraints<br/>budget, latency, data residency,<br/>retention, licence, deployment"]
s2 --> s3["3. Shortlist 3-5 models<br/>across tiers and providers"]
s3 --> s4["4. Evaluate on YOUR data<br/>quality, cost per task, latency"]
s4 --> s5["5. Pick a primary<br/>and a fallback from another provider"]
s5 --> s6["6. Pin versions, monitor,<br/>re-evaluate on new releases"]
s6 -. "new model or price change" .-> s310.2 The steps in detail#
Step 1: Task requirements. Write down what the feature must do, concretely:
- What does a good output look like? What's an unacceptable one? (This becomes your eval rubric.)
- Which modalities go in and come out?
- How much context per request (system prompt + history + documents), and how long are the outputs?
- Does it need tool calling, structured output, reasoning?
- Which languages?
- How hard is it, honestly? Classification and extraction are easy for small models; multi-step agentic work isn't.
Step 2: Hard constraints. These eliminate models outright, before any quality comparison:
- Budget: maximum cost per request or per month at expected volume (6.13).
- Latency: maximum time to first token or total response time.
- Data: residency, retention, ZDR, training-use and certification requirements (Part 9).
- Deployment: must it run on your own infrastructure, on a particular cloud, or offline?
- Licence: for open weights, is your use allowed (3.3)?
- Lifecycle: avoid preview models and models already deprecated.
- Terms: output-use restrictions, IP indemnity, supported countries and regulatory obligations (9.6).
Step 3: Shortlist. Pick 3–5 candidates that pass the constraints. Include at least two tiers (to find out whether a cheaper one is good enough) and at least two providers (so you have a fallback). Use catalogues, leaderboards and colleagues' experience here, and only here.
Step 4: Evaluate on your data (7.6). Measure quality, cost per task and latency together.
Step 5: Pick a primary and a fallback. The primary is usually the cheapest model that meets your quality bar with a margin. The fallback should come from a different provider, and must also pass your evals.
Step 6: Operate. Pin versions, log model IDs, monitor quality and cost in production (Module 11A and Module 11B), and loop back to step 3 when a promising model ships, a price changes, or a deprecation notice arrives.
10.3 Start with the strongest model, then move down#
When you don't yet know whether a task is feasible, prototype with a frontier model first:
- Find the ceiling. If the strongest model can't do the task with a good prompt, a cheaper one won't either. You've learned that the task needs redesigning (better context, tools, decomposition into steps) rather than a different model.
- Separate prompt problems from model problems. Early failures are usually caused by unclear instructions or missing context. A strong model lets you get the prompt and context right first (Module 04).
- Build the eval set while you prototype. Every interesting failure becomes a test case.
- Then step down tiers: frontier → mid → small, re-running the eval at each step and with lower reasoning effort. Stop at the cheapest model and effort level that still meets the bar.
- Optimize what remains: caching, batching, shorter prompts, routing (10.6).
The opposite mistake, starting with the cheapest model and concluding "AI can't do this", kills good projects early.
10.4 Cheat sheet by use case (as of October 2026)#
A starting point for your shortlist, not a recommendation to skip evaluation. Example models are current as of November 2026 (the list was updated on 11 November for Claude Fable 5.2 and Gemini 4 Carbon); the "tier" column is the durable part.
| Use case | Start from tier | Key requirements | Example candidates (October 2026) |
|---|---|---|---|
| Classification, routing, tagging, sentiment | Small / fast | Low latency, low cost, structured output | Claude Haiku 5.5, GPT-6 Luna, Gemini 3.5 Flash-Lite; small open models (Qwen 9B–35B, Ministral) |
| Data extraction from documents and images | Small → mid | Vision/PDF input, structured output, long context | Gemini 3.8 Flash (also audio and video), Claude Haiku 5.5 / Sonnet 5.5, GPT-6.1 Terra |
| Customer-support chat with RAG | Mid | Instruction following, grounding in context, multilingual, tone | Claude Sonnet 5.5, GPT-6.1 Terra or Sol, Gemini 3.8 Flash |
| Coding assistants and coding agents | Frontier → upper-mid | Agentic tool use, long context, reliability over many steps | Claude Opus 5.5 or Fable 5.2, GPT-6 Astra or 6.1 Sol, Gemini 4 Carbon or Argon; open: Kimi, GLM, DeepSeek, Qwen coder models |
| Long-horizon agents (research, multi-step workflows) | Frontier | Planning, tool reliability, long context, prompt-injection robustness | Claude Fable 5.2 / Opus 5.5, GPT-6 Astra, Gemini 4 Carbon or Argon |
| Hard reasoning (maths, science, analysis) | Frontier with high effort | Reasoning quality | Top-tier reasoning models; compare effort levels too (lesson 08) |
| Very long documents or video | Mid → frontier | Context window, video/audio input, long-context quality | Gemini models (video and audio input), Claude and GPT models with 1M context (lesson 07) |
| Real-time voice | Specialized | Speech in/out, low latency | gpt-realtime-2.1 / gpt-live-1, gemini-3.8-live (Module 09) |
| Embeddings for search | Specialized | Retrieval quality on your data, price, dimensions | Provider embedding models (lesson 03, Module 06) |
| Strict data control, on-premises or offline | Open weights, self-hosted | Licence, hardware fit | gpt-oss, Qwen, Gemma 4, Mistral Small 4 / Ministral, DeepSeek or GLM for large deployments |
| Huge batch jobs (labelling, summarizing archives) | Smallest model that passes, via Batch API | Cost | Any small-tier model with a batch discount; cheap open-weight hosts |
10.5 Fallbacks and multi-provider resilience#
Every provider has outages, rate-limit spikes and occasional bad deploys. A fallback keeps your feature working:
- Use a different provider for the fallback. A second model from the same provider often shares the same outage.
- Evaluate the fallback on the same eval set. A fallback that quietly produces worse answers is a hidden incident.
- Keep prompts portable. Avoid depending on one provider's quirks where you can, or keep a per-model prompt variant.
- Decide what triggers the fallback: errors and timeouts (always), rate limits (usually), content refusals (carefully; a refusal may be correct).
- Implement it in your own code, through a gateway's fallback list (5.4), or with a proxy such as LiteLLM. Module 11C covers retries, timeouts and circuit breakers.
10.6 Model routing and cascades: a preview#
Instead of one model for everything, production systems often send each request to the cheapest model that can handle it:
flowchart LR
q["Incoming request"] --> r{"Router<br/>(rules or a small classifier)"}
r -->|"simple: FAQ, extraction"| small["Small / fast tier"]
r -->|"hard: multi-step, high stakes"| big["Frontier tier"]
small --> chk{"Confident and<br/>passes checks?"}
chk -->|"yes"| out["Answer"]
chk -->|"no: escalate"| big
big --> out- Routing decides upfront, with rules (by feature, user tier or input length) or a small classifier model.
- Cascading tries a cheap model first and escalates when its answer fails a check (schema validation, a confidence signal, a verifier).
- Off-the-shelf routers exist, such as OpenRouter's Auto Router, but a router you control is easier to evaluate.
Because traffic is usually dominated by easy requests, routing can cut costs dramatically with little quality loss, but only if you measure both. Building routers and cascades is Module 11B.
10.7 A worked example#
Scenario: an Indian e-commerce company wants an assistant that answers customer questions about orders and returns, in English, Hindi and Tamil, using the company's policy documents and an order-lookup tool. Customers sometimes upload photos of damaged products. Expected volume: 30,000 conversations a day. Customer data must be processed under an approved enterprise agreement, and the company runs on AWS.
- Requirements: text and image input; tool calling (order lookup); RAG over policy documents; English, Hindi, Tamil; friendly, accurate tone; around 6,000 input tokens per turn (system prompt, retrieved policies, history) and 300 output tokens.
- Constraints: an approved processor, so the AWS route (Bedrock) or a direct enterprise agreement; time to first token under about 2 seconds; budget set by finance per conversation.
- Shortlist: check which models Bedrock offers with image input and tool use, and pick across tiers and providers, for example a Claude mid tier and small tier and an OpenAI model on Bedrock, plus Amazon Nova as a cheaper baseline.
- Evaluate: 100 real past conversations, with native Hindi and Tamil speakers grading answers; measure tokens per message in each language (Tamil may use far more tokens than English, lesson 02), cost per conversation and latency from the company's AWS region.
- Pick: say the mid tier passes everywhere and the small tier passes in English but not in Tamil. A simple route by language (small model for English, mid tier for Hindi and Tamil) might meet the bar at lower cost. The fallback is a model from a different provider that also passed. Cache the system prompt and policies.
- Operate: pin snapshot IDs, monitor quality by language, watch Bedrock's lifecycle dates for both models, and re-run the eval each quarter.
A back-of-envelope check shows why step 5's routing matters. Assume (these are guesses to replace with measured numbers) 4 requests per conversation, so 120,000 requests a day, 6,000 input and 300 output tokens each, and 70% of the input served from the prompt cache. At the Claude direct-API list prices from 2.2 (Bedrock's prices can differ, so confirm them), the 6.13 arithmetic gives about $1,340 a month on Haiku 5.5 and about $25,300 a month on Sonnet 5.5, roughly 19× apart. If English is, say, 60% of traffic and the small tier is good enough there, sending it to the small tier cuts the all-mid-tier bill by a little over half (about $10,900 instead of $25,300), with Hindi and Tamil still on the mid tier. Tamil's extra tokens per message raise its share of the bill further, which is why step 4 measures tokens per language.
Notice that no step started with "which model tops the leaderboard?".
Common misconceptions#
| Misconception | Reality |
|---|---|
| "There's one best model." | There's a best model for a task under constraints. Tier, modality, price, latency, data and licence requirements change the answer (1.1). |
| "The newest, biggest model is always the right choice." | For many tasks a small tier is just as accurate at a fraction of the cost and latency. Find the ceiling with a strong model, then step down (10.3). |
| "Open-weight means open source, free and private." | Usually only the weights are open; licences vary; and a hosted open model sends your data to its host and costs money per token (1.2). |
| "Open models are far behind closed ones." | They're close on many tasks and much cheaper to host, though usually still behind at the hardest agentic and long-context work. Evaluate the exact model and host (1.2). |
| "A model is the same everywhere it's offered." | Routes differ in IDs, prices, features, lifecycles and, for open weights, quantization (5.4, 5.5). |
| "Price per million tokens tells you what it costs." | Cost per task depends on the input/output ratio, reasoning tokens, caching, tokenizer, thresholds, tier and region (Part 6). |
| "Reasoning models are expensive per token, so avoid them." / "...cheap per token, so use them everywhere." | Thinking tokens are billed as output. Judge cost and quality per task, at each effort level (6.4). |
| "The model with the highest benchmark score will be best for us." | Benchmarks suffer from contamination, saturation, different settings and task mismatch. Your own eval decides (7.4, 7.6). |
| "Arena rank measures correctness." | It measures human preference on mostly short chats, which rewards confident, well-formatted answers (7.5). |
| "A model ID always gives me the same model forever." | Aliases move, snapshots retire, and serving infrastructure and API versions change (Part 8). |
| "API providers train on everything I send." | The major APIs don't train on API data by default, but retention, ZDR eligibility and free-tier terms vary, and consumer apps differ from APIs (Part 9). |
| "Self-hosting is cheaper." | Only at high, steady utilization, and before counting operations. The usual reasons are control and customization (5.7). |
| "We picked a model, so we're done." | Models are retired within one to two years and better, cheaper ones keep arriving. Keep an eval set and re-evaluate on a schedule (10.2). |
Key takeaways#
- Think in three axes: who makes the model (closed or open-weight), how you reach it (provider API, cloud platform, gateway, self-hosting), and what it can do (tier and capabilities).
- Providers organize models into families, generations, tiers and snapshots. Tiers trade quality against speed and cost, with price gaps of up to 100× within one provider. Names don't reliably tell you the tier.
- Open-weight models give you control, customization and provider choice, at the cost of operations. Check the licence: permissive (Apache 2.0, MIT), custom community licences with thresholds and attribution, or non-commercial.
- Compare models on a capability checklist: modalities, context window, max output, reasoning, tool use, structured output, multilingual quality, speed, knowledge cutoff, price, rate limits and lifecycle.
- Cloud platforms bring billing, IAM, regions and compliance; OpenRouter brings one key for hundreds of models, provider routing and fallbacks, with prices passed through and a fee on credit purchases; self-hosting with Ollama, llama.cpp or vLLM gives full control.
- Pricing is per million tokens, with output costing several times input. Cached input, reasoning tokens, batch/flex/priority tiers, long-context thresholds, regional uplifts, tokenizer differences and dated introductory prices all change the real cost. Model cost per task, with prices as parameters.
- Model cards and system cards tell you intended use, limitations, licence and safety evaluations. Benchmarks and leaderboards are for shortlisting; contamination, saturation, settings and task mismatch make them poor final judges. Your own evals win.
- Pin snapshots in production, track lifecycles automatically, and plan migrations as routine maintenance.
- Know where your data goes: training use, retention, ZDR, residency and processors differ by provider, route, feature and tier. In the other direction, providers increasingly watermark or sign generated media, and the EU AI Act now requires machine-readable marks (with a grace period to December 2026 for older systems) — don't strip provenance signals when you re-host output (9.7).
- Choose with a framework: requirements → constraints → shortlist → evaluate → primary plus a fallback from another provider → operate and re-evaluate. Start strong, then step down tiers, and consider routing to use cheap models for easy requests.
Terms introduced in this lesson#
| Term | One-line definition |
|---|---|
| Provider / lab | The company that trains and/or serves a model |
| Model family | A provider's product line of models (Claude, GPT, Gemini, Qwen...) |
| Generation | A new round of models in a family, usually more capable per dollar |
| Tier | A size or capability level within a generation (frontier, mid, small) |
| Closed / proprietary model | A model available only as a service; the weights aren't published |
| Open-weight model | A model whose trained parameters can be downloaded and run |
| Open Source AI Definition | The OSI's definition requiring weights, training code and data information |
| Licence (model) | The legal terms for using open weights: permissive, custom community or non-commercial |
| Acceptable use policy | A list of prohibited uses attached to a model licence or service |
| Specialized model | A model built for one job: embeddings, speech, image generation, moderation, OCR... |
| Modality | A kind of data a model handles: text, image, audio, video |
| Maximum output tokens (max output) | The maximum number of tokens a model can generate in one response; you request less with the max-output parameter (max_tokens / max_output_tokens / max_completion_tokens) |
| Knowledge cutoff (reliable vs training data) | The date the model's knowledge is dependable until, vs the date its training data runs to |
| Time to first token (TTFT) | Delay before the first output token arrives (preview; defined in lesson 05) |
| Output speed | Tokens per second generated after the first token |
| Models API | A provider endpoint listing available models and their limits or capabilities |
| Cloud platform | A hyperscaler service reselling models (Amazon Bedrock, Gemini Enterprise Agent Platform, Microsoft Foundry) |
| Gateway / router | A service offering many models through one API, with routing and fallbacks (for example OpenRouter) |
| Endpoint (gateway) | One specific host serving a model on a gateway, with its own price, speed and quantization |
| Provider routing | Rules for which hosts may serve a request (order, sort, price limits, data policy) |
| Model fallback | Automatically trying another model when the first one fails |
| BYOK | "Bring your own key": using your own provider keys through a gateway |
| Self-hosting | Running open-weight models on hardware you control (Ollama, llama.cpp, vLLM) |
| GGUF | A file format for quantized models used by llama.cpp and Ollama |
| MTok | One million tokens, the unit of LLM pricing |
| Cached input | Input tokens served from the prompt cache at a discounted price (preview; defined in lesson 07) |
| Cache write | Storing a prompt prefix in the cache, sometimes charged at a premium |
| Reasoning tokens | Hidden thinking tokens, billed as output tokens (preview; defined in lesson 08) |
| Batch API | Asynchronous processing at a discount (typically 50%) |
| Flex / priority tiers | Cheaper lower-priority, or pricier faster, ways to call the same model |
| Long-context surcharge | Higher per-token prices once a prompt passes a threshold |
| Data residency / inference geo | Guaranteeing the region where data is processed or stored |
| Introductory pricing | A temporary launch price with an announced end date |
| Model card | Documentation of a model's intended use, training, evaluation, limitations and licence |
| System card | A lab's detailed report on a model's capabilities, safety evaluations and safeguards |
| Benchmark | A fixed task set with automatic scoring, used to compare models |
| Saturation | When top models all score near the maximum, so a benchmark can't separate them |
| Benchmark-maxxing | Tuning models to score well on popular benchmarks rather than to be generally better |
| Leaderboard (Arena, Artificial Analysis) | A ranking of models by human votes or by standardized evaluations |
| Composite index | One score combining many benchmarks with chosen weights |
| Snapshot | A frozen model version with a fixed ID |
| Alias | A model name that points to a snapshot and can be moved |
| Model lifecycle (active, legacy, deprecated, retired) | The stages from release to shutdown |
| Model pinning | Using exact snapshot IDs in production so the model can't change underneath you (not the pinned context of lesson 07) |
| Zero data retention (ZDR) | An arrangement under which the provider doesn't store prompts or outputs after responding |
| Data processor | The party that processes your data on your behalf under a contract |
| SLA (service-level agreement) | A contractual commitment to uptime or performance, usually tied to a plan or contract |
| IP indemnity | A provider's promise to defend customers against intellectual-property claims over generated output, under conditions |
| Output-use restriction | Terms limiting what you may do with a model's outputs, such as training competing models |
| Bradley–Terry model | The statistical model Arena uses to turn pairwise votes into ratings |
| Model routing / cascade | Sending each request to the cheapest suitable model, escalating when needed |
| AI watermarking (SynthID) | An imperceptible signal embedded in generated media so it can later be identified as AI-made; probabilistic evidence, not proof |
| Content Credentials (C2PA) | Cryptographically signed provenance metadata attached to a media file, recording how it was created or edited |
All terms are also collected in the glossary.
Exercises#
- Explore the catalogue (4.9): change
meets_requirementsto your own feature's needs (for example audio input, or at least 1M context, orreasoningsupport). How many models pass? Then changeIN_TOKENSandOUT_TOKENSto an output-heavy workload (500 in, 5,000 out). Does the cheapest model change? Why? Hint: with 5,000 output tokens the output price dominates, so a model with cheap input but a high output price can drop down the ranking. - Endpoints (5.4): run
show()for three open-weight models of your choice (for exampleqwen/qwen3.6-35b-a3b,openai/gpt-oss-120b,google/gemma-4-31b-it). For each, find the cheapest endpoint that declaresfp8or higher precision. How much more does it cost than the cheapest endpoint overall? Hint: in theshow()output thequantcolumn holds the precision;unknownmeans undeclared, so don't count it asfp8or higher. - Cost model (6.13): extend
Pricesandmonthly_costto include a cache-write premium (1.25× input on the first write) and a long-context threshold (for example: above 100,000 input tokens, multiply all prices by 5). Re-run with a Haiku 5.5-style threshold and a 120,000-token prompt. Hint: Haiku 5.5's long-prompt rate is exactly 5× on input and output (6.6), so a 120,000-token prompt should cost about five times what its token count alone suggests; check that your function applies the multiplier to the whole request, not only to the tokens above 100,000. - Reasoning budget (6.13): for
claude-sonnet-5-5, how many reasoning tokens per request make the bill equal to Opus 5.5's, if you assume Opus 5.5 reasons for next to nothing? What does that suggest about comparing models at different effort levels? Answer check: with 4,000 input and 300 visible output tokens, Opus 5.5 costs $0.022 per request and Sonnet 5.5 costs $0.011 before any thinking, so each extra reasoning token ($10 per MTok) closes the gap after about 1,100 tokens. (This is a simplification: Opus 5.5's adaptive thinking is always on and billed as output too, so in practice the gap closes sooner.) A cheaper tier that thinks a lot can cost as much as a dearer tier that thinks little. - Licence audit (3.3, 7.1): use
model_infoon five open-weight models you might use. For any withlicense: other, open the licence file on Hugging Face and answer the eight questions in 3.3. - Lifecycle check (8.3): change
PINNEDto the models your team (or a tutorial you follow) actually uses, and settodaytodt.date.today(). Then write the equivalent check against one provider's Models API (Anthropic'slifecycleandretires_at, or OpenAI'sshutdown_date). - Read a system card (7.2): pick a recent system card from OpenAI, Anthropic or Google. Find one capability evaluation relevant to your work and write down its exact settings (effort level, tools, attempts). Find the prompt-injection results.
- Decision framework (10.7): write a one-page model decision for a feature of your choice, following the six steps: requirements, constraints, a shortlist of at least three models across two tiers and two providers, an eval plan, a primary and fallback, and an operating plan.
- Local model (5.7): if you have Ollama installed, run the sample, then pull a larger model your machine can hold (see 3.4) and compare answers to a few of your own questions. Use the memory rule from lesson 01, 4.4 to predict what fits before you download.
- Data-policy sheet (Part 9): choose one provider and answer the seven questions in 9.1 from its official data pages (linked in Further resources), writing the page and the date you read it next to each answer. Add one line: which of its features is not covered by zero data retention? Hint: the provider's feature-by-feature eligibility table lists them; for OpenAI, Files and Batches are examples, and for Anthropic, the code execution tool is. If your product publishes generated images, also note what the provider says about watermarks or Content Credentials (9.7).
Check yourself#
- What are the three axes for thinking about the model landscape?Who makes the model (closed or open-weight), how you reach it (provider API, cloud platform, gateway, self-hosting), and what it can do (tier and capabilities).
- What's the difference between open weights and open source, in the OSI's sense?Open weights means the trained parameters are published. Open source in the OSI's Open Source AI Definition also requires the training code and enough information about the training data to build a substantially equivalent system. Most "open" LLMs are open-weight only.
- A provider sells a model in three tiers. What usually changes as you go from the smallest to the largest?Larger tiers are generally more capable (especially on hard, multi-step tasks), but slower and more expensive, often by large factors (up to 100× in price within one provider as of November 2026).
- Why shouldn't you judge a model's tier by its name?Providers use codenames and inconsistent version numbers, newer small models can beat older large ones, and not every tier ships in every generation. Read the provider's description and price instead.
- Name three things you must check in an open-weight model's licence before shipping a product.Any three of: whether commercial use is allowed; thresholds (users, revenue, company size); required attribution; the acceptable use policy; restrictions on using outputs to train other models; terms for derivatives and fine-tunes; geographic restrictions; gating.
- A model has a 1M-token context window and a 64K max output. Can it translate a 900,000-token book in one request? Why or why not?No. The output limit (64K) caps the translation's length, and a book-length translation needs roughly as many output tokens as the input. If input and output share the window, there also isn't room for both. Split the book into chunks.
- Why do output tokens cost more than input tokens?Input tokens are processed in one parallel pass (prefill), while output tokens are generated one at a time, each needing a full forward pass, which uses the hardware less efficiently.
- A reasoning model costs the same per token as a non-reasoning one. Why might it cost far more per request?Its hidden thinking tokens are billed as output tokens, so a request with a short visible answer can include thousands of billed reasoning tokens.
- Name two ways the same model can differ between a direct API and a cloud platform.Any two of: model IDs, prices (including regional uplifts), available features (which can lag), lifecycle and retirement dates, the data processor and terms, rate limits.
- On OpenRouter, what are the
modelslist and theproviderobject for?modelsis an ordered fallback list of models to try if the first fails.providersets preferences for which hosts may serve the request: order, sort by price/throughput/latency, allowed or ignored hosts, price limits, quantizations, required parameters, and data policies such asdata_collection: "deny"andzdr: true. - Why might a cheap OpenRouter endpoint for an open-weight model give worse answers than a pricier one?It may serve the model at a lower precision (for example FP4) or with different settings, which can reduce quality, especially on long or difficult tasks.
- Give three reasons a benchmark score might not predict performance on your task.Any three of: contamination (the model saw the questions), saturation, different settings or harnesses, cherry-picked or self-reported results, version confusion, noise, task mismatch, and a different serving setup (such as quantization) from yours.
- What's the difference between an alias and a snapshot, and which should you use in production?A snapshot is a frozen model version; an alias is a name that points to a snapshot and can be moved to a newer one. Use exact snapshots in production.
- Anthropic's dateless ID
claude-sonnet-5-5doesn't change. Why might its behaviour still shift slightly over time?Anthropic keeps the weights fixed for an ID, but the serving infrastructure around it (request routing, safety classifiers, sampling logic) can change, and API versions can change which parameters are accepted. - Your feature runs fine on the Gemini API's free tier. What should you check before using it with customer data?That the free tier's terms allow it. As of October 2026, Google's terms say free-tier content is used to improve Google's products and may be read by human reviewers, so use the paid tier (or an approved enterprise route) for customer data, and check residency and retention requirements.
- Why should a fallback model come from a different provider, and what must you do before relying on it?A model from the same provider often shares the same outage or rate limit. You must evaluate the fallback on your eval set, since it may follow prompts, format output or refuse differently.
- Why prototype with a frontier model, then move down tiers?A strong model shows whether the task is feasible and separates prompt and context problems from model limitations. Once it works and you have an eval set, you can step down to cheaper tiers and keep the cheapest one that still meets the bar.
- Your app publishes images that a model generated. What should you avoid doing to them, and why?Don't strip provenance signals: Content Credentials (C2PA) metadata can be lost when you re-encode, resize or re-host a file, and a SynthID watermark can be weakened by heavy transformation. Both help others identify content as AI-generated, and the EU AI Act's transparency rules (from 2 August 2026) expect machine-readable marking and visible labels for some uses. Preserve the metadata where you can and plan labels where the rules apply.
Further resources#
-
11B.2 — Tokenomics: the economics behind the pricing structure in this lesson: price map, trends, unit economics and tokenizer effects. Official model, pricing and lifecycle pages (check these for current values):
-
OpenAI: Models, Pricing, Deprecations, Your data
-
Anthropic: Models overview, Pricing, Model IDs and versioning, Model deprecations, API and data retention, Data residency
-
Google: Gemini models, Gemini API pricing (the older
ai.google.dev/gemini-api/docs/...addresses redirect here) -
xAI: Models and pricing
-
Mistral: Models overview
-
OpenRouter: Models catalogue, API reference: list models, Provider routing, Model fallbacks, Pricing
-
Cloud platforms: Amazon Bedrock models, Gemini Enterprise Agent Platform release notes, Microsoft Foundry documentation
Benchmarks, leaderboards and cards:
- Artificial Analysis: independent quality, speed and price comparisons; read its Intelligence Index methodology.
- Arena (formerly LMArena): human-preference leaderboards; see its rebrand announcement.
- Chiang et al., Chatbot Arena: An Open Platform for Evaluating LLMs by Human Preference (2024, arXiv:2403.04132): how the Arena method works.
- Singh et al., The Leaderboard Illusion (2025, arXiv:2504.20879): a critique of leaderboard practices.
- OpenAI, "Why we no longer evaluate SWE-bench Verified" (February 2026): a case study in benchmark contamination and flawed tests.
- Anthropic Transparency Hub: knowledge cutoffs, system cards and model reports for Claude models.
- ARC Prize: the ARC-AGI benchmarks.
- Mitchell et al., Model Cards for Model Reporting (2019, arXiv:1810.03993): the paper that introduced model cards.
- Open Source Initiative, The Open Source AI Definition: what "open source" means for AI.
- Hugging Face Hub: open-weight models, model cards and licences.
Marking AI-generated content (9.7):
- Google DeepMind, SynthID: the watermarking technology and its partners.
- C2PA: the Content Credentials standard.
- European Commission, Quick facts: transparency rules for AI systems: the Article 50 application date and the grace period.
Self-hosting:
← 02.8 — Reasoning Models | Module 02 overview | 02.10 — Limitations and Failure Modes →