DEV Community

Cover image for How to Use the Claude Haiku 5.5 API ?
Hassann
Hassann

Posted on Originally published at apidog.com

How to Use the Claude Haiku 5.5 API ?

To use the Claude Haiku 5.5 API, send a POST request to https://api.anthropic.com/v1/messages with "model": "claude-haiku-5-5", your key in the x-api-key header, and anthropic-version: 2023-06-01. It costs $0.10/$0.50 per million input/output tokens for prompts up to 100K tokens ($0.50/$2.50 above that), reads up to 1M tokens of context, writes up to 128K, and defaults to medium effort with adaptive thinking enabled.

Try Apidog today

Anthropic released Haiku 5.5 on October 7, 2026. It is the first Haiku model with effort levels. What is Claude Haiku 5.5 covers its specs and positioning.

This guide shows how to make a first request with curl, Python, and TypeScript, then configure effort, thinking, caching, batches, refusal handling, and agent toolsets. You can save and assert every request in Apidog.

Claude Haiku 5.5 API at a glance

Parameter Haiku 5.5 behavior
Model ID claude-haiku-5-5 (Bedrock: anthropic.claude-haiku-5-5); no separate alias
Price per MTok, prompts up to 100K tokens $0.10 input, $0.50 output, $0.01 cache reads
Price per MTok, prompts over 100K tokens $0.50 input, $2.50 output, $0.05 cache reads
Context / max output 1M / 128K; 300K on Batch with the output-300k-2026-03-24 beta header
output_config.effort low, medium (default), high, xhigh, max
thinking adaptive by default; disabled only at high effort or below
thinking.display Empty thinking field by default; summarized returns readable text
temperature, top_p, top_k Non-default values return 400
Assistant prefill Returns 400, even with thinking off
Minimum cacheable prompt 512 tokens (4,096 on Haiku 4.5)

Sources: the Haiku 5.5 model page and the Claude API pricing docs.

Your first Claude Haiku 5.5 API call

Create a key in the Claude Console and export it as ANTHROPIC_API_KEY. The Anthropic API key guide walks through the setup.

Never hard-code the key or commit it to source control.

curl

curl https://api.anthropic.com/v1/messages \
  -H "x-api-key: $ANTHROPIC_API_KEY" \
  -H "anthropic-version: 2023-06-01" \
  -H "content-type: application/json" \
  -d '{
    "model": "claude-haiku-5-5",
    "max_tokens": 4096,
    "output_config": {"effort": "medium"},
    "thinking": {"type": "adaptive", "display": "summarized"},
    "messages": [{
      "role": "user",
      "content": "Classify this ticket as billing, bug, or feature request: The export button times out on large projects."
    }]
  }'
Enter fullscreen mode Exit fullscreen mode

Python

The Python SDK reads ANTHROPIC_API_KEY from your environment.

import anthropic

client = anthropic.Anthropic()

response = client.messages.create(
    model="claude-haiku-5-5",
    max_tokens=4096,
    output_config={"effort": "medium"},
    thinking={"type": "adaptive", "display": "summarized"},
    messages=[{
        "role": "user",
        "content": "Classify this ticket as billing, bug, or feature request: The export button times out on large projects.",
    }],
)

for block in response.content:
    if block.type == "thinking":
        print("[thinking]", block.thinking)
    elif block.type == "text":
        print(block.text)

print(response.stop_reason, response.usage)
Enter fullscreen mode Exit fullscreen mode

TypeScript

import Anthropic from "@anthropic-ai/sdk";

const client = new Anthropic();

const response = await client.messages.create({
  model: "claude-haiku-5-5",
  max_tokens: 4096,
  output_config: { effort: "medium" },
  thinking: { type: "adaptive", display: "summarized" },
  messages: [
    {
      role: "user",
      content:
        "Classify this ticket as billing, bug, or feature request: The export button times out on large projects.",
    },
  ],
});

for (const block of response.content) {
  if (block.type === "text") {
    console.log(block.text);
  }
}

console.log(response.stop_reason, response.usage);
Enter fullscreen mode Exit fullscreen mode

Follow these implementation rules:

  1. Read content blocks by type. A response can start with a thinking block, so content[0].text is not safe.
  2. Leave output headroom. Thinking tokens count against max_tokens.
  3. Do not send unsupported sampling fields. Non-default temperature, top_p, top_k, budget_tokens, and assistant prefills return 400 errors.

