Выбор модели Claude
Компромисс Opus/Sonnet/Haiku и как выбрать — без гаданий.
Токены, контекст и стоимость
Правильно считайте токены, отличайте max_tokens от окна контекста и оценивайте стоимость.
Ваш первый вызов API
Установите SDK, пройдите аутентификацию и сделайте реальный вызов к Claude на Python, TypeScript или cURL.
API Version 2026-10-21 — The First Breaking Version in Three Years
Claude's anthropic-version header moved for the first time since 2023. What breaks, why your package manager decides when you adopt it, and the exact upgrade order.
Стриминг и многоходовые диалоги
Стримьте ответы и управляйте историей в API без сохранения состояния.
Использование инструментов / вызов функций
Определяйте инструменты, запускайте агентный цикл и обрабатывайте результаты — включая три правила формы сообщений, которые вызывают ошибки 400, и почему tool_choice "any" и "tool" теперь выдают ошибку на новейших моделях Claude.
Code Execution Tool — Sandboxed Bash, Files, and Python
Anthropic's server-side sandbox lets Claude run Bash, edit files, and execute Python — with 5 GiB of RAM, 30-day container reuse, and a 1,550-hour monthly free tier. The three tool versions, what each adds, when it's free, and the file-capture gotcha nobody documents.
Зрение, PDF и ввод файлов
Отправляйте изображения и документы и повторно используйте загрузки через file_id.
Структурированный вывод
Получайте JSON, соответствующий схеме, на который можно положиться — а не «промпт и молись».
Расширенное мышление и усилие
Адаптивное рассуждение и контроль усилия — выбор глубины в зависимости от нагрузки.
Настройка effort: 5 уровней, значения по умолчанию для моделей и ловушка кэша
У параметра effort (июль 2026) пять уровней — low, medium, high, xhigh, max — и он находится внутри output_config, а не на верхнем уровне. Он влияет на вызовы инструментов (а не только на рассуждение), сбрасывает кэш промпта при смене посреди разговора, а у каждой модели своя рекомендуемая отправная точка. Практическое руководство по настройке.
The advisor tool: Sonnet does the work, Fable does the thinking
The advisor server-tool (beta advisor-tool-2026-03-01) lets a fast executor model consult a stronger model mid-turn. Full field reference, the token-accounting trap most integrators miss, the model pairing matrix, and the exact prompts Anthropic ships in production.
Task Budgets — Advisory Token Caps That Make Agents Finish Gracefully
The March 2026 Messages-API beta gives Claude a token budget for the whole agentic loop — thinking, tool calls, tool results, output — so long-running agents self-regulate and wrap up cleanly instead of running away. How the countdown works, why it's advisory not enforced, and how to size it so it doesn't cause refusal-like behavior.
Кэширование промптов и оптимизация затрат
Повторно используйте стабильный префикс промпта, чтобы снизить затраты и задержку, — и о подвохе, который всё ломает.
Cache Diagnostics — Find Out Exactly Why Your Cache Missed
Stop guessing why cache_read_input_tokens is zero. The API will tell you which part of your prompt diverged, and by how many tokens.
Message Batches — Async Jobs at 50% Off
Cut cost in half and lift throughput by moving bulk work to the async Batches API — with the gotchas that trip people up.
Mid-Conversation System Messages
Steer a long agent session without blowing up the prompt cache — the new system role you can append after any user turn.
Mid-Conversation Tool Changes
Add and retire tools between turns without invalidating the prompt cache — the Opus 5 beta that fixes the biggest hidden tax on long agent sessions.
Создание агентов на API
Один вызов против рабочего процесса против собственного агента — тест на выбор и проектирование цикла.
Управляемые агенты
Цикл агента, размещённый Anthropic: агенты против сессий, окружения, память, хранилища секретов и запланированные развёртывания (cron).
Managed Agents Memory Stores
The July 2026 beta — server-side persistent memory that mounts into a Managed Agents sandbox, with versioning, audit trail, and redaction.
Managed Agents Session Budgets
The August 2026 beta — hard dollar caps on a Managed Agents session, enforced at public list rates, with the budget_reached stop reason, the one-request overshoot, and the pause-and-resume model.
Managed Agents Domain Restrictions
The August 26, 2026 beta — allowed_domains, blocked_domains, max_content_tokens, and user_location on web_search and web_fetch inside Managed Agents. Format rules, multiagent semantics, mid-session updates, and the url_not_allowed error.
Cowork и команды агентов
Агентное настольное рабочее пространство и многоагентное сотрудничество как продукты.
MCP и подключение к инструментам
Вызывайте удалённые MCP-серверы прямо из Messages API — форма запроса, списки разрешений и запретов, отложенная загрузка и ограничения, которые дают о себе знать в продакшене.
MCP 2026-07-28: The Stateless Spec
The biggest MCP revision since launch: the session is gone, every request self-describes, and any server instance can answer any call. What actually changed on July 28, 2026, and how to migrate without breaking today's servers.
MCP Apps: Interactive UIs Inside a Tool Call
MCP Apps (SEP-1865) lets an MCP server ship an HTML UI that the client renders inside a sandboxed iframe — with every action still routed through the standard JSON-RPC audit path. What the spec actually says, what to build with it, and what to refuse to build.
MCP Tasks: Long-Running Work Without the Session
The 2026-07-28 stateless MCP spec killed the session — so how do you model a 20-minute CI job, a batch import, or a human approval gate? With the official Tasks extension (SEP-2663). Full lifecycle, wire protocol, migration from the old experimental Tasks API, and the polling/notification patterns that actually work in production.
Playwright MCP: The Deep Practical Guide (2026)
Microsoft's Playwright MCP is now the #1 MCP server in the world — ahead of GitHub and Figma. The bit almost nobody teaches: the default accessibility-snapshot mode is not just faster than vision, it's a completely different automation paradigm. Profiles, opt-in caps, browser-extension mode that attaches to your real Chrome, the token-cost fight against Playwright-as-a-Skill, and the security line you must not cross.
Безопасность, отказы и запасные варианты
Корректно обрабатывайте отказы и отличайте их от блокировок классификатора.
Server-Side Fallbacks & Fallback Credit
The Opus 5 beta that turns a Fable 5 / Opus 5 refusal into a normal answer inside one API call — plus the credit token that stops you from paying the prompt cache twice on the retry.
Ошибки, лимиты частоты и надёжность
Карта ошибок, повторы с задержкой, уровни лимитов частоты и миграция моделей.
Память и редактирование контекста
Дайте агентам постоянную память и автоматически очищаемый контекст — клиентский инструмент memory tool плюс редактирование контекста, которое удаляет устаревшие результаты инструментов, чтобы пережить длительные запуски.
Conversation Compaction — Summarize History Server-Side and Keep Going
The Messages API can summarize a conversation into one signed block you send back in place of the messages it replaces. The four flavors (on-demand, keep-tail, background, threshold), the swap rules, the two mistakes that fail silently with HTTP 200, and what a summary can never carry.
Tool Search & Deferred Loading
Scale to thousands of tools without context bloat: how defer_loading and the tool search tool actually work, the five 400s they produce, and why your request body does not get smaller.
Message Threads — Send Only the New Turn
The Messages API can keep your conversation on the server and let each turn send only the new messages. What it actually saves (bytes and latency, not tokens), the replay path you must build before you ship, the three field groups, and the 4-breakpoint cache limit.
Программный вызов инструментов
Позвольте Claude вызывать ваши инструменты из Python внутри песочницы code-execution — сокращая количество обменов и удерживая промежуточные результаты вне контекста.
The Admin API: automate your Claude org
The operator's guide to Anthropic's Admin API — list members, invite users, run RBAC groups, offboard cleanly. Console + Claude Enterprise, with the seat-pool and SSO gotchas that trip real teams.
Agent Observability: Tracing an Agent You Can't Reproduce
An agent run is a non-deterministic distributed trace, so you cannot debug it by re-running it — you have to have recorded it. This page covers what to record: the OpenTelemetry GenAI span shapes (and why every gen_ai.* attribute is still 'Development'), Claude Code's exact metric and event names, the request-id that links your trace to Anthropic support, and the three privacy traps in agent telemetry.
First-Party OpenTelemetry Tracing: Two Paths, One Trace
Since October 2026 the Claude API and the Claude SDK emit OpenTelemetry spans themselves — no hand-rolled instrumentation. But the two paths overlap, and summing both will double your token numbers. This page covers the setup for each, the one rule that keeps token counts honest, the traceparent flag that silently deletes your traces, and the delivery rules that disable a destination after 24 hours.
The Usage & Cost Analytics API: Attribute Every Dollar
The practical guide to Claude's Usage and Cost Analytics API — the beta that replaced the legacy usage_report and cost_report endpoints. Row shape, the five-dimension limit, actor semantics, the 100x cents footgun, data-freshness rules that break naive dashboards, and the legacy migration table.
Inference Hooks: inline DLP for Claude Enterprise
The operator's guide to Claude Enterprise Inference Hooks — the HTTPS webhook that lets your DLP server allow or deny every prompt across chat, Claude Code, and Cowork, before the model sees it. Full spec, verdict schema, signing, rollout playbook.
User Profiles & Enforcement: Don't Let One Customer Ban Your Whole Org
The operator's guide to Claude API user profiles — attribute every request to an end customer so a safety restriction or ban lands on one profile instead of your entire organization. Full field reference, the four enforcement_status values, the enac_ action schema, organization webhooks, and the polling loop you need because event delivery isn't live yet.