Anthropic

Claude Sonnet 4.5 API

Anthropicclaude-sonnet-4.51M contextAnthropic Messages APIOpenAI Chat Completions
Your appClaude CodeCodex CLISDKshalfoff1 keyClaude/v1/messagesclaude-sonnet-4.5claude-opus-5.5claude-sonnet-5.5GPT/v1/responsesgpt-6.1-solgpt-6-astragpt-5.6-terraGemini/v1betagemini-3.1-progemini-3.8-flashgemini-3-flash
Input
$1.50
USD per 1M tokens
Output
$7.50
USD per 1M tokens
Cache read
$0.15
USD per 1M tokens
Cache write
$1.88
USD per 1M tokens

Hand it to your AI agent

Copy this prompt into Claude Code, Cursor, Codex or any coding agent. It tells the agent where the docs are and how to use your API key.

Integrate the model `claude-sonnet-4.5` from Half Off Dev into this project through the native Anthropic Messages API.

- Docs (read first): https://halfoff.dev/docs/models/anthropic.md
- Use the official Anthropic SDK and only change the base URL to https://halfoff.dev (or set ANTHROPIC_BASE_URL=https://halfoff.dev). Endpoints: POST https://halfoff.dev/v1/messages and /v1/messages/count_tokens, unchanged from Anthropic, so Anthropic's docs are the reference for every parameter. `Authorization: Bearer` works too.
- Model id: `claude-sonnet-4.5`. GET https://halfoff.dev/v1/models lists every model with its price.
- Auth: read my API key from the HALFOFF_API_KEY environment variable and send it as `x-api-key: $HALFOFF_API_KEY`. Never print or commit the key. If it is not set, ask me to create one at https://halfoff.dev/app/keys.
- Billing is prepaid: every call is charged to my balance, so test with a small request before running anything large.
- Every docs page is plain Markdown; the full index is https://halfoff.dev/llms.txt.

My task: <describe what you want to build or get>

What a request costs

10,000 input + 1,000 output tokens: $0.022
The same with 9,000 input tokens from the cache: $0.01

How prompt caching works

Availability, last 24 hours

● Up

Live status

Price by channel group

Channel groupInputOutputCache read
Claude · Value
Pooled capacity
$1.50$7.50$0.15

What channel groups are

Anthropic Messages API

curl https://halfoff.dev/v1/messages \
  -H "x-api-key: $HALFOFF_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{"model": "claude-sonnet-4.5", "max_tokens": 1024, "messages": [{"role": "user", "content": "Hello"}]}'

Frequently asked questions

How much does Claude Sonnet 4.5 cost per million tokens?

$1.50 per 1M input tokens and $7.50 per 1M output tokens at the lowest-priced channel group. A request with 10,000 input and 1,000 output tokens costs about $0.022.

Does Claude Sonnet 4.5 support prompt caching?

Yes. Cache reads cost $0.15 per 1M tokens, so the same request with 9,000 of its input tokens read from the cache costs about $0.01. Half Off Dev keeps a conversation on the same channel so its cache stays warm.

What is the context window of Claude Sonnet 4.5?

1M tokens.

Which API format does Claude Sonnet 4.5 use?

Anthropic Messages API, OpenAI Chat Completions. Use the official SDK you already have: change its base URL to Half Off Dev and use your Half Off Dev API key.

Is there a subscription or rate limit?

No subscription: you top up a prepaid balance and pay per token. You can set your own requests-per-minute and concurrency limits on each API key.

Other Anthropic models