Index Ai Academy
Phase 1 · Building with LLMs · Prompting

Choosing a model

Trade capability, speed and cost across model families.

About 25 minutes · A free account opens the whole lesson

Create a free account Try part of it here

Already have an account? Sign in to open this lesson

Why it matters

The same feature can cost $20 a month or $2,000, depending on the model behind it. Teams often start on a bigger model than the job needs. The cheapest model that does the work well is rarely the first one they try. Comparing models, and doing the cost math before you ship, is one of the most practical skills in AI engineering. If you've ever managed a budget, your instincts will help here.

What you'll be able to do

  • Compare models on capability, speed, cost, context window and features
  • Estimate what a feature will cost per request and per month
  • Pick a starting model for a task, and know how to test a cheaper one
  • Explain the difference between closed API models and open-weight models

What it covers

  1. The right tool for the job
  2. Doing the cost math
  3. Closed models and open-weight models
  4. How to choose, in practice
  5. Worked example: monthly budget for a feature

The right tool for the job

You wouldn't rent a moving truck to carry one box across town. You wouldn't try to move a whole house with a scooter, either. Choosing a model works the same way. Every provider sells a range of models, and they trade off along the same few lines:

TraitWhat it means for you
CapabilityHow well it handles hard reasoning, long instructions, code and subtle writing.
SpeedHow quickly the first words arrive and how fast the rest streams. Smaller models are faster.
PriceCharged per million tokens. Output tokens (what the model writes) cost more than input tokens (what you send).
Context windowHow many tokens fit in one request, counting your prompt and the reply.
FeaturesExtras such as tool use, reading images and PDFs, structured output, thinking and batch discounts.

Within one family, bigger models are more capable. They're also slower and cost more. Your job is to match the model to the task.

The Claude family (October 2026)

ModelModel idPrice per million tokens (input / output)Best for
Claude Fable 5.1claude-fable-5-1$10 / $50The hardest reasoning and long agent tasks
Claude Opus 5.5claude-opus-5-5$4 / $20Default for demanding work: writing, coding, analysis, agents
Claude Sonnet 5.5claude-sonnet-5-5$2 / $10Everyday work where speed and cost matter more
Claude Haiku 5.5claude-haiku-5-5$0.10 / $0.50High-volume, simple tasks: tagging, routing, short extraction

All four have a context window of 1 million tokens. Haiku's price applies to prompts up to 100,000 tokens. Prices and models change often. Treat these numbers as a snapshot, and check the provider's pricing page before you set a budget.

Look at the gap between Opus and Haiku. Opus charges $4 per million input tokens. Haiku charges $0.10. So each Haiku input token costs one fortieth as much.

Other providers follow the same pattern. OpenAI's GPT models and Google's Gemini models each come in larger and smaller sizes, with similar trade-offs.

Quick check
Claude Opus 5.5 charges $20 per million output tokens. Claude Haiku 5.5 charges $0.50. How many times more does Opus charge per output token?
  1. 4 times
  2. 40 times
  3. 19.5 times
  4. 400 times
Show the answer

40 times

$20 ÷ $0.50 = 40. Input prices show the same gap: $4 ÷ $0.10 = 40. The answer 19.5 is the difference in dollars ($20 − $0.50), not how many times bigger one price is.

Doing the cost math

You priced a single call in the tokens lesson. Here's the same idea as one line. Prices are quoted per million tokens, so you divide by a million at the end:

cost = (input tokens × input price + output tokens × output price) ÷ 1,000,000

In plain words: price what you sent, price what came back, and add the two. Then divide by a million, because each price covers a million tokens.

Here's an example with small numbers. Say you ask Opus 5.5 to tag one product review with a label, such as "positive" or "shipping problem". The review and your instructions come to about 300 tokens. The reply is about 20 tokens.

  • Input: 300 × $4 = 1,200.
  • Output: 20 × $20 = 400.
  • Add them: 1,200 + 400 = 1,600.
  • Divide by a million: 1,600 ÷ 1,000,000 = $0.0016.

The middle numbers aren't dollars yet. They turn into dollars at the last step. The answer, $0.0016, is less than a fifth of a cent. The code below does the same sum for three models. Then it multiplies by 50,000 to price a whole batch of reviews.

