Claude Code · Series · Part 4 of 8

The Claude API, every model so far, and the official links

Khairul Alam·October 2026·~14 min read
Claude APIModelsReferenceOfficial links

Parts 1 to 3 were about using Claude Code well. This part is the reference shelf at the end of the beginner level (Parts 5 to 8 go further): how Claude Code differs from the Claude API, a first API call you can run in five minutes, every Claude model published so far with its API ID and status, and the official pages I rely on, all in one place. Models and pages change often, so every table here is a dated snapshot and the linked docs are the source of truth.

Part 4 in 60 seconds
  • Claude apps are for chatting, Claude Code works inside your project, and the Claude API is for building your own app on top of Claude.
  • The API needs a Claude Console account and an API key. Keep the key in an environment variable and never ship it inside an app.
  • Four models are current (Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5). Older ones are legacy, deprecated or retired.
  • An alias like sonnet is a convenience; a full ID like claude-sonnet-5-5 is a pinned snapshot you can rely on.
  • The official links are grouped at the end, so you can bookmark one section.

1. Claude apps, Claude Code or the API?

The same models are reachable through different doors. Which one you want depends on what you are trying to do:

DoorUse it toYou sign in with
Claude apps (claude.ai, desktop, phone)Chat, write, analyse files. Nothing to install in a project.A claude.ai account
Claude CodeWork inside your own project: read the code, edit files, run commands.Pro, Max, Team or Enterprise, or a Console account
Claude APIBuild Claude into your own app, website or backend. You send messages and get replies as data.A Console account and an API key; billed per token
Agent SDKBuild your own agents powered by Claude Code's tools, with control over orchestration and permissions.See the Agent SDK docs
Cloud providers (Amazon Bedrock, Google Cloud, Microsoft Foundry)Use Claude through a cloud account your organisation already has.Your cloud account
Claude modelsFable · Opus · Sonnet · Haiku Claude appschat on web, desktop, phone Claude Codeworks in your project Claude APIbuild your own app Cloud providersBedrock, Google, Foundry
Same models, four doors. Pick the door for the job, not a different Claude.

2. The Claude API in five minutes

If you have read my Android post on online models, this will look familiar: the API takes the whole conversation as JSON and returns the next message. It does not remember anything between calls, so you re-send the history every time (the same idea as the context window in Part 2).

  1. Create a Console account at platform.claude.com. This is separate from a claude.ai chat plan and is billed by usage.
  2. Create an API key in the Console (see Get an API key) and store it somewhere safe. Treat it like a password.
  3. Put the key in an environment variable so it never appears in your code:
    export ANTHROPIC_API_KEY="your-api-key-here"
  4. Make a call. Here is the plain HTTP version from the official quickstart:
    curl https://api.anthropic.com/v1/messages \
      -H "content-type: application/json" \
      -H "x-api-key: $ANTHROPIC_API_KEY" \
      -H "anthropic-version: 2023-06-01" \
      -d '{
        "model": "claude-opus-5-5",
        "max_tokens": 1000,
        "messages": [
          { "role": "user", "content": "Explain what a token is in one sentence." }
        ]
      }'

The reply is JSON. The text is in content, stop_reason says why it stopped, and usage reports the input_tokens and output_tokens you were charged for. The same call with the official Python library is shorter:

quickstart.py (pip install anthropic)
import anthropic

client = anthropic.Anthropic()   # reads ANTHROPIC_API_KEY

message = client.messages.create(
    model="claude-opus-5-5",
    max_tokens=1000,
    messages=[
        {"role": "user", "content": "Explain what a token is in one sentence."}
    ],
)

for block in message.content:
    if block.type == "text":
        print(block.text)
Your appholds the API keykeeps the conversationre-sends it each time request reply POST /v1/messages in: model, max_tokens, messages[ role, content ] out: content[ text ], stop_reason, usage{ input_tokens, output_tokens } headers: x-api-key, anthropic-version
One request in, one message out. Everything else (tools, streaming, caching) builds on this shape.

Official libraries exist for Python, TypeScript, C#, Go, Java, PHP and Ruby, plus a command-line tool, listed on the client SDKs page. The next page to read is Working with the Messages API: multi-turn conversations, system prompts and stop reasons.

Never put your API key inside an app you ship

Anyone can pull a key out of an app package or a web page. Keep it on a server you control, or have users supply their own, and use environment variables for local work. Do not commit it to git. (More in the Android post.)

