APIMart
Back to all models

Claude Sonnet 4.5 API

AnthropicModel ID claude-sonnet-4-5Text modelReleased September 29, 2025

Use Claude Sonnet 4.5 to fix a bug that spans several files, let an agent work through a web back office step by step, or split a spec into tasks that can run in parallel.

Max input
200,000 tokens
Max output
64,000 tokens
Input → output
Text, Image → Text
Knowledge cutoff
January 2025
  • Image input
  • Streaming
  • Cached input pricing
  • OpenAI SDK compatible

Claude Sonnet 4.5 API use cases

Each use case comes with an illustrative example: source material, a prompt and a hand-written sample answer, not actual model output. Copy the prompt, swap in your own material and try it on Claude Sonnet 4.5.

Try Claude Sonnet 4.5 with your own material

Fix bugs that span several files

Send Claude Sonnet 4.5 the error, the failing test and the related files, and ask it to explain the cause before proposing the smallest fix. Review the diff and run the full suite before merging.

Example: Why is the last row missing from the CSV export?

Material

Test output
expected 3 rows in report.csv, got 2
export.ts
for (let i = 0; i < rows.length - 1; i++) writer.write(toCsv(rows[i]));
rows.ts
export const loadRows = () => db.query('SELECT * FROM orders WHERE paid = 1');

PromptUsing the test output and the two file excerpts, find the cause and give the smallest fix.

Sample answer · written by hand to show the reasoning

The bug is in export.ts: the loop runs while i < rows.length - 1, so the last row is never written. Change it to i < rows.length; the query in rows.ts is fine. Add a test with a single row so this off-by-one can’t come back.

About the Claude Sonnet 4.5 API

  • The top coding model at launch

    Anthropic released Claude Sonnet 4.5 on September 29, 2025 as the best coding model in the world, with 77.2% on SWE-bench Verified and focus held for more than 30 hours on complex multi-step tasks.

  • A Sonnet that uses computers

    Claude Sonnet 4.5 scored 61.4% on OSWorld, a benchmark of real computer tasks, up from Sonnet 4’s 42.2%, which suits agents that work through web pages and desktop apps step by step.

  • 200K context, 64K output

    A 200K-token context window, up to 64K output tokens, text and image input and extended thinking. For a longer context in new projects, consider Claude Sonnet 5.5.

  • Claude Sonnet 4.5 API key and access

    You don’t need a separate Claude Sonnet 4.5 API key: one APIMart key works for every model. Claude Sonnet 4.5 API pricing is in the table on this page, and access goes through an OpenAI Chat Completions-compatible endpoint with the model ID claude-sonnet-4-5.

How to call the Claude Sonnet 4.5 API

To call Claude Sonnet 4.5, you only need an APIMart API key and your existing OpenAI SDK, or send plain HTTP requests.

POST /v1/chat/completions
curl https://api.apimart.ai/v1/chat/completions \
  -H "Authorization: Bearer $APIMART_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "model": "claude-sonnet-4-5",
  "messages": [
    {
      "role": "user",
      "content": "Describe how to design a clear API in three sentences."
    }
  ],
  "stream": false
}'

Claude Sonnet 4.5 access details

Model IDclaude-sonnet-4-5
Base URLhttps://api.apimart.ai/v1
Endpoint/chat/completions

Common parameters

model
Required
messages
Required
stream
Optional
max_tokens
Optional
temperature
Optional
All request parameters, response fields and error codes

Claude Sonnet 4.5 API request parameters

Claude Sonnet 4.5 uses the general chat endpoint, POST /v1/chat/completions, with a JSON body. model and messages are required; every other parameter is optional.

