Chuyển đến nội dung chính
Logo Anthropic

Claude Sonnet 4.5 API

Anthropic

Claude Sonnet 4.5 thuộc dòng mô hình ClaudeXem tất cả mô hình Claude

Mô hình Anthropic Sonnet cho lập trình, tác nhân và điều khiển máy tính với cửa sổ ngữ cảnh 200k.

anthropic/claude-sonnet-4-5

Tài liệu

Cuộc trò chuyện

Bắt đầu cuộc trò chuyện

Mô hình Anthropic Sonnet cho lập trình, tác nhân và điều khiển máy tính với cửa sổ ngữ cảnh 200k.

Enter để gửi · Shift+Enter để xuống dòng

UnificAlly không lưu trữ prompt và câu trả lời LLM của bạn. Chúng tôi chỉ lưu thông tin số token sử dụng để tính phí.

Sử dụng POST /v1/chat/completions với khóa API UnificAlly của bạn. Hỗ trợ system prompt, user prompt, tools, streaming và chế độ suy nghĩ khi khả dụng.

Cập nhật

What is the Claude Sonnet 4.5 API?

The Claude Sonnet 4.5 API is live on UnificAlly as anthropic/claude-sonnet-4-5, billed per token of input and output. One POST to /v1/chat/completions returns the reply in the same response. Claude Sonnet 4.5 is Anthropic's September 29, 2025 Sonnet model, built for coding, agents, computer use, and knowledge work. At release it posted the top SWE-bench Verified score among frontier models and the top OSWorld computer-use score, and Anthropic measured it holding focus on complex multi-step tasks for more than 30 hours. It accepts text and image input, and outputs text with a 200k context window and 64k max output. It sits before Claude Sonnet 4.6 in the Sonnet family: still a strong daily model for code and agents, now the value pick rather than the front of the line.

Claude Sonnet 4.5 API specs

Model IDanthropic/claude-sonnet-4-5
EndpointPOST https://direct-api.unifically.com/v1/chat/completions
Other endpointsPOST /v1/responses, POST /v1/messages
Request typesChat completion, streaming, tool calls
ResponseSynchronous JSON, or server-sent events with "stream": true
ThinkingToken budget, through /v1/messages
BillingPer token, input and output

Billing is per token, with no subscription. The Claude API pricing guide covers the rates for the Claude models on UnificAlly.

How to use the Claude Sonnet 4.5 API

  1. Create an API key on the API keys page.
  2. Send a POST request to /v1/chat/completions on https://direct-api.unifically.com with the model ID and a messages array.
  3. Read the reply from choices[0].message.content in the same response.
curl -X POST https://direct-api.unifically.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -d '{
    "model": "anthropic/claude-sonnet-4-5",
    "messages": [
      { "role": "user", "content": "Refactor this function and write tests that cover the edge cases." }
    ]
  }'

The response comes back synchronously with the completion:

{
  "id": "3f8e2a1c-7b4d-4e9a-9c2f-5d1e8b7a6c40",
  "object": "chat.completion",
  "created": 1710000000,
  "model": "anthropic/claude-sonnet-4-5",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "Here is the refactored function..."
      },
      "finish_reason": "stop"
    }
  ],
  "usage": {
    "prompt_tokens": 28,
    "completion_tokens": 64,
    "total_tokens": 92
  }
}

The usage object carries the token counts for the request. Set "stream": true to receive tokens as they generate. The stream is a series of chat.completion.chunk events and ends with data: [DONE].

Claude Sonnet 4.5 API parameters

ParameterTypeDefaultWhat it does
modelstringrequiredanthropic/claude-sonnet-4-5
messagesarrayrequiredNon-empty array of message objects with role and content. Roles: system, developer, user, assistant, tool, function
streambooleanfalseStreams the response as server-sent events
stream_optionsobjectnoneSet { "include_usage": true } to get a final chunk with token usage. Only used when stream is true
temperaturenumbernoneSampling temperature between 0 and 2. Higher values produce more random output
max_tokensintegernoneMaximum number of tokens to generate
max_completion_tokensintegernoneAccepted as an alias for max_tokens
top_pnumbernoneNucleus sampling, an alternative to temperature
stopstring or arraynoneUp to four sequences where the model stops generating
toolsarraynoneTools the model may call. Each needs a type and a function definition
tool_choicestring or objectnonenone, auto, required, or a specific tool

The Claude Sonnet 4.5 API documentation has the full reference, with all three endpoints.

Messages request

The Claude Sonnet 4.5 API also answers on /v1/messages, the Anthropic request format. Use this endpoint with the thinking parameter and a token budget when you want the thinking text. On /v1/chat/completions Claude returns only the final answer.

curl -X POST https://direct-api.unifically.com/v1/messages \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -d '{
    "model": "anthropic/claude-sonnet-4-5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Review this function for potential bugs."}
    ]
  }'

Key features of Claude Sonnet 4.5

Leading coding scores at release

It scores 77.2% on SWE-bench Verified, 82.0% with parallel test-time compute, ahead of GPT-5 Codex at 74.5% and Gemini 2.5 Pro at 67.2% at release.

30+ hour task focus

Anthropic measured the model staying on a complex, multi-step task for more than 30 hours. That length changes what one agent run can finish: full features, long migrations, overnight batch work.