Claude Code can also use a Console account. Per the official quickstart, the first time you sign in with one, a “Claude Code” workspace is created in the Console to track that usage separately.

3. Every Claude model published so far

This is the full lineup as the official docs list it on 14 October 2026. Anthropic retires old models regularly, so treat it as a snapshot and check the models overview and the model deprecations page for the live status. “MTok” means a million tokens.

Current lineup

ModelAPI IDDocs describe it asSpeedPrice in / out per MTok
Claude Fable 5.1claude-fable-5-1For demanding reasoning and long-horizon agentic workSlower$10 / $50
Claude Opus 5.5claude-opus-5-5For long-running agentic coding and knowledge work. The docs suggest it as the starting point for most workloads.Moderate$4 / $20
Claude Sonnet 5.5claude-sonnet-5-5The best combination of speed and intelligenceFast$2 / $10
Claude Haiku 5.5claude-haiku-5-5For high-volume, latency-sensitive tasks such as classification, extraction and routingFastestFrom $0.10 / $0.50

All four accept text and image input, have a 1M-token context window and up to 128K tokens of output on the standard API, and are listed as not retiring sooner than September to October 2027. Prices are Claude API base prices and are separate from a Claude subscription. Two discounts from the pricing notes: batch requests are 50% off, and prompt-cache reads cost a fraction of the base input price (10% in general, and 2.5% to 5% on some of these models), which is why a stable CLAUDE.md is cheap to re-read (Part 3). See the pricing page for cache writes, long-context and per-platform rates.

Other models still active

ModelAPI IDNot retiring sooner than
Claude Mythos 5.1claude-mythos-5-11 Sep 2027
Claude Fable 5claude-fable-59 Jun 2027
Claude Mythos 5claude-mythos-59 Jun 2027
Claude Opus 5claude-opus-524 Jul 2027
Claude Opus 4.8claude-opus-4-828 May 2027
Claude Opus 4.7claude-opus-4-716 Apr 2027
Claude Opus 4.6claude-opus-4-65 Feb 2027
Claude Opus 4.5claude-opus-4-5-2025110124 Nov 2026
Claude Sonnet 5claude-sonnet-530 Jun 2027
Claude Sonnet 4.6claude-sonnet-4-617 Feb 2027
Claude Haiku 4.5claude-haiku-4-5-2025100115 Oct 2026

The overview page calls Fable 5, Opus 5 and 4.x, Sonnet 5 and 4.6 and Haiku 4.5 “legacy”: still available, but no longer receiving updates. The Mythos models are listed as active in the deprecations table, but I could not find a plain description of them, so see the docs before relying on them.

Deprecated and retired

ModelAPI IDStatus
Claude Sonnet 4.5claude-sonnet-4-5-20250929Deprecated 30 Sep 2026, retires 30 Nov 2026 (replacement: Sonnet 5.5)
Claude Mythos Previewclaude-mythos-previewDeprecated 9 Jun 2026, retirement date to be announced
Claude Opus 4.1claude-opus-4-1-20250805Retired 5 Aug 2026
Claude Opus 4 and Sonnet 4claude-opus-4-20250514, claude-sonnet-4-20250514Retired 15 Jun 2026
Claude Haiku 3claude-3-haiku-20240307Retired 20 Apr 2026
Claude Sonnet 3.7 and Haiku 3.5claude-3-7-sonnet-20250219, claude-3-5-haiku-20241022Retired 19 Feb 2026
Claude Opus 3claude-3-opus-20240229Retired 5 Jan 2026
Claude Sonnet 3.5 (two versions)claude-3-5-sonnet-20240620, claude-3-5-sonnet-20241022Retired 28 Oct 2025
Claude 2, 2.1 and Sonnet 3claude-2.0, claude-2.1, claude-3-sonnet-20240229Retired 21 Jul 2025
Claude 1.x and Instant 1.xclaude-1.0 to claude-1.3
claude-instant-1.0 to claude-instant-1.2
Retired 6 Nov 2024
Activesupported,recommended Legacystill available,no more updates Deprecatedworks, retirementdate announced Retiredno longer available,requests fail Anthropic says it gives at least 60 days' notice before retiring a publicly released model.
The model lifecycle terms used by the docs. Check the deprecations page before you pin a model in production.

IDs, aliases and other platforms

4. Choosing between models

The official guidance, put plainly:

