Home › Claude API tutorial for beginners

Claude API tutorial for beginners

Last checked

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

  1. Create a Claude Console account at platform.claude.com.
  2. Create an API key.
  3. Export it: export ANTHROPIC_API_KEY="your-api-key-here" (the SDKs read it automatically).
  4. Make a first request with curl to https://api.anthropic.com/v1/messages, or install the Python or TypeScript SDK.
  5. Optional: the Anthropic CLI (brew install anthropics/tap/ant, then ant auth login) for calls from the terminal.

Step by step

  1. Create a Console account and an API key.
  2. Export ANTHROPIC_API_KEY in your terminal.
  3. Send a POST to https://api.anthropic.com/v1/messages with headers x-api-key, anthropic-version: and content-type: application/json.
  4. In the body, set "model": "claude-opus-5-5", "max_tokens": 1000 and your message.
  5. Read the reply in content[0].text, and note the token counts in usage.

Try it: examples

Good to know

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.

Report an error on this page