If you are migrating existing code, see Haiku 5.5 vs Haiku 4.5 for before-and-after request JSON.

Pick an effort level

Use output_config.effort as the primary quality, latency, and cost control.

The prompting guide recommends these starting points:

  • low: Fastest and cheapest. Use it for chat, short tool tasks, and simple high-volume workloads.
  • medium: Default setting. Start here for most workloads, including agentic coding.
  • high: Use for knowledge work, longer agent tasks, and strict instruction following.
  • xhigh and max: Use only when your evaluations demonstrate a meaningful gain. Anthropic recommends comparing the same evaluations with Claude Sonnet 5.5.

Anthropic's OSWorld 2.1 offline-subset launch results show the tradeoff:

Effort Score Cost per attempt
low 42.0% $0.0695
medium 53.3% $0.1257
high 61.3% $0.1827
xhigh 67.6% $0.2792
max 72.4% $0.6111

Moving from xhigh to max more than doubles cost for fewer than five score points. See the Haiku 5.5 benchmarks breakdown for the remaining per-effort charts.

At xhigh, multi-turn chats can occasionally put the complete answer in thinking and return no visible text. Validate that a text block exists before rendering a reply to a user.

Control thinking

Adaptive thinking is enabled by default.

By default, each thinking block contains an empty thinking field and a signature. To return readable thinking summaries for logs or a UI, set:

{
  "thinking": {
    "type": "adaptive",
    "display": "summarized"
  }
}
Enter fullscreen mode Exit fullscreen mode

To reduce thinking, lower the effort level. Prompting the model to answer directly did not stop thinking in Anthropic's testing.

You can disable thinking only when effort is high or lower:

{
  "model": "claude-haiku-5-5",
  "max_tokens": 1024,
  "thinking": {"type": "disabled"},
  "output_config": {"effort": "low"},
  "messages": [{
    "role": "user",
    "content": "Extract the invoice number from: INV-2291, due Nov 3."
  }]
}
Enter fullscreen mode Exit fullscreen mode

The same request with xhigh or max returns a 400 error.

A forced tool_choice (any or a named tool) is accepted, but the response begins with the tool call and has no thinking block.

For multi-turn conversations and agent loops:

  • Return every thinking block unchanged.
  • Keep message history append-only.
  • Do not modify system, tools, or earlier messages before a returned thinking block.

Changing prior request context can return a 400. Thinking blocks also work only in the account that produced them, or an account linked to it.

Cache prompts and batch jobs

Prompt caching can significantly reduce input costs. For prompts up to 100K tokens:

  • Fresh input: $0.10 per MTok
  • Cache read: $0.01 per MTok
  • 5-minute cache write: $0.125 per MTok
  • 1-hour cache write: $0.20 per MTok

Haiku 5.5 has a 512-token minimum cacheable prompt, down from 4,096 tokens on Haiku 4.5. This makes short system prompts and stable tool definitions cacheable.

Mark stable prompt prefixes with cache_control:

{
  "model": "claude-haiku-5-5",
  "max_tokens": 1024,
  "system": [{
    "type": "text",
    "text": "You are a support triage assistant. <long, stable policy text here>",
    "cache_control": {"type": "ephemeral"}
  }],
  "messages": [{
    "role": "user",
    "content": "Ticket: refund not received after 10 days."
  }]
}
Enter fullscreen mode Exit fullscreen mode

Changing top-level effort between requests invalidates the cache. Per-message effort, available with the mid-conversation-output-config-2026-07-01 beta header on the Claude API and Google Cloud, preserves it.

See the prompt caching docs for TTL behavior, or read this prompt caching explainer.

For asynchronous jobs, the Message Batches API reduces input and output pricing by 50%:

  • Up to 100K-token prompts: $0.05 input / $0.25 output per MTok
  • Over 100K-token prompts: $0.25 input / $1.25 output per MTok

Batch is also the only route to 300K output tokens. Include the output-300k-2026-03-24 beta header.

Watch the 100K-token threshold: prompts over 100,000 tokens use higher prices. The Haiku 5.5 pricing guide includes examples on both sides of that threshold.

Handle stop_reason: "refusal"

Haiku 5.5 safety classifiers can decline requests, and there is no server-side fallback.

A declined request returns:

