APIMart
Back to all models

Claude Sonnet 5 API

AnthropicModel ID claude-sonnet-5Text modelReleased June 30, 2026

Use Claude Sonnet 5 to find why a paginated API skips records, list what changed between two versions of a policy, or answer a customer with the right refund rule.

Max input
1,000,000 tokens
Max output
128,000 tokens
Input → output
Text, Image → Text
Knowledge cutoff
January 2026
  • Image input
  • Streaming
  • Cached input pricing
  • OpenAI SDK compatible

Claude Sonnet 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 5.

Try Claude Sonnet 5 with your own material

Everyday coding and bug fixing

Send the failing behaviour and the code around it, and have Claude Sonnet 5 explain the cause and the smallest fix. Add a test that reproduces the bug before you merge.

Example: Why does the export skip some orders?

Material

export.ts
for (let page = 1; ; page++) { const rows = await db.orders.find({ status: 'new' }).sort({ createdAt: 1 }).skip((page - 1) * 100).limit(100); if (!rows.length) break; for (const r of rows) await markExported(r); }
Symptom
With 250 new orders, only about 150 end up exported.

PromptUsing the code and the symptom, explain why records go missing and give the smallest fix.

Sample answer · written by hand to show the reasoning

markExported changes each order’s status, so after the first page those 100 orders no longer match status: 'new'. The query result shrinks, and skip(100) on page 2 jumps over 100 orders that were never exported. Either always read page 1 until it comes back empty, or page by createdAt (fetch rows created after the last one you processed) instead of using skip.

About the Claude Sonnet 5 API

  • The most agentic Sonnet at launch

    Anthropic released Claude Sonnet 5 on June 30, 2026 as an upgrade to Sonnet 4.6 in reasoning, tool use, coding and knowledge work, at a lower official price.

  • Sonnet 5.5 costs the same

    Anthropic released Claude Sonnet 5.5 on September 28, 2026 at the same input and output prices and now lists Sonnet 5 as legacy. Start new projects on Sonnet 5.5; retirement of Sonnet 5 is not before June 30, 2027.

  • Thinking you can turn off

    Adaptive thinking is on by default and can be disabled in Anthropic’s API. The 1M-token context window is billed at standard prices, with up to 128K output tokens.

  • Claude Sonnet 5 API key and access

    You don’t need a separate Claude Sonnet 5 API key: one APIMart key works for every model. Check the Claude Sonnet 5 pricing table on this page, then call an OpenAI Chat Completions-compatible endpoint with the model ID claude-sonnet-5.

Claude Sonnet 5 official benchmark results

Selected results Anthropic published at launch.

  • SWE-bench Pro

    63.2%

    Real software engineering tasks. Up from 58.1% for Sonnet 4.6 and ahead of GPT-5.5 (58.6%) and Gemini 3.5 Flash (55.1%).

  • OSWorld-Verified

    81.2%

    Completing tasks by operating a computer. Ahead of GPT-5.5 (78.7%), Sonnet 4.6 (78.5%) and Gemini 3.5 Flash (78.4%).

  • BrowseComp

    84.7%

    Finding hard-to-locate facts by browsing, single agent. Up from 76.2% for Sonnet 4.6 and level with GPT-5.5 (84.4%).

  • Humanity’s Last Exam (with tools)

    57.4%

    Hard questions across many disciplines. Up from 46.8% for Sonnet 4.6 and ahead of GPT-5.5 (52.2%).

  • GDPval-AA v2

    1,618 Elo

    Knowledge work across occupations, rated in Elo. Ahead of GPT-5.5 (1,509), Sonnet 4.6 (1,395) and Gemini 3.5 Flash (1,357).

  • FrontierCode v1

    38.8%

    Hard, frontier-level coding tasks. More than double Sonnet 4.6 (15.1%) and ahead of GPT-5.5 (25.5%).

How to call the Claude Sonnet 5 API

To call Claude Sonnet 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-5",
  "messages": [
    {
      "role": "user",
      "content": "Describe how to design a clear API in three sentences."
    }
  ],
  "stream": false
}'

Claude Sonnet 5 access details

Model IDclaude-sonnet-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 5 API request parameters

