# Hit the Anthropic API directly: the practitioner build that beats no-code at scale

Source: https://getstartedwithai.net/tutorials/anthropic-api-practitioner-build
Site: Get Started With AI
Tagline: Build AI automations that actually run your business.
Audience: solo professionals, freelancers, consultants and AI implementers in training
Contact: hello@getstartedwithai.co.uk

This Markdown companion is generated from the prerendered page for AI crawlers.
# Hit the Anthropic API directly: the practitioner build that beats no-code at scale

Four production builds shipped from one Anthropic API key in under four hours of total work: a customer-support chat, a tool-using agent, a document QA setup, and a browser-automation script. The docs assume you know which endpoint solves your problem. This guide walks through Messages, Tools, Computer Use and Files with worked Python and TypeScript code on real use cases. Each build runs as a working feature in your own product or as a packaged automation for a client by the end of the same hour.

## Prep before you build (10 minutes)

- An Anthropic Console account at console.anthropic.com. Add a billing source; the four builds in this tutorial cost under £2 in API fees.
- Python 3.10+ or Node 20+. Either works. Examples below show both.
- A code editor. Cursor or VS Code is fine.
- Four hours total across the four builds. Each one ships in under an hour.

## Step 1: Set up the API key (5 minutes)

1. In the Anthropic Console, go to API Keys, click Create Key.
2. Save the key in your shell environment: export ANTHROPIC_API_KEY=sk-ant-...
3. Install the SDK: pip install anthropic (Python) or npm install @anthropic-ai/sdk (TypeScript).
4. Test with a one-liner: print(anthropic.Anthropic().messages.create(model="claude-sonnet-4-6", max_tokens=100, messages=[{"role":"user","content":"Hello"}])).

## Step 2: Ship a customer-support chat with Messages (45 minutes)

The Messages endpoint handles chat completion. The build below answers customer questions using your own product knowledge in the system prompt.

1. Write a system prompt that loads your product knowledge: 200 to 400 words covering pricing, features, common issues.
2. In Python: client.messages.create(model="claude-sonnet-4-6", max_tokens=1024, system=SYSTEM_PROMPT, messages=conversation).
3. Wrap the call in a small Flask or Express endpoint that takes a user message and returns the assistant reply.
4. Add conversation history: append each user and assistant message to the messages array between calls.
5. Test with five real customer questions. Edit the system prompt where the answer drifts.
6. Deploy to Vercel or Render. Total build time: 45 minutes for a working chat feature.

## Step 3: Ship a tool-using agent with Tools (50 minutes)

The Tools endpoint lets Claude call your own functions. The build below schedules calendar invites by interpreting natural language.

1. Define a tool schema: { name: "create_calendar_invite", input_schema: { properties: { title, attendees, start_time, duration_minutes } } }.
2. Pass tools=[that schema] to messages.create. When Claude wants to call it, the response includes a tool_use block.
3. In your code, parse the tool_use block, run your real function (Google Calendar API or similar), and pass the result back as a tool_result block.
4. Loop until Claude returns a final stop_reason of end_turn instead of tool_use.
5. Test: "Schedule a 30 minute call with sam@example.com for Thursday afternoon." The agent calls your function with the right arguments.
6. Deploy. The agent is now a working scheduling assistant.

## Step 4: Ship a document QA setup with Files (45 minutes)

The Files API lets you upload documents and ask questions across them. Useful for product manuals, contract review, internal SOPs.

1. Upload a PDF: client.beta.files.upload(file=("manual.pdf", open("manual.pdf","rb"), "application/pdf")) with the anthropic-beta: files-api-2025-04-14 header. Save the returned file_id.
2. In your messages call, reference the file: { type: "document", source: { type: "file", file_id } } in the user message content.
3. Ask a question: "According to this manual, what is the warranty period for product X?"
4. Claude reads the document and returns the answer with the page reference.
5. Wrap in a small endpoint that takes a question and a file_id, returns the answer plus citations.
6. Test on three real documents. Verify the citations point to the right pages.

## Step 5: Ship a browser-automation script with Computer Use (55 minutes)

Computer Use drives a browser. The build below logs into a SaaS dashboard, exports a CSV, and uploads it to S3.

- Set up the Computer Use sandbox per the docs. Use the official Anthropic-hosted environment for first build.
- Define the task: "Log in to dashboard.example.com, open Reports, click Export CSV, save the file."
- Pass the screenshot tool and the action tools (click, type, scroll) to messages.create with model="claude-sonnet-4-6".
- Claude takes screenshots, clicks the right buttons, types credentials from your env vars, downloads the file.
- Add an upload step: when the download completes, push the file to S3 with the existing AWS SDK.
- Cost note: Computer Use is the most expensive endpoint. Each task costs £0.20 to £2.00. Run sparingly and cache results.

## What you ship

Four working API features running on real inputs: a support chat answering real questions, a scheduling agent calling real calendar APIs, a document QA endpoint citing real pages, a browser automation exporting real CSVs. Around four hours of build time replacing weeks of engineering scoping for a typical SaaS product team.

## What to build next

Pair this with the Claude Code practitioner guide for the local script equivalents, and the AI workflow patterns tutorial for the higher-level shapes that the API endpoints fit inside.

## Related builds

More tutorials in Vibe Coding. Each one runs in 60 to 90 minutes and ships a finished asset.

### Ship a small client tool in 90 minutes: the Cursor build for non-coders

60 to 90 minutes. Solo Pro.

[Open tutorial](/tutorials/cursor-for-non-coders-90-min)

### Ship code changes in a day, not a week: the practitioner Claude Code build

60 to 90 minutes. Solo Pro / Implementer.

[Open tutorial](/tutorials/claude-code-practitioner-guide)

### Ship a working app in an afternoon: the Lovable build

90 minutes. Solo Pro / Implementer.

[Open tutorial](/tutorials/lovable-ship-app-in-afternoon)

### Demo a client-facing tool in an hour: the Bolt.new prototype build

90 minutes. Implementer.

[Open tutorial](/tutorials/bolt-new-prototype-client-tools)

## Questions people ask before they start

### Do I need to know Python or TypeScript?

A small amount. The SDKs are simple and the docs include working examples. Most build time is on the prompt and the integration, not the language itself.

### How much do the four builds cost in API fees?

Around £1 to £2 total for the four builds in this tutorial. Production usage scales with traffic; a moderate support chat costs £20 to £100 a month at typical SMB volume.

### How does this compare to using the OpenAI API?

Both APIs have the same shape. Claude wins on long-context document tasks, voice fidelity and code generation. OpenAI wins on raw speed for short tasks. Most teams pick by use case.

### Is Computer Use ready for production?

For internal automation jobs, yes, it ships reliably. For customer-facing flows, no, the cost and unpredictability are too high. Treat it as a back-office tool, not a customer experience.

### How much should I charge to ship an Anthropic API feature for a client?

A four-feature API build typically runs £4,000 to £12,000. The package covers discovery and build, plus deploy, training and monthly support.
