Home › Claude API tutorial for beginners
Claude API tutorial for beginners
Every Claude API call is a POST to the Messages API with a model, a max_tokens limit and a list of messages.
Sign up and log in
- Create a Claude Console account at platform.claude.com.
- Create an API key.
- Export it: export ANTHROPIC_API_KEY="your-api-key-here" (the SDKs read it automatically).
- Make a first request with curl to https://api.anthropic.com/v1/messages, or install the Python or TypeScript SDK.
- Optional: the Anthropic CLI (brew install anthropics/tap/ant, then ant auth login) for calls from the terminal.
Step by step
- Create a Console account and an API key.
- Export ANTHROPIC_API_KEY in your terminal.
- Send a POST to https://api.anthropic.com/v1/messages with headers x-api-key, anthropic-version: and content-type: application/json.
- In the body, set "model": "claude-opus-5-5", "max_tokens": 1000 and your message.
- Read the reply in content[0].text, and note the token counts in usage.
Try it: examples
- First message
What should I search for to find the latest developments in renewable energy?
Good to know
- Pick the model by job: Haiku for fast, cheap, high-volume work; Sonnet for everyday coding and agents; Opus for long, complex tasks.
- max_tokens caps the length (and cost) of each reply.
- US-only inference is available at 1.1x pricing.
Prices (US$)
Per million tokens on claude.com/platform/api: Haiku 5.5 US$0.10 input / US$0.50 output (prompts up to 100K), Sonnet 5.5 US$2 / US$10, Opus 5.5 US$4 / US$20, Fable 5.1 US$10 / US$50. Batch processing saves 50%.
Sources (official pages, read Nov 8, 2026)
Written from Anthropic's official documentation and product pages; we don't run hands-on tests. Features and limits vary by plan and country.