PRICES = {  # dollars per million tokens: (input, output)
    "claude-opus-5-5": (4.00, 20.00),
    "claude-sonnet-5-5": (2.00, 10.00),
    "claude-haiku-5-5": (0.10, 0.50),
}

def cost(model, input_tokens, output_tokens):
    price_in, price_out = PRICES[model]
    return (input_tokens * price_in + output_tokens * price_out) / 1_000_000

# Tagging one product review: ~300 tokens in, ~20 out
for model in PRICES:
    per_review = cost(model, 300, 20)
    print(f"{model:18} ${per_review:.6f} per review, ${per_review * 50_000:,.2f} for 50,000 reviews")
It runs right here in your browser, with nothing to install.

PRICES is a dictionary. Each model name maps to a pair: the input price, then the output price. The line price_in, price_out = PRICES[model] unpacks that pair into two names. The :.6f shows six decimal places, so tiny costs don't print as zero.

The gap is huge. The 50,000-review job costs $80 on Opus, $40 on Sonnet and $2 on Haiku. The open question is quality. You'd test it with an eval: a set of examples with answers you trust. Evals come later in this phase. If Haiku tags reviews as well as Opus, the choice is easy. If accuracy drops from 95% to 80%, it might not be.

Quick check
What does this print?
input_tokens = 1_000_000
print(input_tokens * 4 / 1_000_000)
  1. 1.0
  2. 4.0
  3. 0.4
  4. 4000000
Show the answer

4.0

Prices are per million tokens, so a million input tokens at $4 costs $4.00.

Try it now

Using the prices in this lesson. Output costs five times as much as input, so watch how much the output slider moves the total.

Quick check
A request uses 2,000 input tokens and 500 output tokens on Claude Sonnet 5.5 ($2 in, $10 out per million). What does it cost?
  1. $9.00
  2. $0.09
  3. $0.009
  4. $0.0045
Show the answer

$0.009

Input: 2,000 × $2 = 4,000. Output: 500 × $10 = 5,000. Add them to get 9,000, then divide by 1,000,000: $0.009 in total.

Closed models and open-weight models

Think of the difference between eating at a restaurant and getting the recipe. At the restaurant, you order and the food arrives. You never see the kitchen. With the recipe, you can cook at home and change it to taste. But you buy the ingredients and run the kitchen yourself.

Claude, GPT and Gemini are closed models, like the restaurant. You send requests to the provider's API, and you never see the model itself.

Open-weight models are the recipe. Their makers publish the weights, the huge set of numbers the model learned in training. Examples include Meta's Llama, Mistral's models, Alibaba's Qwen and DeepSeek's models. You can download them and run them on your own hardware. You can also rent a server to run them.

