Skip to main content
Anthropic

Claude Sonnet 5 API

Anthropic

Claude Sonnet 5 is part of the Claude model familyView all Claude models

Anthropic Sonnet model for agentic coding, tool use, and long-context document work.

anthropic/claude-sonnet-5

Documentation

Conversation

Start a conversation

Anthropic Sonnet model for agentic coding, tool use, and long-context document work.

Enter to send · Shift+Enter for a new line

UnificAlly doesn't store your LLM prompts and replies. We only keep token usage information for billing purposes.

Uses POST /v1/chat/completions with your UnificAlly API key. Supports system and user prompts, tools, streaming, and thinking when available.

Updated

What is the Claude Sonnet 5 API?

The Claude Sonnet 5 API is live on UnificAlly as anthropic/claude-sonnet-5, from $0.30/1M tokens of input. Claude Sonnet 5 is Anthropic's June 2026 Sonnet update, built for agentic coding, tool use, long-context work, and professional text tasks. It sits above Claude Sonnet 4.6 in the Sonnet family and below the larger Opus and Fable class models on the hardest reasoning work. It accepts text and image input, outputs text, and runs on UnificAlly as anthropic/claude-sonnet-5. The headline spec is the 1M token context window with 128k max output, plus adaptive thinking as the default reasoning mode.

Claude Sonnet 5 API specs

Model IDanthropic/claude-sonnet-5
EndpointPOST https://direct-api.unifically.com/v1/chat/completions
Request typesChat Completions, Responses (/v1/responses), Messages (/v1/messages)
OutputText, returned in the same response or streamed
Tool useTools in the OpenAI tools and tool_choice format
Input rate$0.30/1M tokens
Output rate$1.50/1M tokens
Cache read rate$0.03/1M tokens
Cache creation rate$0.375/1M tokens

Billing is per token, with no subscription. The Claude API pricing guide covers the full rate table for every Claude model.

How to use the Claude Sonnet 5 API

  1. Create an API key on the API keys page.
  2. Send a POST request to /v1/chat/completions with the model ID and a messages array.
  3. Read the reply from choices[0].message.content in the 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-5",
    "messages": [
      { "role": "user", "content": "Refactor this function to remove the shared mutable state and explain the change." }
    ]
  }'

The response comes back synchronously with the completion:

{
  "id": "3f8e2a1c-7b4d-4e9a-9c2f-5d1e8b7a6c40",
  "object": "chat.completion",
  "created": 1710000000,
  "model": "anthropic/claude-sonnet-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,
    "prompt_tokens_details": {
      "cached_tokens": 0
    },
    "completion_tokens_details": {
      "reasoning_tokens": 0
    }
  }
}

The usage object holds the token counts for the request. Set "stream": true to receive tokens as they generate. Send requests to direct-api.unifically.com so long replies finish in full.

Claude Sonnet 5 API parameters

ParameterTypeDefaultWhat it does
modelstringrequiredModel identifier. Use anthropic/claude-sonnet-5.
messagesarrayrequiredNon-empty array of message objects with role and content. Allowed roles: system, developer, user, assistant, tool, and function.
streambooleanfalseIf true, the response is streamed using server-sent events.
stream_optionsobjectnoneSet { "include_usage": true } to get a final chunk with token usage. Only used when stream is true.
max_tokensintegernoneMaximum number of tokens to generate in the completion.
max_completion_tokensintegernoneAccepted as an alias for max_tokens.
stopstring or arraynoneUp to four sequences where the model stops generating further tokens.
toolsarraynoneList of tools the model may call. Each tool requires a type and function definition.
tool_choicestring or objectnoneControls which tool is called: none, auto, required, or a specific tool.
response_formatobjectnoneSet { "type": "json_object" } to enable JSON mode.

Full Claude Sonnet 5 API docs live at docs.unifically.com/models/llm/anthropic/claude-sonnet-5.

Messages format

The same model ID also works on /v1/messages, the Anthropic-style endpoint. Use it when you need Claude's thinking text, which the Chat Completions endpoint does not return.

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-5",
    "max_tokens": 1024,
    "messages": [
      {"role": "user", "content": "Review this function for potential bugs."}
    ]
  }'

What's new in Claude Sonnet 5

A real jump in agentic coding

Anthropic reports 85.2% on SWE-bench Verified, 63.2% on SWE-bench Pro, and 80.4% on Terminal-Bench 2.1. Against Claude Sonnet 4.6, SWE-bench Pro rises from 58.1, Terminal-Bench from 67.0, and FrontierCode v1 from 15.1 to 38.8.

