返回资讯中心
外部精选
大数据
#数据科学#机器学习

Claude Haiku 5.5: What’s New and How to Use It for Fast, Cheap AI Workflows

Claude Haiku 5.5 cuts list prices by 90% and adds adaptive thinking and a 1M token context window. Learn what broke from Haiku 4.5, and build classification, extraction, and sub-agent workflows in Python using the new A…

KDnuggetsShittu Olumide2026/10/19 · 6 天前18 分钟阅读

以下正文同步自 KDnuggets,版权归原站所有,已转换为易读排版。

subagents.py

"""A lead model delegates narrow jobs to parallel Haiku 5.5 workers, then writes the answer.""" import asyncio

import anthropic

from haiku_tasks import MODEL as WORKER, cost_usd

LEAD = "claude-sonnet-5-5" client = anthropic.AsyncAnthropic()

def text_of(reply): return "".join(block.text for block in reply.content if block.type == "text")

async def summarize(name, document, limit): async with limit: # cap how many workers run at once reply = await client.messages.create( model=WORKER, max_tokens=1500, system="Summarize the document in two sentences. Keep names, dates and amounts exact.", messages=[{"role": "user", "content": document}], output_config={"effort": "low"}, ) return name, text_of(reply), cost_usd(WORKER, reply.usage)

async def answer(documents, question): limit = asyncio.Semaphore(8) notes = await asyncio.gather(*(summarize(n, d, limit) for n, d in documents.items())) worker_cost = sum(cost for _, _, cost in notes)

brief = "\n".join(f"[{name}] {summary}" for name, summary, _ in notes) reply = await client.messages.create( model=LEAD, max_tokens=2000, system="You are the lead analyst. Answer using only the worker notes.", messages=[{"role": "user", "content": f"Question: {question}\n\nWorker notes:\n{brief}"}], output_config={"effort": "medium"}, ) return text_of(reply), worker_cost, cost_usd(LEAD, reply.usage)

if name == "main": documents = { "contract-a": "Northwind renewed its support contract on 3 March 2026 for 48,000 USD per year.", "contract-b": "Contoso signed a 12-month license on 9 May 2026. The fee is 15,500 USD, billed quarterly.", "contract-c": "Fabrikam's agreement ends on 30 June 2026 and renews only if either party gives notice.", } text, worker_cost, lead_cost = asyncio.run(answer(documents, "Which agreements need action before July 2026?")) print(text) print(f"workers: ${worker_cost:.6f} lead: ${lead_cost:.6f}")

summarize is one worker. It asks Haiku for a two-sentence summary at low effort and returns the document name, the summary, and the cost. The Semaphore caps how many workers run at the same time, which keeps you inside your rate limits. answer starts every worker at once with asyncio.gather, adds up the worker cost, and then sends only the short summaries to the lead model — here Sonnet 5.5 at its default effort. The lead never reads the full documents, and that is where the savings come from. The function returns the answer plus both costs, so you can see where the money went.

Published numbers only go so far, so this script runs the same classification task on all three models and measures accuracy, latency, and cost on your own account.

compare_models.py

"""Run the same classification task on three models and compare accuracy, latency and cost.""" import statistics import time

from haiku_tasks import classify, cost_usd

MODELS = ["claude-haiku-5-5", "claude-sonnet-5-5", "claude-opus-5-5"]

TICKETS = [ ("I was charged twice for my last order.", "billing"), ("Please send me a copy of my invoice.", "billing"), ("Where is my package? It was due on Monday.", "shipping"), ("My order was delivered to the wrong building.", "shipping"), ("The app crashes every time I open settings.", "technical"), ("I cannot log in even after resetting my password.", "technical"), ("Can you tell me about your company history?", "other"), ("My card was declined but the money left my account.", "billing"), ]

def run(model): seconds, cost, hits, output_tokens = [], 0.0, 0, 0 for text, label in TICKETS: start = time.perf_counter() category, usage = classify(text, model) seconds.append(time.perf_counter() - start) hits += category == label cost += cost_usd(model, usage) output_tokens += usage.output_tokens n = len(TICKETS) return hits / n, statistics.median(seconds), cost / n * 1000, output_tokens / n

if name == "main": print(f"{'model':9}{'median s':>10}{'$/1k calls':>12}{'out tok':>9}") for model in MODELS: try: accuracy, median_s, per_thousand, out_tokens = run(model) except Exception as error: # for example, a model or platform that rejects the request print(f"{model:9.0%}{median_s:>10.2f}{per_thousand:>12.3f}{out_tokens:>9.0f}")

run sends each of the eight test messages through classify with a chosen model and records the time, cost, correctness, and output tokens. per_thousand converts the average to dollars per 1,000 requests. The main block runs Haiku, Sonnet, and Opus in turn and prints one row each. If a model or platform rejects the request, the script prints the error and moves on. Eight messages are a smoke test, so replace them with samples from your own traffic before you decide anything.

python compare_models.py

While you wait for your own numbers, list prices give a clean comparison. Take a classification call with 300 input tokens and 30 output tokens, and ignore thinking tokens. At the published prices, that costs:

The cost per 1,000 calls is (300 × input price + 30 × output price) ÷ 1,000,000 × 1,000. This is arithmetic from list prices, not a measurement, and the three models share the same tokenizer family, so the token counts are comparable. On speed, Anthropic says Haiku 5.5 is its fastest model at standard speed, though Opus models in Fast Mode are quicker. Customers report the gap in practice: Asana saw over 30% lower task latency than the model it uses today, and Box measured about half the latency of Haiku 4.5.

Reach for Haiku 5.5 when the task is narrow, the volume is high, or a person is waiting: classification, routing, extraction, summaries, compaction, and sub-agent work. AlphaSense reported that Haiku 5.5 beat Haiku 4.5 on its document question-answering workload — 0.84 against 0.76 — on a job that makes about 8 million calls a week. Stay with Sonnet 5.5 or Opus 5.5 for complex agentic coding, where Anthropic says the larger models remain the better choice. The gap is visible in the benchmarks above. A good rule is to start with Haiku on every high-volume step, test it on a sample of your real data, and move a step up only where the results fall short.

Haiku 5.5 also has a longer runway than its predecessor. Anthropic lists its earliest retirement at October 7, 2027, while Haiku 4.5's earliest date is October 15, 2026 — which is today, though it is still listed as active and Anthropic commits to advance notice before retiring a model. The SDKs also gained beta support for computer use and browser use, the tasks Anthropic says suit a fast, cheap model. My read is that more agent work will move to small models running in parallel under a larger planner, since the evidence so far from Anthropic's customers points that way. That is an expectation, not a promise.

To recap: Haiku 5.5 cuts list prices by 90% for most prompts and adds adaptive thinking, a 1M context window, and a large jump on Anthropic's benchmarks. Migrating means dropping sampling parameters and prefill, reading content blocks by type, and budgeting for more tokens. Use it for classification, extraction, and sub-agents, measure it against Sonnet and Opus on your own data, and escalate only when it falls short.

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →