All insights

Model APIs

Claude Opus 4.5 API: Direct Anthropic Integration Guide

Make a direct Claude Opus 4.5 API request with Anthropic’s Messages API, including the required version header, API key setup, response extraction, pricing, and lifecycle guidance.

Illustration for Claude opus 4.5 api

Yes—you can call Claude Opus 4.5 through Anthropic’s API. This guide covers the direct Anthropic Claude API, not AWS Bedrock or an API aggregator. The endpoint is https://api.anthropic.com/v1/messages, and the model ID is claude-opus-4-5-20251101. Anthropic lists Opus 4.5 as Active (legacy), says it remains available, and recommends considering migration to Claude Opus 5.5. The listed retirement date is not sooner than November 24, 2026—a lower bound, not a confirmed retirement date. (platform.claude.com)

Make your first direct API request

Prerequisites: a Claude Console account, an Anthropic API key, curl, and jq. To create a key, sign in to the Claude Console, open API keys, choose Create key, and copy and store the key securely. The Console shows the full key only when it is created. (platform.claude.com)

Set ANTHROPIC_API_KEY in your shell or secret manager before running this Bash example. Keep the key private; don’t put it in client-side code or commit it to a repository.

: "${ANTHROPIC_API_KEY:?Set ANTHROPIC_API_KEY first}"

if ! curl --fail-with-body -sS https://api.anthropic.com/v1/messages \
  -H "Authorization: Bearer $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2026-10-21" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-opus-4-5-20251101",
    "max_tokens": 256,
    "messages": [
      {"role": "user", "content": "Reply with one short sentence confirming the API connection."}
    ]
  }' -o response.json; then
  cat response.json
  exit 1
fi

jq -r '.content[] | select(.type == "text") | .text' response.json

The request uses POST /v1/messages. Anthropic’s API versioning documentation says the anthropic-version header is required and gives 2026-10-21 as an example. The response guide shows a successful message response with a content array containing text blocks; the jq command above prints their text. (platform.claude.com)

If your API key is not scoped to a workspace, Anthropic says to also send the anthropic-workspace-id header for Claude API requests. For failed requests, inspect response.json printed by the command and consult Anthropic’s API errors documentation; it explains HTTP error types, error response shape, and request IDs. (platform.claude.com)

Don’t mix provider routes or model IDs

This example uses Anthropic’s API key, endpoint, and model ID. Bedrock and aggregator integrations use their own credentials, endpoints, and model identifiers; they are not interchangeable with the direct Anthropic request above. Anthropic’s model reference lists a separate Amazon Bedrock InvokeModel ID: anthropic.claude-opus-4-5-20251101-v1:0. (platform.claude.com)

For direct API onboarding, use Anthropic’s API overview and Messages API reference. If your application is built around a cloud provider or aggregator, follow that provider’s current documentation instead of swapping only the model ID into this command. (platform.claude.com)

Model limits and lifecycle to account for

Anthropic lists a 200,000-token context window and a 64,000-token maximum output for Opus 4.5. These are model limits, not a reason to request maximum output on every call; set max_tokens according to the answer your application needs. (platform.claude.com)

Anthropic defines legacy models as no longer receiving updates and potentially subject to future deprecation. Its Opus 4.5 reference recommends considering migration to Opus 5.5, while the model-deprecations documentation advises testing replacement models on your own workloads before retirement. Dates for partner-operated platforms such as Amazon Bedrock can differ from Anthropic-operated platform dates. (platform.claude.com)

Direct API pricing and a quick estimate

Anthropic lists Opus 4.5 at $5 per million input tokens and $25 per million output tokens. Its model reference also lists prompt-cache rates of $6.25 per million tokens for a 5-minute cache write, $10 per million for a 1-hour cache write, and $0.50 per million for cache reads. (platform.claude.com)

For a hypothetical uncached request with 10,000 input tokens and 2,000 output tokens, the base-token estimate is:

  • Input: 10,000 ÷ 1,000,000 × $5 = $0.05
  • Output: 2,000 ÷ 1,000,000 × $25 = $0.05
  • Estimated total: $0.10

This example excludes prompt caching and any other charges that may apply. Actual cost depends on the tokens used and applicable pricing terms. (platform.claude.com)

Before using it in production

  • Plan for the legacy lifecycle. Test your application against Anthropic’s documented migration target before you need to move; November 24, 2026 is “not sooner than,” not a guaranteed retirement date. (platform.claude.com)
  • Choose credentials for the environment. Anthropic documents API keys and Workload Identity Federation as authentication options. Its authentication guide describes WIF for cloud workloads, CI/CD, and Kubernetes where you want to avoid static secrets. (platform.claude.com)
  • Check current limits and operational guidance for your account. Anthropic’s API overview points developers to API documentation for rate limits and request details. This first-call example is not a complete retry, timeout, or monitoring implementation. (platform.claude.com)
  • Recheck pricing and lifecycle when planning deployment. These details can affect provider choice and migration work. (platform.claude.com)

Bottom line: For direct Anthropic access, send POST https://api.anthropic.com/v1/messages, authenticate with your Anthropic credential, include the required anthropic-version header, and set model to claude-opus-4-5-20251101. Opus 4.5 is listed as available but legacy, and Anthropic recommends considering migration to Opus 5.5. (platform.claude.com)

Sources

Versions — Claude Platform Docs

API overview — Claude Platform Docs

Create a Message — Claude API Reference

Using the Messages API — Claude Platform Docs

Get your Claude API key — Claude Platform Docs

Claude API errors — Claude Platform Docs

Claude Opus 4.5 — Claude Platform Docs

Model deprecations — Claude Platform Docs

Authentication — Claude Platform Docs

Contact us