1M token context by default

Long-context work is standard: a large repo, an issue thread, and test logs fit in one session, with up to 128k output tokens per response.

Strong document handling

It ranks #11 on Arena's Document board with a 1476±17 score, close to Claude Opus 4.8 Thinking. Contracts, research packs, and policy corpora are a good fit.

Prompt-injection resistance

In a live bug bounty across tool use, coding, and computer use, it tied Claude Opus 4.8 at a 0.19% attack success rate. That matters for agents that act on untrusted web content.

Vision input for text output

It reads screenshots, charts, PDFs rendered as images, and technical diagrams, ranking #21 on Arena's Vision board. Use it when images are inputs and the deliverable is text.

What Claude Sonnet 5 is best for

  • Multi-step coding agents

    Inspect, edit, test, and revise across a large repo without losing the thread.

  • Long document review

    Contracts, research packs, finance files, or policy corpora compared in one window.

  • Visual reasoning

    Charts, PDFs, screenshots, and technical diagrams read as input for text answers.

  • Browser and computer-use agents

    Stronger resistance to injected instructions than earlier Sonnet models.

  • Professional writing and analysis

    Work that must follow a plan for many turns without drifting.

  • RAG over big corpora

    The 1M token window cuts how aggressively you have to chunk and re-rank.

Claude Sonnet 5 use cases

Use Claude Sonnet 5 for coding assistants that carry a large repo, its issue thread, and test logs in one session. It fits document agents that compare long PDFs, extract claims, and write grounded summaries. Operations teams can put it behind multi-step workflows that search, read, decide, and write back structured results. It is also a good fit for visual QA over business charts, dashboards, and screenshots when the final output is text.

Claude Sonnet 5 limitations

Claude Sonnet 5 outputs text only. It does not generate images, audio, or video.

The tokenizer changed from Claude Sonnet 4.6: the same input can map to roughly 1.0-1.35x as many tokens depending on content. Retest token budgets when moving long prompts over.

It is also not Anthropic's top model for the hardest reasoning tasks. The system card places it behind Opus and Mythos class models on most frontier reasoning and advanced scientific evaluations.

Claude Sonnet 5 vs Claude Sonnet 4.6

Sonnet 5 is a clear upgrade for agentic coding, long professional work, and prompt-injection resistance. The gap shows in the system card numbers: SWE-bench Pro rises from 58.1 to 63.2, Terminal-Bench 2.1 from 67.0 to 80.4, and FrontierCode v1 from 15.1 to 38.8. The tradeoff is that it can spend more tokens on hard work. Treat it as a more deliberate Sonnet, not a drop-in speed model for tiny prompts.

When to use Claude Sonnet 5

Use Claude Sonnet 5 when the task is too long or too agentic for a fast small model, but you do not need the largest Claude model. It is best when follow-through matters: coding changes, document synthesis, visual analysis, and multi-step workflows that punish shallow answers.

FAQs

People also ask about Claude Sonnet 5

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

Authentication is a bearer token: make a key on the API keys page and send Authorization: Bearer <key> to https://direct-api.unifically.com/v1/chat/completions. The model ID is anthropic/claude-sonnet-5.

Use anthropic/claude-sonnet-5 with a messages array; tools follow the OpenAI tools and tool_choice format, and the reply comes back in choices[0].message.content. Set stream to true to receive it as it is written, and move to /v1/messages when you need Claude's thinking text.

Text and image input, text output. It reads screenshots, charts, PDFs rendered as images, and diagrams, then answers in text. It does not generate images, audio, or video.

1M tokens, with a standard max output of 128k tokens. That fits a large repo plus its issue thread and test logs in one session.

Yes, for coding, agentic tasks, and document work. SWE-bench Pro rises from 58.1 to 63.2, Terminal-Bench 2.1 from 67.0 to 80.4, and FrontierCode v1 from 15.1 to 38.8.

In Anthropic's live bug bounty across tool use, coding, and computer use, Claude Sonnet 5 tied Claude Opus 4.8 at a 0.19% attack success rate. That makes it a good base for browser and computer-use agents.

Yes. The same input can map to roughly 1.0-1.35x as many tokens depending on content, so retest your token budgets when moving long prompts over from Claude Sonnet 4.6.

No. Opus and Mythos class models rank ahead on the hardest reasoning and specialized evaluations. Sonnet 5 is the balanced option for coding, documents, and multi-step work at a lower cost.

Claude Sonnet 5 guides and comparisons

Review pricing, limits, and tested outputs before running this model.