blankClosed API modelsOpen-weight models
SetupAn API keyServers and GPUs, or a hosting service
Top capabilityUsually higherClose behind, improving fast
DataLeaves your systems (under the provider's terms)Can stay entirely in-house
CustomizingPrompts, plus fine-tuning where offeredFull control, including fine-tuning

A GPU is a graphics chip. It's the kind of processor large models run on fastest. Fine-tuning means training a model a little more on your own examples.

Open-weight doesn't mean free to run. You stop paying per token. Instead, you pay for servers and the work of keeping them running.

Phase 6 covers running open models yourself. For most product work, an API model is the fastest way to get something working.

Quick check
A team moves from a closed API model to an open-weight model on its own servers. Which statement is true?
  1. Their running costs drop to zero, because the weights are free to download
  2. Their data must now pass through the model maker's API
  3. They stop paying per token, but now pay for servers and the work of running them
  4. They no longer need to test quality, because they control the model
Show the answer

They stop paying per token, but now pay for servers and the work of running them

Downloading the weights is free, but running them takes servers, usually with GPUs, and people to look after them. Quality still needs testing, and the data can stay on the team's own servers.

How to choose, in practice

  1. Start capable. Build the first version on a strong model, such as Opus 5.5. That tells you whether the task can be done at all.
  2. Measure. Collect 20 to 50 real examples, along with the outputs you'd accept. This is your eval set.
  3. Step down. Run the same prompts on a cheaper model. Compare its results with the strong model's on your eval set.
  4. Route. Many apps use more than one model. A cheap model handles the easy, high-volume steps. A strong model handles the hard ones.

Before you step down to a cheaper model, try lowering the strong model's effort setting. It trades some depth of reasoning for speed and cost, and the next lesson covers it. It's often a better trade than switching models.

Watch out: thinking counts as output tokens. Some models work through a problem in writing before they answer, and that working-out is called thinking. A reasoning-heavy request on a big model can produce far more output tokens than the visible answer suggests. The next lesson shows how to control that.

Go deeper The math of routing

Go back to the 50,000 reviews. Say your eval shows Haiku handles 80% of them well. The other 20% need Opus. Assume something cheap sorts the reviews, and ignore its cost for now.

  • Haiku: 40,000 reviews × $0.00004 = $1.60.
  • Opus: 10,000 reviews × $0.0016 = $16.00.
  • Total: $1.60 + $16.00 = $17.60.

Sending everything to Opus costs $80, so routing cuts the bill by more than three quarters. Real routers cost something too, and they sometimes send a review the wrong way. So check the mix on your eval as well.

Quick check
Your app shows a 150-word answer, but the usage report lists 4,000 output tokens. What's the most likely reason?
  1. The context window was full
  2. The API counted the input tokens twice
  3. Every reply is billed at 4,000 output tokens or more
  4. The model thought before answering, and thinking counts as output tokens
Show the answer

The model thought before answering, and thinking counts as output tokens

150 words is roughly 200 tokens. The rest is the model's thinking. You pay for it at the output price, even if your app never shows it.

Worked example

Worked example: monthly budget for a feature

A support assistant answers 1,200 questions a day. Each request sends a 3,000-token system prompt plus a question of about 200 tokens. Each reply is about 250 tokens. What does a 30-day month cost on each model?

PRICES = {"claude-opus-5-5": (4.00, 20.00), "claude-sonnet-5-5": (2.00, 10.00), "claude-haiku-5-5": (0.10, 0.50)}

def cost(model, input_tokens, output_tokens):
    price_in, price_out = PRICES[model]
    return (input_tokens * price_in + output_tokens * price_out) / 1_000_000

requests_per_month = 1_200 * 30
for model in PRICES:
    monthly = cost(model, 3_200, 250) * requests_per_month
    print(f"{model:18} ${monthly:,.2f} per month")
In the lesson you can change this and run it.

A month has 1,200 × 30 = 36,000 requests. Each one sends 3,000 + 200 = 3,200 input tokens. The code prints $640.80 a month for Opus, $320.40 for Sonnet and $16.02 for Haiku.

Notice where the money goes. On Opus, the input side of the sum is 3,200 × $4 = 12,800. The output side is 250 × $20 = 5,000. Both are divided by the same million, so input makes up more than two-thirds of the bill. That's true even though each output token costs five times as much.

A long system prompt sent with every request adds up fast. Prompt caching gives a discount on exactly this kind of repeated text. You'll meet it in the cost lesson later in this phase.

Quick check
In the worked example, you cut the system prompt from 3,000 tokens to 1,000. Each request now sends 1,200 input tokens and gets 250 back. What does Sonnet cost for the month (36,000 requests)?
  1. $320.40
  2. $90.00
  3. $86.40
  4. $176.40
Show the answer

$176.40

Per request: 1,200 × $2 = 2,400 and 250 × $10 = 2,500. Add them and divide by a million: $0.0049. Times 36,000 requests is $176.40, about 45% less than before. $86.40 forgets the output tokens, and $90.00 forgets the input.

Practice what you just read

  • 2 code examples you can edit and run
  • a practice exercise that checks your code
  • a 5-question quiz
  • 4 review cards for spaced repetition

Create a free account

Try a quiz question

Your first version works well on Claude Opus 5.5 but the monthly bill is too high. What's the best next step?

  1. Build an eval set, then compare a lower effort setting and a cheaper model against it
  2. Switch straight to the cheapest model and ship it, then wait to see whether users complain
  3. Shorten every prompt to one sentence, which cuts the bill without changing how the app behaves
  4. Raise max_tokens so replies are complete, because cut-off replies are what make the bill high

Answer it at the end of the lesson to see if you're right, and why.

Before this lesson