If you need…Start withWhy
A sensible default for most workOpus 5.5The API docs name it the starting point for most workloads.
The hardest reasoning or very long agentic tasksFable 5.1Described as for demanding reasoning and long-horizon agentic work, or when Opus 5.5 at higher effort still falls short.
Speed with strong intelligence, lower costSonnet 5.5The best combination of speed and intelligence. The Claude Code cost guide says Sonnet handles most coding tasks well.
Huge volume or very low latencyHaiku 5.5For classification, extraction and routing.

Two sources, two slightly different defaults: the API guide starts you at Opus 5.5, while the Claude Code cost guide suggests Sonnet for everyday coding and Opus for complex architecture. Both are consistent with one rule: start with the model your plan defaults to, move down to save time and money when the task is easy, and move up when you are stuck. Test on your own tasks, because a cheaper model that passes your checks is the better choice. The docs have a choosing a model guide, and the migration guide helps when you move to a newer generation.

All of these were reachable when I wrote this post. Anthropic reorganises its docs from time to time (the Claude Code docs, for example, moved to code.claude.com), so if a link breaks, search the docs index at code.claude.com/docs/llms.txt.

Claude Code: getting started

PageWhat it covers
OverviewWhat Claude Code is, install commands, every interface.
QuickstartInstall, sign in, first questions and first change.
Terminal guide for new usersOpening a terminal and installing, step by step.
Advanced setupSystem requirements, install methods, updates, uninstall.
Troubleshoot installationMatches install and login error messages to fixes.
How Claude Code worksThe agentic loop, built-in tools, how it uses your project.
Best practicesPrompting and project setup for better results.
Common workflowsStep-by-step guides for debugging, testing, refactoring.

Claude Code: memory, settings and control

PageWhat it covers
How Claude remembers your projectCLAUDE.md, rules, imports, AGENTS.md, auto memory (Part 2).
Extend Claude with skillsSKILL.md and on-demand instructions.
Settings files and precedenceWhich settings file wins.
Configure permissionsAllow, ask and deny rules.
Choose a permission modeManual, accept edits, plan, auto and more (Part 1).
Model configurationAliases, /model, effort levels, priority order.
CommandsEvery slash command.
Manage sessionsResume, name, branch, where transcripts are stored.
Manage costs effectivelyTracking usage and reducing tokens (Part 3).
Extend Claude CodeHow CLAUDE.md, skills, MCP and the rest fit together.

Claude API and models

PageWhat it covers
Claude ConsoleCreate an account, API keys, usage and billing.
Get started with ClaudeYour first API call in several languages.
Working with the Messages APIMulti-turn chats, system prompts, stop reasons.
Models overviewThe current lineup, IDs and limits.
Choosing a modelPicking the right model for a use case.
Model deprecationsStatus and retirement dates for every model.
PricingToken prices, batch and caching rates.
Client SDKsOfficial libraries for each language.
Models APIList the models your key can use, with capabilities.

Plans, learning and help

PageWhat it covers
Claude plans and pricingPro, Max, Team and Enterprise subscriptions.
Supported countriesWhere Claude is available.
Claude AcademyFree self-paced courses, including Claude Code 101.
Support centreAccount, billing and plan help.
Community DiscordTips and support from other users.

6. Beginner-level wrap-up and glossary

  1. Part 1: set up Claude Code safely, learn the modes, and pick a model.
  2. Part 2: give Claude lasting context with CLAUDE.md, rules and skills.
  3. Part 3: spend fewer tokens, hand work off between sessions and onboard faster.
  4. Part 4: use the API when you want Claude inside your own product, and keep the model list and links handy.
  5. Next (advanced): Part 5 covers day-to-day prompting, git and troubleshooting.

The model forgets by design and the docs change often. Writing things down, and checking the official pages when something looks off, are the two habits that carry through all four parts.

TermIn plain words
APIA way for one program to talk to another. The Claude API lets your code send messages to Claude and read the replies.
API keyA secret string that identifies your account when you call the API. Treat it like a password.
ConsoleAnthropic's web dashboard for API accounts: keys, usage and billing.
SDKAn official library that makes API calls easier in a given language.
Messages APIThe main Claude API endpoint: you send a list of messages and get the next one back.
Model IDThe exact name of a model to request, such as claude-sonnet-5-5.
SnapshotA fixed version of a model. A pinned ID always gives the same model.
MTokOne million tokens, the unit prices are quoted in.
Deprecated / retiredDeprecated models still work but have a retirement date; retired models no longer respond.
← Back to all writing