Claude Sonnet 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-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 5 API pricing

The Claude Sonnet 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
Input16Credits~$1.615.2Credits~$1.5214.4Credits~$1.4420Credits~$220%
Cached input1.6Credits~$0.161.52Credits~$0.1521.44Credits~$0.1442Credits~$0.220%
Output80Credits~$876Credits~$7.672Credits~$7.2100Credits~$1020%

Prices are for reference only. View full pricing

Why call Claude Sonnet 5 API through APIMart

  • 20% below official pricing

    Claude Sonnet 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.16 per 1M tokens.

    See membership prices
  • One API key for 500+ models

    Claude Sonnet 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 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 5 API key works for every model in the table; just change the model parameter.

Differences between Anthropic models
ComparisonClaude Sonnet 5 CurrentClaude Sonnet 4.5Claude Haiku 4.5Claude Opus 4.5Claude Opus 4.6Claude Sonnet 4.6Claude Opus 4.7Claude Opus 4.8Claude Fable 5Claude Opus 5Claude Haiku 5.5Claude Sonnet 5.5Claude Opus 5.5Claude Fable 5.1Claude Fable 5.2
Best forCoding, Research agents, Computer useCoding 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, 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 input1,000,000 tokens200,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 tokens
Max output128,000 tokens64,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 tokens
Knowledge cutoffJanuary 2026January 2025February 2025May 2025May 2025August 2025January 2026January 2026January 2026May 2026June 2026June 2026June 2026June 2026June 2026
Input price$1.6$2.4$0.8$4$4$2.4$4$4$8$4$0.08$1.6$3.2$8$6.4
Output price$8$12$4$20$20$12$20$20$40$20$0.4$8$16$40$32

Claude Sonnet 5 FAQ

Should I use Claude Sonnet 5 or Claude Sonnet 5.5?

Start new projects on Claude Sonnet 5.5. Anthropic released it on September 28, 2026 at the same input and output prices as Sonnet 5, with cache reads at half the price, and now lists Sonnet 5 as a legacy model. In Anthropic’s published results Sonnet 5.5 scores far higher on agentic coding, for example 70.6% vs. 10.3% on Terminal-Bench 4.0. Workloads already tuned and validated on Sonnet 5 can stay on it. On APIMart both share one endpoint and API key, so you only change the model parameter.

How is Claude Sonnet 5 different from Sonnet 4.6?

Anthropic says Sonnet 5 substantially improves on Sonnet 4.6 in reasoning, tool use, coding and knowledge work, for example 63.2% vs. 58.1% on SWE-bench Pro in its system card. Its official input and output prices are about a third lower than Sonnet 4.6’s, but it uses a new tokenizer that produces about 30% more tokens for the same text, so compare costs on your own prompts rather than by the price per token alone.

Can I turn off thinking on Claude Sonnet 5?

Yes. According to Anthropic’s docs, Sonnet 5 uses adaptive thinking that is on by default, and in Anthropic’s official API you can set thinking to disabled; effort ranges from low to max. Sonnet 5.5 no longer accepts the disabled setting and uses a separate option instead, so code that turns thinking off needs changing before you move up.

Why does a request with temperature fail?

Anthropic’s API rejects temperature, top_p and top_k on Claude Sonnet 5, so requests that set them can return an error. Remove those parameters and steer the output through the prompt and the effort level instead.

Is Claude Sonnet 5 being retired?

Not yet. Anthropic lists claude-sonnet-5 as an active legacy model, with retirement not sooner than June 30, 2027. Legacy means it no longer receives updates and may be deprecated later; this page will show a notice and a replacement link if that happens.

How can I try this model online?

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

Which model ID does the Claude Sonnet 5 API use?

Set model to claude-sonnet-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 5?

On APIMart, Claude Sonnet 5 accepts up to 1,000,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 5 can output up to 128,000 tokens in a single reply. Use the max_tokens parameter to set a lower limit.

How much does the Claude Sonnet 5 API cost?

The Claude Sonnet 5 API on APIMart is billed by token, and prices depend on your membership tier. Gold: $1.6 per million input tokens and $8 per million output tokens. Diamond: $1.44 per million input tokens and $7.2 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.