1In one sentence
The API is how a program talks to Claude directly: it sends a message and gets an answer back as data, so you can build Claude into your own app, website or workflow.
2New words
- API (application programming interface) — a door for programs. Instead of a chat window, your code sends requests and receives responses.
- API key — a long secret string that identifies your account. Anyone with it can spend your money; treat it like a password.
- Request and response — what you send (the message, the model, settings) and what comes back (the answer plus information such as how many tokens were used).
- Token — the unit Claude counts text in, roughly three-quarters of a word. You pay per token in and out.
- Console — Anthropic's website for developers, where you get keys, see usage and set spending limits.
3Why you would want it
Everything in this guide so far is a person talking to Claude. The API is Claude inside something: a support bot on your site, a tool that summarizes every incoming document, a nightly report. It is pay-as-you-go, and the cheapest models cost a fraction of a cent per request.
4Try it now
(an Anthropic developer account)
- Create an account at the developer console, add a small amount of credit, set a monthly spending limit, and create an API key. (Max, Ultra and Team plans now include monthly API credits; claim them under Billing in your Claude settings by linking a console account.)
- In the console's workbench, send a test message to the smallest model and read the response.
- Ask Claude Code: Write a 20-line script that sends a message to the Claude API using my key from an environment variable, and prints the answer. Run it.
5What you will see
[Picture pending: the console workbench with a request and its response.] A response that contains the answer text, which model answered, why it stopped, and the token counts. Your script prints the text. The console shows the cost.
6Watch out
- Never paste a key into chat, code you share, or a file in a repo. Keep it in an environment variable or a secrets store.
- Set a spending limit before the first real use. A loop that calls the API by mistake can spend quickly.
- Old models retire. On November 30, 2026, Claude Sonnet 4.5 stops working on the API and fast mode for Opus 4.8 is removed; move scripts to Sonnet 5.5 or Opus 5.5.
7Go further
Change the model name and the settings in your script and compare answers and cost. Chapter 6.7 lists the API features that make the difference between a demo and a product.
