anthropics/anthropic-sdk-python is a Python library that lets applications communicate with the Claude API. It is for Python developers building software that uses Claude.
Borrowing it
Nothing to install: this file belongs to anthropics/anthropic-sdk-python. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/anthropics/anthropic-sdk-python/main/CLAUDE.mdgit clone --depth 1 https://github.com/anthropics/anthropic-sdk-pythonWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/anthropics/anthropic-sdk-python/claude-md)<a href="https://agentmods.dev/instructions/anthropics/anthropic-sdk-python/claude-md"><img src="https://agentmods.dev/badge/instructions/anthropics/anthropic-sdk-python/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/anthropics/anthropic-sdk-python/claude-md"><img src="https://agentmods.dev/badge/instructions/anthropics/anthropic-sdk-python/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.07537 | $0.07537 |
| Opus 5.5 | $0.03015 | $0.03015 |
| Sonnet 5.5 | $0.01507 | $0.01507 |
| Haiku 4.5 | $0.00754 | $0.00754 |
Grade A, and why
anthropic-sdk-python CLAUDE.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 370 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Working in this repository
Context for contributors (human or AI) on how this SDK is put together, plus the things reviews most often come back to. Setup instructions live in CONTRIBUTING.md.
Overview
The official Python SDK for the Claude API (anthropic on PyPI). This is the v1 line: it is built on httpx2 and needs Python 3.10 or later (requires-python in pyproject.toml).
Most of it is generated from the OpenAPI spec. Hand-written helpers, tool runners, credentials, middleware, and platform clients sit on top.
Who owns which files
src/anthropic/lib/,examples/, andtests/lib/are hand-written. The generator never touches them.- Everything else comes from the generator, with custom code mixed in. Generated files carry no marker comment. Hand-written methods, imports, and whole blocks sit inside many of them, including core modules such as
_client.pyand_base_client.py. So a file's location doesn't tell you who owns a given line. The next section says how to tell. .stats.ymland.github/workflowsare generator-owned too. Avoid editing them, because the next codegen push rewrites them and a change tends to conflict.src/anthropic/_vendor/is vendored. Re-copy it from upstream rather than editing it.- Release-please writes
src/anthropic/_version.py,.release-please-manifest.json, andCHANGELOG.md. It rewrites them in each release PR, so a manual edit is overwritten or conflicts with it.
Editing generated files
- Check whether a line is generated before you change it. Every commit the generator produced carries a
Stainless-Generated-From: <sha>trailer, and a hand-written commit has none. The SHA is the generator's own output for that commit, with no custom code in it.- Find the latest one with
git log -1 --grep='Stainless-Generated-From' --format='%(trailers:key=Stainless-Generated-From,valueonly)'. - Fetch it with
git fetch origin <sha>, then diff a file against it:git diff <sha> -- src/anthropic/resources/messages/messages.py. - Lines that appear only on your side are custom code. If the line you want to change is in the generated commit, the fix probably belongs in the generator (see below).
- Find the latest one with
- Where the lines go matters, not how many. Edits to generated files survive regeneration, because new generator output is merged with them, but the merge can conflict.
- Changing lines the generator writes, such as a method's parameters or the way it builds the request, is likely to conflict the next time the spec changes.
- Adding lines of your own, such as a new method or a block inside a method body, is usually fine, even a large one.
AsyncWork.pollerandAsyncWork.workerinresources/beta/environments/work.pyare whole methods added after the generated ones, with theirlib/imports inside the method body.
- No provenance comments. Don't add a comment that marks code as hand-written or mentions Stainless, and remove one from a block you are already editing.
- Fix generator-owned behaviour upstream.
- Broken generated plumbing (retries, SSE parsing, serialization) is a generator bug.
- A real response the generated types can't parse is a spec bug.
- The model name in
tests/api_resources/comes from the spec'sexample.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- yesterday Changed · +1 tokens per session 410752be2f4c
- 3d ago Changed · +1 lines · +62 tokens per session 8330c7ec1c02
- 1mo ago Changed · +27 lines · +319 tokens per session e72fafbc304f
- 1mo ago First seen · 342 lines · 7,155 tokens per session scan A 14903d9e29b0
anthropic-sdk-python CLAUDE.md is an instructions file published in the GitHub repository anthropics/anthropic-sdk-python (4,047 stars, last pushed yesterday), licensed Apache-2.0. It adds 7,537 tokens to every session, about $0.0301 per session on Opus 5.5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-23.
anthropic-sdk-python CLAUDE.md compared with instructions from other repositories
| Mod | Type | Stars | Last push | Licence | Scan | Tokens | Works with |
|---|---|---|---|---|---|---|---|
| anthropic-sdk-python CLAUDE.mdanthropics/anthropic-sdk-python | Instructions file | 4.0k | yesterday | Apache-2.0 | A | 7,537 | Claude Code |
| vscode buildNext.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 9,719 | GitHub Copilot |
| next.js AGENTS.mdvercel/next.js | Instructions file | 143k | today | MIT | A | 7,461 | Codex, OpenCode |
| langchain AGENTS.mdlangchain-ai/langchain | Instructions file | 149k | yesterday | MIT | A | 4,680 | Codex, OpenCode |
| vscode oss-third-party-notices.instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 5,516 | GitHub Copilot |
| vscode copilot-instructions.mdmicrosoft/vscode | Instructions file | 195k | yesterday | MIT | A | 3,093 | GitHub Copilot |
| deepseek-harness AGENTS.mddeepseek-ai/deepseek-harness | Instructions file | 274k | 2d ago | MIT | A | 4,313 | Codex, OpenCode |