ParameterTypeRequiredDescription
modelstringYesModel ID. Use claude-sonnet-4-5 for this model.
messagesarrayYesConversation messages. Each message has a role (system, user, or assistant) and content. Include earlier messages for multi-turn conversations.
streambooleanNoWhether to stream the output. true returns chunks over SSE, false returns the full response at once. Default: true.
temperaturenumberNoOutput randomness, 0–2. Default: 1.0. Lower values give more deterministic output.
top_pnumberNoNucleus sampling, 0–1. Default: 1.0. Adjust this or temperature, not both.
max_tokensintegerNoMaximum number of tokens to generate for the reply.
frequency_penaltynumberNoFrequency penalty, -2.0 to 2.0. Default: 0. Positive values reduce repeated wording.
presence_penaltynumberNoPresence penalty, -2.0 to 2.0. Default: 0. Positive values encourage new topics.
stopstring | arrayNoUp to 4 stop sequences. Generation stops when any of them appears.
nintegerNoNumber of replies to generate. Default: 1.

Response fields

The response contains the fields below. Token usage is returned in usage, which you can use to check costs.

FieldTypeDescription
idstringUnique identifier for the request.
modelstringThe model that handled the request.
choicesarrayList of replies. Each item contains message (role and content) and finish_reason.
usageobjectToken usage: prompt_tokens, completion_tokens, and total_tokens.

Error codes

Failed requests return an error object with code, message, and type.

StatusTypeMeaning
400invalid_request_errorInvalid request parameters.
401authentication_errorThe API key is invalid or missing.
402payment_requiredInsufficient account balance.
403permission_errorNo permission to access this resource.
429rate_limit_errorToo many requests. Retry later.
500server_errorInternal server error.
502bad_gatewayGateway error. The service is temporarily unavailable.

Claude Sonnet 4.5 API pricing

The Claude Sonnet 4.5 API is billed by token usage, and prices depend on your membership tier. Prices below are per million tokens; 1 US dollar = 10 credits.

ItemGoldCurrent pricePlatinumDiamondOfficial priceYou save
Input24Credits~$2.422.8Credits~$2.2821.6Credits~$2.1630Credits~$320%
Cached input2.4Credits~$0.242.28Credits~$0.2282.16Credits~$0.2163Credits~$0.320%
Output120Credits~$12114Credits~$11.4108Credits~$10.8150Credits~$1520%

Prices are for reference only. View full pricing

Why call Claude Sonnet 4.5 API through APIMart

  • 20% below official pricing

    Claude Sonnet 4.5 API pricing is billed by token usage. Gold to Diamond member prices are 20%–28% below Anthropic's official prices, and cached input costs just $0.24 per 1M tokens.

    See membership prices
  • One API key for 500+ models

    Claude Sonnet 4.5, the rest of its family and 500+ models from GPT, Claude, Gemini and more share one API key and one account balance. Switching models is just a change to the model parameter.

  • Change two lines of existing code

    If you already use the OpenAI SDK, point base_url at https://api.apimart.ai/v1 and swap in your APIMart API key. Requests and responses keep the same format.

  • Try it online before you code

    Try Claude Sonnet 4.5 with your own material in the Playground, no code or setup needed, and integrate once you like the results.

    Open Playground

Which Anthropic model should you choose?

Base prices per 1M tokens (USD). Your Claude Sonnet 4.5 API key works for every model in the table; just change the model parameter.

