published fresh until

Anthropic's Claude API cost guide and /claude-api cost-optimize: find what drives your API bill

Summary As of November 2026, /claude-api cost-optimize still profiles Claude API spend before proposing changes. The October 29 Usage and Cost Analytics API adds a new reporting route; the earlier Usage and Cost API is now legacy but remains supported. Do first: audit one app with a cost-per-completed-task baseline.

Not for attributing the LLM bill to customers or features; see llm-api-bill-cost-per-customer-feature-tagging

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

As of November 2026, start with /claude-api cost-optimize in your application's repository, and measure cost per completed task before changing prompts, models, or effort.

Do first: run /claude-api cost-optimize and give it a quality bar plus existing usage logs or organization reporting access. Anthropic's cost-optimization procedure, read November 3, prioritizes existing usage history, then an approved baseline run, then a clearly labeled estimate.

What was published

Anthropic's post Reducing cost and improving performance with Claude Platform (Lance Martin, 8 September 2026; its benchmarks were re-run for Opus 5.5, which launched on 22 September), announced by @ClaudeDevs. It covers keeping prompt-cache prefixes stable, trimming what each request carries, removing prompt patterns written for older models, bounding output, the Batch API, and choosing effort level and model.

The cost-optimize command

In Claude Code, inside your application's repository, run /claude-api cost-optimize. It is a mode of the claude-api skill that ships with Claude Code (source in anthropics/skills, Apache-2.0). The workflow:

1. Sets the scope, your quality bar (an eval or tests) and a baseline cost per completed task. 2. Profiles where tokens go: from the Usage and Cost Admin API if you have an Admin API key, from your app's logged usage objects, or estimated from the request-building code. 3. Ranks levers. "Free wins" (caching, input and output hygiene, batching) come before tradeoffs (effort, model choice, budgets), and tradeoffs are marked as needing an eval before you apply them. 4. Proposes one diff per lever by default: a bare /claude-api cost-optimize invocation only proposes. Free wins may be applied when edits were requested; tradeoffs require explicit acceptance of their measured quality cost. It asks before any step that spends API money, or agrees a measurement budget covering those runs. See the current procedure.

Anthropic reports 24% (SWE-bench Verified) to about 73% (tau2-bench retail) lower cost on four public benchmarks with little change in scores. These are Anthropic's own runs.

Who it is for

Teams paying for Claude API traffic from their own app. For Claude Code usage on a subscription, see the threads on prompt caching and token measurement instead.

Caveats

  • Legacy Admin API keys are for organisations, not individual accounts, and those legacy usage reports don't cover Bedrock, Vertex or Foundry traffic. Match the new Analytics API to its provider and credential requirements below.
  • Without an eval, only the free wins are safe to apply.

Sources

Primary sources: Anthropic's post Reducing cost and improving performance with Claude Platform (Lance Martin) and the claude-api skill in anthropics/skills, both read on 18 October 2026.

  • Confirms: the topics listed above, /claude-api cost-optimize profiling token spend and ranking free wins ahead of tradeoffs, using Admin API usage and cost reports if you have an Admin API key, one diff per lever, proposed by default, approval before spending API money, and the skill's Apache-2.0 licence. The four benchmarks are LegalBench (about 67%), tau2-bench retail (73%), OfficeQA Pro (72%) and SWE-bench Verified (24%) lower cost.
  • Corrected above: the post is dated 8 September 2026 and says the benchmarks were re-run for Opus 5.5, which launched on 22 September; it does not give an update date. The 24% SWE-bench figure came from medium effort and concise output, because caching was already in place.

A smaller max_tokens is a truncation backstop, not a quality-preserving optimization: the current procedure measures completed tasks and treats truncated attempts as failures.

New reporting API, October 29

Anthropic's October 29 release notes launched the Usage and Cost Analytics API and marked the earlier Usage and Cost API as legacy. The legacy endpoints remain supported; this is not an immediate shutdown.

The current Analytics reference, read November 3, documents:

  • GET /v1/organizations/analytics/usage and /v1/organizations/analytics/cost;
  • the beta header analytics-usage-cost-2026-08-24 and an anthropic-version header;
  • Console organization Admin credentials, or Enterprise credentials with read:analytics;
  • availability on Claude Platform on AWS through its base URL, authentication and regional IAM permissions.

Do not assume the skill's older Admin-report instructions describe every current reporting option. Match the endpoint and credentials to the organization and provider, or use the application's own logged usage objects.

Evidence: Ishikawa's August 27 DevelopersIO report describes trying the command. It supports the workflow's availability, not a general savings percentage or a trial of the October API.

Limits

An estimate from request-building code is not a measured bill. Model and effort changes need an evaluation; a profiling report alone cannot establish unchanged answer quality. Third-party provider billing must be reconciled with that provider's records.

Not for: reducing Claude Code subscription limits or attributing spend to individual customers; see llm-api-bill-cost-per-customer-feature-tagging.

checked 2026-11-03

Started from a post by @ClaudeDevs, packaged by the editor. Original post

Subjects

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Anthropic's Claude API cost guide and /claude-api cost-optimize: find what drives your API bill
Summary: As of November 2026, /claude-api cost-optimize still profiles Claude API spend before proposing changes. The October 29 Usage and Cost Analytics API adds a new reporting route; the earlier Usage and Cost API is now legacy but remains supported. Do first: audit one app with a cost-per-completed-task baseline.
Copy for agent
get the whatworks thread claude-api-cost-optimize-guide and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread claude-api-cost-optimize-guide
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks