The anthropic api docs are the starting point for building an application with Claude: open https://platform.claude.com/docs/ and look for the API overview, Messages API reference, and model documentation. For a first integration, use the official Python SDK to send one message, inspect the response, and then test a few failure cases. You do not need an agent framework to make that first request.
Documentation locations and model availability can change, so follow the navigation on Anthropic's site if a page moves. In particular, confirm the model ID and account access there rather than copying an old model name from a tutorial.
Find the pages that matter
The anthropic api docs contain both conceptual guides and endpoint references. Start with the Messages API reference when you need the exact request fields and response structure. Use the model documentation to choose an available model ID, compare capabilities, and check context limits. The SDK documentation explains language-specific installation and usage.
For an application that calls external functions, read the tool-use guide next. It explains the exchange between your application and the model: the model can request a tool, but your application is responsible for deciding whether to run it and returning the result. For long-running responses, find the streaming guide; for high-volume, noninteractive work, check the batch documentation and its current constraints.
The pricing page is separate from the code example for a reason: usage costs depend on the selected model and the amount of input and output processed. Check current rates and account limits before running a large job. A successful local request establishes connectivity, not a budget or a performance guarantee.
Make one request with Python
Let's start with the smallest useful version. You need Python 3, an Anthropic account with API access, an API key, and a model ID available to that account. A Claude chat subscription does not automatically establish that your API account has the required access or billing configured.

In a terminal, create and activate a virtual environment. On macOS or Linux, run these commands one at a time:
python3 -m venv .venv
source .venv/bin/activate
python -m pip install anthropic
On Windows PowerShell, create the environment with python -m venv .venv and activate it with .venv\Scripts\Activate.ps1. If your execution policy blocks activation, consult your organization's policy or invoke the environment's Python executable directly. Record the installed SDK version with python -m pip show anthropic so you can reproduce the setup later.
Set ANTHROPIC_API_KEY in your shell without putting the secret in source control. On macOS or Linux, use export ANTHROPIC_API_KEY='your-key'. In PowerShell, use $env:ANTHROPIC_API_KEY='your-key'. Replace the placeholder with your actual key, and avoid sharing terminal history or screenshots containing it.
Set a second environment variable, ANTHROPIC_MODEL, to a model ID copied from the official model documentation. Use the same shell syntax, replacing the variable name and value. This keeps the example independent of a particular model release.
Now run this single-line Python command:
python -c 'import os, anthropic; client = anthropic.Anthropic(); response = client.messages.create(model=os.environ["ANTHROPIC_MODEL"], max_tokens=128, messages=[{"role":"user","content":"Reply with one short greeting."}]); print(response.content); print(response.usage)'
This shell quoting is intended for macOS or Linux. On Windows, put the Python statements in a .py file and run that file with your virtual environment's Python interpreter; check the anthropic api docs for the equivalent SDK example if your shell changes the quotation marks. The SDK reads the API key from the environment, sends a user message, and prints the returned content blocks and usage. The exact greeting and usage values will vary.
A content block is not necessarily just a string. For a production application, handle the block types your workflow allows rather than assuming every response contains exactly one text block. The max_tokens setting caps generated output; it does not cap the input you send.
Debug the request before adding features
If the command fails, read the error and the relevant anthropic api docs before changing several settings at once. An authentication error points you toward the key and its environment variable. A permissions or model-access error calls for checking the account, model ID, and available access. A billing or quota error may require an account administrator to update the account or limits.

A rate-limit response means the application should slow down. For transient failures, use bounded retries with exponential backoff and respect any retry guidance returned by the service. Do not blindly retry invalid requests or authentication failures; those need a configuration or code change. Set a timeout appropriate to your workload and make sure a retry cannot accidentally repeat a consequential downstream action.
If the answer is cut off, inspect the response's stop reason and output-token limit. A larger output allowance may help, but it can increase cost and latency. If the request is too large, reduce or split the input, then verify that each chunk retains the context necessary for the task.
Move from a demo to a dependable workflow
The anthropic api docs describe request mechanics; your application still needs a test plan. Start with a small set of representative inputs and expected properties. For a document extractor, include a clean document, one with a missing field, and one containing instructions that conflict with your task. Check whether the output contains the required fields and whether missing information is marked as unknown instead of invented.
Treat documents and tool results as untrusted input. Do not let text inside a document grant itself permission to send email, query a database, or reveal secrets. Validate tool arguments in your own code, restrict credentials, and require human approval for consequential actions. Model output is a proposal, not an authorization decision.
Track model ID, SDK version, input size, output size, latency, and error category for each request where appropriate. Avoid logging API keys or sensitive document contents. Use token counts and published rates to estimate cost, then check actual account usage; retries and longer prompts can change the total.
Finally, revisit the anthropic api docs when upgrading the SDK or changing models. Run the same test cases before and after the change, and review differences in output and failure behavior. Build the smallest useful version, then test what breaks.

No feedback yet — submit the first.