Differences between Anthropic models
ComparisonClaude Sonnet 4.5 CurrentClaude Haiku 4.5Claude Opus 4.5Claude Opus 4.6Claude Sonnet 4.6Claude Opus 4.7Claude Opus 4.8Claude Fable 5Claude Sonnet 5Claude Opus 5Claude Haiku 5.5Claude Sonnet 5.5Claude Opus 5.5Claude Fable 5.1Claude Fable 5.2
Best forCoding and agents, Computer use, 200K contextSmall model, Sub-agents and bulk tasks, 200K contextCoding and agents, Adjustable effort, 200K contextCoding and code review, Knowledge work, 1M contextCoding, Computer use, 1M contextHard coding tasks, High-resolution images, Long agentic runsLarge code migrations, Legal and knowledge work, Computer useLong-running agents, Software engineering, Knowledge work and scienceCoding, Research agents, Computer useCoding, Agents, Knowledge workClassification & routing, Data extraction, Sub-agent tasksEveryday coding, Agentic tasks, Data analysisAgentic coding, Large-scale refactoring, Knowledge workCode review, Long-running coding, Documents and spreadsheetsHard coding problems, Scientific research, Financial modeling
Max input200,000 tokens200,000 tokens200,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens1,000,000 tokens
Max output64,000 tokens64,000 tokens64,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens128,000 tokens
Knowledge cutoffJanuary 2025February 2025May 2025May 2025August 2025January 2026January 2026January 2026January 2026May 2026June 2026June 2026June 2026June 2026June 2026
Input price$2.4$0.8$4$4$2.4$4$4$8$1.6$4$0.08$1.6$3.2$8$6.4
Output price$12$4$20$20$12$20$20$40$8$20$0.4$8$16$40$32

Claude Sonnet 4.5 FAQ

Claude Sonnet 4.5 or Claude Sonnet 5.5?

Start new projects on Claude Sonnet 5.5: it is the Sonnet Anthropic recommends today, with a longer context and more output per request. Sonnet 5 and later use a new tokenizer that counts about 30% more tokens for the same text, so compare real costs with your own prompts. Workloads already validated on Sonnet 4.5 can stay; on APIMart you switch by changing the model parameter.

How strong is Claude Sonnet 4.5 at coding and computer use?

In Anthropic’s launch results, Claude Sonnet 4.5 scored 77.2% on SWE-bench Verified (averaged over 10 trials, 200K thinking budget) and 61.4% on OSWorld, a benchmark of real computer tasks, where Sonnet 4 had led at 42.2% four months earlier. Anthropic also observed it keeping focus for more than 30 hours on complex multi-step tasks.

How long is the Claude Sonnet 4.5 context? Can it take 1M tokens?

Per Anthropic’s current documentation, Claude Sonnet 4.5 has a 200K-token context window and up to 64K output tokens. The 1M-token context at standard pricing starts with the Claude 4.6 generation, so for whole codebases or very long documents switch to Sonnet 4.6 or a newer Sonnet.

What is the Claude Sonnet 4.5 knowledge cutoff?

Anthropic lists a reliable knowledge cutoff of January 2025 and a training data cutoff of July 2025 for Claude Sonnet 4.5. It knows events before January 2025 best; for anything newer, include the material in the request or pair it with a web search tool.

How can I try this model online?

Click Start chatting or Open Playground to visit the existing APIMart Playground. Select Claude Sonnet 4.5 in the text category to start exploring.

Which model ID does the Claude Sonnet 4.5 API use?

Set model to claude-sonnet-4-5. Copy the exact ID from the page heading or the integration details panel.

Is it compatible with the OpenAI SDK?

You can keep the OpenAI SDK. Set base_url to https://api.apimart.ai/v1, provide your APIMart API key, and use the model ID on this page.

What is the context window of Claude Sonnet 4.5?

On APIMart, Claude Sonnet 4.5 accepts up to 200,000 input tokens per request. Your prompt, earlier messages, and file content all count toward it.

How many tokens can it output at once?

Claude Sonnet 4.5 can output up to 64,000 tokens in a single reply. Use the max_tokens parameter to set a lower limit.

How much does the Claude Sonnet 4.5 API cost?

The Claude Sonnet 4.5 API on APIMart is billed by token, and prices depend on your membership tier. Gold: $2.4 per million input tokens and $12 per million output tokens. Diamond: $2.16 per million input tokens and $10.8 per million output tokens. Prices may change; the pricing page has the current rates.

Does it support streaming?

Yes. The general chat endpoint streams over SSE by default. Set stream to false to receive the complete response at once.

How do I get an API key?

Sign in to APIMart and create a key on the API Keys page, then send it in the Authorization: Bearer header. The same key also works for other models on the platform.