{
  "stop_reason": "refusal"
}
Enter fullscreen mode Exit fullscreen mode

Possible categories are:

  • cyber
  • frontier_llm
  • bio
  • general_harms

Do not blindly retry a refusal. The same request will usually be declined again.

def run(client, messages):
    response = client.messages.create(
        model="claude-haiku-5-5",
        max_tokens=4096,
        messages=messages,
    )

    if response.stop_reason == "refusal":
        details = getattr(response, "stop_details", None)
        category = getattr(details, "category", "unknown")

        log_refusal(category, messages)  # your logging
        return {"status": "refused", "category": category}

    text = "".join(
        block.text
        for block in response.content
        if block.type == "text"
    )

    return {"status": "ok", "text": text}
Enter fullscreen mode Exit fullscreen mode

Check stop_reason before reading content. Route refusals to a human workflow or another model in your own application logic.

Teams doing legitimate security or life-sciences work that are blocked by cyber or bio classifiers can apply to Anthropic's Cyber Verification Program or Life Sciences Verification Program.

Computer use and browser use

On the Claude API and Google Cloud, Haiku 5.5 supports computer use through the computer_toolset_20260801 toolset. It does not require a beta header.

Do not declare computer_20250124; it returns a 400 error.

Browser use is available through browser_toolset_20260801, which Haiku 4.5 does not support. Python and TypeScript SDK beta classes for both toolsets were added on launch day.

See the computer use tool docs for the available tools.

Rate limits

Haiku 5.5 uses the same rate limits as Haiku 4.5:

Tier Requests/minute Input tokens/minute Output tokens/minute
Start 1,000 2M 400K
Scale 10,000 10M 2M

Priority Tier is not supported.

For 429 handling patterns, see the rate limit exceeded guide.

Test the Claude Haiku 5.5 API in Apidog

Saved requests make effort comparisons, caching checks, and refusal debugging repeatable. Set up a collection in Apidog:

Apidog request setup

  1. Create an environment and add ANTHROPIC_API_KEY as a secret variable.
  2. Set the x-api-key header to {{ANTHROPIC_API_KEY}}.
  3. Add these headers:
    • anthropic-version: 2023-06-01
    • content-type: application/json
  4. Create a POST request to https://api.anthropic.com/v1/messages.
  5. Paste the first-call request body and save it.
  6. Add assertions:
    • Status equals 200
    • $.stop_reason equals end_turn
    • $.usage.output_tokens is greater than 0
    • $.content[*].type contains text
  7. Duplicate the request for low, high, xhigh, and max, then run the folder to compare usage across effort levels.
  8. Add a cached-system-prompt version and assert that $.usage.cache_read_input_tokens is greater than 0 on the second run.

These assertions catch refusals and empty xhigh replies before they reach production.

For more testing patterns, see testing LLM applications.

FAQ

What is the Claude Haiku 5.5 model ID?

claude-haiku-5-5, with no date suffix and no separate alias, on the Claude API, Google Cloud, Microsoft Foundry, and Claude Platform on AWS. On Amazon Bedrock, use anthropic.claude-haiku-5-5.

Is there a free Claude Haiku 5.5 API?

There is no ongoing free tier, but new API users receive a small amount of free credit for testing. Free Claude.ai users can select Haiku 5.5 in chat, but that does not provide an API key. Max and Team plans include monthly API credits. See the free access guide for details.

Why does my Haiku 4.5 request return 400?

Check for:

  • budget_tokens
  • Non-default temperature
  • Non-default top_p
  • Any top_k
  • Assistant prefill
  • The old computer_20250124 tool

These are the common causes.

Can I use Haiku 5.5 in Claude Code?

Yes, from v2.1.293. On the Anthropic API, the haiku alias resolves to Haiku 5.5. See Claude Haiku 5.5 in Claude Code.

Should I use Haiku 5.5 or Sonnet 5.5 for agentic coding?

Anthropic says Sonnet 5.5 and Opus 5.5 remain better choices for complex agentic coding tasks. Use Haiku 5.5 for narrowly scoped work such as classification, summarization, compaction, subagents, and browser use.

Next step

Run the first request at medium, then rerun the same prompt at low and high. Compare answer quality and usage.output_tokens using a prompt from your own workload.

Download Apidog to save the requests and assertions, so testing the next model release becomes a one-field change.

Top comments (0)