Computer use

It scores 61.4% on OSWorld, up from 42.2% for Claude Sonnet 4 four months earlier, and was the best computer-use model of any lab at release.

Broad benchmark coverage

Beyond coding it reaches 50.0% on Terminal-Bench, 98.0% on the τ2-bench telecom split, 83.4% on GPQA Diamond, and 100% on AIME 2025 with Python tools.

Domain knowledge work

It scores 55.3% on the Finance Agent benchmark, ahead of Opus 4.1 at 50.9%, and expert reviews rated its finance, law, medicine, and STEM answers above earlier Claude models.

Alignment gains

Anthropic called it the most aligned frontier model at release, with the lowest misaligned-behavior score in its evaluation and less sycophancy and deception than earlier Claude models.

What Claude Sonnet 4.5 is best for

  • Agentic coding

    Multi-file fixes, refactors, and feature work that runs for hours without drifting.

  • Terminal agents

    Shell-driven tasks like builds, test loops, and environment setup.

  • Computer-use agents

    Browser and desktop-style tasks that click, type, and read screens, with clear action limits.

  • Financial analysis

    Spreadsheet work, filings review, and research agents, with human review.

  • Document and chart reading

    Image input covers screenshots, PDFs, and figures alongside text.

  • Cost-aware production agents

    Strong results at a mid-line price point when the newest Sonnet is not required.

Claude Sonnet 4.5 use cases

Build a coding agent that takes a ticket, works across a repo, runs the tests, and reports back after hours of unattended work. Use it for customer-support and operations agents that call tools reliably: its 98.0% on the τ2-bench telecom split came from tool-use training that carries over to real workflows. It also fits browser automation like form filling, dashboard checks, and internal-tool operation. For research teams, pair extended thinking with document input to draft financial models, review contracts, or summarize a stack of papers with the reasoning shown.

Claude Sonnet 4.5 limitations

The context window is 200k tokens with 64k max output. Newer Sonnet models carry 1M context and 128k output, so the largest codebases and document sets need chunking here.

Claude Sonnet 4.6 has since passed it on coding, computer use, and long-context reasoning. Sonnet 4.5 remains a capable model, but it is no longer the strongest Sonnet on the same API.

OSWorld's 61.4% still means real UI work fails on a meaningful share of tasks. Production computer-use agents need retries, checkpoints, and action limits.

High-stakes finance, legal, and medical outputs need human review. Expert evaluations rated its domain answers well, and they are still drafts.

Claude Sonnet 4.5 vs Claude Sonnet 4.6

Claude Sonnet 4.6 is the newer model and wins on the numbers: 79.6% versus 77.2% on SWE-bench Verified, and 72.5% versus 61.4% on OSWorld-Verified. It also carries a 1M context window against 200k, 128k output against 64k, and adaptive thinking against Sonnet 4.5's fixed thinking budget. Arena's Text board ranks claude-sonnet-4-6 at #23 with a 1472±4 score, ahead of Sonnet 4.5 at #42 with 1455±3. Pick Sonnet 4.5 when its results already clear your quality bar; pick 4.6 for long context, heavy computer use, and the hardest agent runs.

When to use Claude Sonnet 4.5

Use Claude Sonnet 4.5 for agentic coding, tool-calling workflows, and computer use where a 200k context is enough and you want proven, stable behavior. It is a sensible default for teams already tuned on it. Move to Sonnet 4.6 when a task needs 1M context or the strongest current Sonnet results.

Câu hỏi thường gặp

Câu hỏi thường gặp về Claude Sonnet 4.5

anthropic/claude-sonnet-4-5, called through the OpenAI-compatible POST /v1/chat/completions endpoint with your UnificAlly API key.

The API keys page is where the key is made after you sign up, and it travels as Authorization: Bearer <key> to https://direct-api.unifically.com. Use the model ID anthropic/claude-sonnet-4-5; since the chat endpoint is OpenAI-compatible, an OpenAI SDK can call it after a base URL change.

Calling anthropic/claude-sonnet-4-5 on /v1/chat/completions with a messages array returns the final answer in choices[0].message.content, or a server-sent stream with "stream": true. For extended thinking, use /v1/messages with the thinking parameter and a token budget, which also returns the thinking text.

Text and image input with text output. It reads screenshots, charts, and documents in the same request as code and prose.

200k tokens, with a callable max output of 64k tokens. That fits a mid-size codebase or a long document set in one run, but not the very largest repos.

Yes. It scores 77.2% on SWE-bench Verified and 50.0% on Terminal-Bench, and holds focus on multi-step coding tasks for 30+ hours.

Yes for its generation. It scores 61.4% on OSWorld, the best computer-use result of any model at its September 2025 release. Newer Claude models have since passed it, so set expectations by that baseline.

Yes. Claude Sonnet 4.5 supports extended thinking with a token budget, so you can trade latency for deeper reasoning on hard turns.

The 200k context window is smaller than newer Sonnet models, and finance, legal, and medical outputs still need human review. For the hardest agent work, Sonnet 4.6 is the stronger pick on the same API.

Hướng dẫn và so sánh Claude Sonnet 4.5

Xem bảng giá, giới hạn và kết quả thử nghiệm thực tế trước khi chạy mô hình này.