Claude Code

Claude API basics: the 15-minute primer for Australian developers

Everything you need to know to start calling the Claude API from your code, endpoints, models, pricing in AUD, streaming, tool use. Plus the gotchas no tutorial mentions.

In short

The Claude API is a REST endpoint at https://api.anthropic.com/v1/messages. You send a JSON payload with model, messages and tools; you get back text (or stream text). Bills per token in USD. Use the official Python or TypeScript SDK. Default to Sonnet 4.6. Prompt caching is automatic. ~15 minutes to your first working call.

If you’re a developer wanting to call Claude from your own code (not via Claude Code, not via Claude.ai), this is the primer.

What you need

  • An Anthropic Console account (console.anthropic.com) with at least $20 USD of credit
  • An API key (Console → API Keys → Create)
  • A budget alert set on the key (Console → Settings → Billing)
  • Node 20+, Python 3.10+, or curl

The official SDKs

# TypeScript / Node
npm install @anthropic-ai/sdk

# Python
pip install anthropic

Both wrap the REST API cleanly. Skip raw fetch calls unless you have a specific reason.

Your first call (TypeScript)

import Anthropic from '@anthropic-ai/sdk'

const client = new Anthropic() // reads ANTHROPIC_API_KEY from env

const msg = await client.messages.create({
 model: 'claude-sonnet-4-6',
 max_tokens: 1024,
 messages: [
 { role: 'user', content: 'In 50 words, why does prompt caching matter for Australian businesses on a tight budget?' },
 ],
})

console.log(msg.content[0].type === 'text' ? msg.content[0].text : '')

Cost: roughly $0.001 AUD. Latency: ~2-3 seconds.

Streaming (use this for long responses)

const stream = client.messages.stream({
 model: 'claude-sonnet-4-6',
 max_tokens: 4096,
 messages: [{ role: 'user', content: 'Write a 1000-word guide to setting up Xero for an Australian sole trader.' }],
})

for await (const text of stream.streamText()) {
 process.stdout.write(text)
}

const final = await stream.finalMessage()
console.log('Total tokens:', final.usage)

Important: For requests projected to take more than ~10 minutes (large max_tokens, heavy tool use, deep web search), Anthropic refuses non-streaming calls with “Streaming is required.” Always default to streaming for any non-trivial response.

Pricing in AUD

As of May 2026, per million tokens (USD → AUD at 1.55):

ModelInput USDInput AUDOutput USDOutput AUD
Opus 4.7$15$23.25$75$116.25
Sonnet 4.6$3$4.65$15$23.25
Haiku 4.5$1$1.55$5$7.75

With prompt caching (automatic in recent SDKs), cached input tokens bill at ~10% of the normal rate.

A typical agentic session, 80k input tokens, 8k output tokens, Sonnet 4.6 with cache hits, costs around $0.40-0.80 AUD.

Tool use (the unlock)

const msg = await client.messages.create({
 model: 'claude-sonnet-4-6',
 max_tokens: 1024,
 tools: [{
 name: 'get_xero_invoices',
 description: 'Fetch unpaid Xero invoices for a given tenant',
 input_schema: {
 type: 'object',
 properties: {
 tenant_id: { type: 'string' },
 days_overdue: { type: 'number' },
 },
 required: ['tenant_id'],
 },
 }],
 messages: [{ role: 'user', content: 'Show me client invoices that are 30+ days overdue.' }],
})

Claude sees the tool, decides to call it, and returns a tool_use block instead of text. Your code executes the actual tool, sends back the result as a tool_result, and Claude continues. Loop until done.

For production tool use, use MCP. It standardises the tool definition, handles auth, handles serialisation, and works across Claude Code + your custom code. See our MCP servers guide for the four AU-business MCP servers worth wiring up first.

Prompt caching (free money)

const msg = await client.messages.create({
 model: 'claude-sonnet-4-6',
 max_tokens: 1024,
 system: [
 {
 type: 'text',
 text: 'You are a helpful AU business assistant. [long stable instructions...]',
 cache_control: { type: 'ephemeral' },
 },
 ],
 messages: [/* ... */],
})

The cache_control: { type: 'ephemeral' } marks that block as cacheable. Subsequent calls within 5 minutes that share the same prefix pay 10% of the normal input rate for that content.

In Claude Code, caching is automatic. In your own SDK calls, you opt in per-block. Long stable system prompts + tool definitions are the obvious caching candidates.

Australian-specific gotchas

  • Latency: US-east primary region adds ~180-220ms RTT from Sydney. For voice or sub-second UX, build accordingly.
  • GST on Anthropic invoices: Anthropic Console issues invoices that include AU GST (10%) since their AU tax registration in 2025. Use the invoice for BAS.
  • FX timing: Anthropic bills you in USD; your bank converts. Wise + Revolut tend to give better FX than the big four AU banks.
  • Token caps: if you hit a 429, it’s usually account-level concurrency. Email console-support@anthropic.com to request a raise.

What to build first

If you’re new to the API:

  1. Write a single Claude call that summarises a document. Verify the SDK works, the auth works, the bill is reasonable.
  2. Add streaming. See the difference.
  3. Add a tool. Watch Claude call it.
  4. Add prompt caching. Watch the cost drop.

That sequence gets you to “I can build real things on this API” in an afternoon.

If you want help shipping a Claude API-powered feature inside your business, that’s literally what our audit call scopes.

Common questions

Do I need to use a wrapper framework like LangChain?
No. Anthropic's official Python and TypeScript SDKs are excellent and most production code we ship uses them directly. Add a framework only if you've outgrown the SDK, not before.
What model should I default to?
Claude Sonnet 4.6, best price/performance for almost everything. Switch to Opus 4.7 only when reasoning quality matters more than cost. Skip Haiku 4.5 except for high-volume batch text work.
Is there an Australian region?
Not yet. Anthropic API is US-east primary, EU secondary. AU traffic routes via US-east, latency ~180-220ms from Sydney. Fine for most use cases; rough for sub-second voice interactions.

Want this built for your business?

Book a free 30-minute AI audit. We'll map your business and show you exactly which systems we'd build first. No pitch deck, no scoping fee.

Book my free AI audit