How to Use Claude Haiku 5.5 Through the API for Cheap Automations

Claude Haiku 5.5 API costs $0.10 per million input tokens as of 16 Oct 2026. Python and Apps Script setup, batch discounts, and the limits to watch.

By Archit Tamrakar · LinkedIn · · 11 min read

Quick answer: Create an API key in the Claude Console, then call the model claude-haiku-5-5 with the Python SDK or a plain HTTP request. Free? No, the API bills per token. Time: about 15 minutes.

As of 16 October 2026, Anthropic's pricing page lists Claude Haiku 5.5 at $0.10 per million input tokens and $0.50 per million output tokens for prompts up to 100,000 tokens. Above that size the price rises to $0.50 and $2.50. This post shows two working setups (Python and Google Sheets) and the settings that keep the bill low.

What do you need before you start?

You need a Claude Console account, an API key, and a way to pay for usage. A Claude chat subscription is separate from API billing, so having Pro or Free chat does not give you API access by itself.

  • Console account: sign up or sign in at platform.claude.com, as described in the quickstart.
  • API key: created in the Console (steps below). It starts with sk-ant- and is shown only once.
  • Payment or credits: Anthropic said on 7 October 2026 it would roll out a monthly API credit to Max and Team subscribers ($100 for Max 5x, $200 for Max 20x, up to $500 pooled for Team). Check your Console billing page to see what applies to you.
  • Python 3 (for Method 1) or a Google account (for Method 2).

How do you use the Claude Haiku 5.5 API in Python? (Method 1: easiest)

Install the anthropic package, set your key as an environment variable, and call client.messages.create with model="claude-haiku-5-5". The steps follow Anthropic's quickstart and API key guide.

  1. Open the Claude Console and sign in.
  2. Go to the API keys page (platform.claude.com/settings/keys).
  3. Click Create key. Name the key, choose an expiration, and set Linked account to yourself.
  4. Copy the key and store it somewhere safe. If you lose it, you must create a new one.
  5. In a terminal, set the key: export ANTHROPIC_API_KEY="your-api-key-here". The SDK reads this variable automatically.
  6. Create a project and install the SDK: mkdir haiku-demo && cd haiku-demo, then python3 -m venv .venv && source .venv/bin/activate, then pip install anthropic.
  7. Create a file called classify.py and paste the script below.
  8. Run it with python classify.py.

Verify this step: adding credits or a payment method before your first call. The menu name may differ in your Console, so look for the Billing page.

import anthropic

client = anthropic.Anthropic()  # reads ANTHROPIC_API_KEY from your environment

SYSTEM = (
    "Classify the customer message as exactly one of: "
    "billing, bug, sales, other. Reply with the single word only."
)


def classify(text: str) -> str:
    response = client.messages.create(
        model="claude-haiku-5-5",
        max_tokens=1024,                    # thinking tokens count toward this limit
        output_config={"effort": "low"},    # cheapest and fastest level
        system=SYSTEM,
        messages=[{"role": "user", "content": text}],
    )
    if response.stop_reason == "refusal":
        return "REFUSED"                    # new on Haiku 5.5: handle it yourself
    for block in response.content:
        if block.type == "text":            # select blocks by type, not position
            return block.text.strip().lower()
    return "NO_TEXT"


if __name__ == "__main__":
    messages = [
        "I was charged twice this month.",
        "The export button does nothing when I click it.",
        "Do you offer a discount for 50 seats?",
    ]
    for m in messages:
        print(m, "->", classify(m))

Three details in that script come straight from Anthropic's migration guide. It sends no temperature, top_p or top_k, because Haiku 5.5 returns a 400 error for most values. It ends messages with a user turn, because a final assistant turn (prefill) is rejected. And it picks the text block by type, because a thinking block can come first.

How do you call Claude Haiku 5.5 from Google Sheets? (Method 2: Apps Script)

Store your key in Script Properties, then use UrlFetchApp.fetch to POST to the Messages API. This script labels each row in column A and writes the label to column B. It skips rows that already have a label, so you can run it again safely.

  1. Open your Google Sheet. Put the text to classify in column A, starting in row 2.
  2. Click Extensions > Apps Script.
  3. At the left, click Project Settings. Under Script Properties, click Add script property.
  4. For Property, enter ANTHROPIC_API_KEY. For Value, paste your key. Click Save script properties. These steps follow Google's Properties Service guide.
  5. Go back to the editor, delete the sample code, and paste the script below.
  6. Click Save project, choose classifyRows in the function dropdown, and click Run. Approve the permission prompt the first time.
const MODEL = 'claude-haiku-5-5';
const SYSTEM_PROMPT =
  'Classify the message as exactly one of: billing, bug, sales, other. ' +
  'Reply with the single word only.';

function classifyRows() {
  const key = PropertiesService.getScriptProperties().getProperty('ANTHROPIC_API_KEY');
  if (!key) throw new Error('Add ANTHROPIC_API_KEY in Project Settings > Script Properties.');

  const sheet = SpreadsheetApp.getActiveSheet();
  const lastRow = sheet.getLastRow();
  if (lastRow < 2) return;

  const inputs = sheet.getRange(2, 1, lastRow - 1, 1).getValues();
  const outputs = sheet.getRange(2, 2, lastRow - 1, 1).getValues();

  for (let i = 0; i < inputs.length; i++) {
    if (!inputs[i][0] || outputs[i][0]) continue; // skip empty or already labelled rows
    outputs[i][0] = callClaude_(key, String(inputs[i][0]));
  }
  sheet.getRange(2, 2, lastRow - 1, 1).setValues(outputs);
}

function callClaude_(key, text) {
  const body = {
    model: MODEL,
    max_tokens: 1024,
    output_config: { effort: 'low' },
    system: SYSTEM_PROMPT,
    messages: [{ role: 'user', content: text }]
  };
  const response = UrlFetchApp.fetch('https://api.anthropic.com/v1/messages', {
    method: 'post',
    contentType: 'application/json',
    headers: { 'x-api-key': key, 'anthropic-version': '2023-06-01' },
    payload: JSON.stringify(body),
    muteHttpExceptions: true
  });
  const code = response.getResponseCode();
  if (code !== 200) return 'ERROR ' + code;
  const data = JSON.parse(response.getContentText());
  if (data.stop_reason === 'refusal') return 'REFUSED';
  const block = (data.content || []).find(function (b) { return b.type === 'text'; });
  return block ? block.text.trim().toLowerCase() : 'NO_TEXT';
}

The x-api-key header is the one Anthropic's key guide names for direct HTTP requests. The API overview lists anthropic-version and content-type as required headers. Setting muteHttpExceptions to true means a failed call returns a response instead of throwing an error, so one bad row does not stop the run.

For more Sheets-side patterns, see How to Pull API Data Into Google Sheets With IMPORTDATA and Apps Script and How to Clean Messy Data in Google Sheets With AI.

How do you make Haiku 5.5 cheaper still? (Method 3: effort, batch and caching)

Use the low effort level, the Batch API, and prompt caching. Anthropic's docs say low is the cheapest and fastest level, meant for simple, high-volume requests. The default is medium.

  • Effort: set output_config={"effort": "low"}, as in the scripts above. Effort affects all output tokens, including thinking, so it also trims reply length.
  • Batch API: the Batch API charges 50% of standard prices. For Haiku 5.5 that is $0.05 input and $0.25 output per million tokens for prompts up to 100,000 tokens. Most batches finish within 1 hour, but a batch expires if it is not done in 24 hours. Use it when you do not need an instant answer.
  • Prompt caching: cache reads cost $0.01 per million tokens for prompts up to 100,000 tokens, against $0.10 for fresh input. The minimum cacheable prompt is 512 tokens. Changing the effort value between requests invalidates the cache for the conversation's messages.
  • Turning thinking off: you can send thinking: {"type": "disabled"}. Anthropic says this works at low, medium and high only, and that telling the model in the prompt to answer directly did not stop it from thinking.

A minimal batch request, adapted from Anthropic's batch example, looks like this:

import anthropic
from anthropic.types.message_create_params import MessageCreateParamsNonStreaming
from anthropic.types.messages.batch_create_params import Request

client = anthropic.Anthropic()

texts = ["I was charged twice this month.", "The export button does nothing."]

batch = client.messages.batches.create(
    requests=[
        Request(
            custom_id=f"row-{i}",  # 1 to 64 letters, digits, hyphens or underscores
            params=MessageCreateParamsNonStreaming(
                model="claude-haiku-5-5",
                max_tokens=1024,
                output_config={"effort": "low"},
                messages=[{"role": "user", "content": t}],
            ),
        )
        for i, t in enumerate(texts)
    ]
)
print(batch.id, batch.processing_status)  # starts as in_progress

The batch is processed asynchronously. Poll it until processing_status is ended, then read the results. Results are kept for 29 days, and one batch holds up to 100,000 requests or 256 MB.

How much will a cheap automation actually cost?

For 1,000 short messages, the model cost is about 10 cents on Haiku 5.5 at standard prices, based on the assumptions below. This is the author's arithmetic on Anthropic's published prices, not a measured result.

Assumptions: 500 input tokens and 100 output tokens per message (thinking included), all prompts under 100,000 tokens. That gives 0.5 million input tokens and 0.1 million output tokens in total. Real counts will differ, so measure your own usage fields.

Model (as of 16 Oct 2026)Input / output per million tokensCost for 1,000 messages, standardCost, Batch API
Claude Haiku 5.5$0.10 / $0.50$0.10$0.05
Claude Sonnet 5.5$2 / $10$2.00$1.00
Claude Opus 5.5$4 / $20$4.00$2.00

Sonnet and Opus prices come from the same pricing page. The Opus batch figure applies the page's 50% batch discount. Token counts differ by model and effort level, so treat the table as a rough comparison only.

Compared with Haiku 4.5 ($1 input, $5 output per million tokens), Anthropic says Haiku 5.5 is priced 90% lower for requests up to 100,000 tokens, and about 75% cheaper to run on average once token-count changes are included (a company claim). The new tokenizer matters here: the migration guide says the same text counts as roughly 30% more tokens than on Haiku 4.5.

Which method should you choose?

Pick Python for scripts you run on a schedule, Apps Script if your data already lives in Google Sheets, and the Batch API for large, non-urgent jobs.

MethodCostDifficultyLimitsBest for
1. Python SDKStandard token pricesEasyYou manage the key and schedulingScripts, cron jobs, back-end tasks
2. Apps ScriptStandard token prices, no add-on feeEasy to mediumCalls run row by row from the sheetLabelling or summarising spreadsheet rows
3. Batch API50% of standard pricesMediumResults can take up to 24 hoursBulk jobs with no deadline

If you want Claude to write the Apps Script for you, see How to Write Apps Script With Claude, With No Coding Experience. For comparison with another model inside Sheets, see How to Use ChatGPT Inside Google Sheets.

What's free and what costs money?

The API has no free chat-style quota: you pay per token. All prices below are Anthropic's list prices as of 16 October 2026.

ItemPrice
Input, prompt up to 100,000 tokens$0.10 per million tokens
Output, prompt up to 100,000 tokens$0.50 per million tokens
Input / output, prompt over 100,000 tokens$0.50 / $2.50 per million tokens
Cache read (up to / over 100,000)$0.01 / $0.05 per million tokens
5-minute cache write (up to / over 100,000)$0.125 / $0.625 per million tokens
Batch API50% off input and output

A request whose prompt is over 100,000 tokens pays the higher prices for the whole request, even if part of the prompt is a cache hit. Haiku 5.5 has a 1M token context window, but filling it costs five times more per token than a short prompt.

Set a spend limit first. In the Console, go to the Billing page (platform.claude.com/settings/billing). In the Spend limits section, click Adjust limit (or Set limit) and enter an amount. Per Anthropic's rate limits page, your limit cannot exceed your tier's monthly cap: $500 on Start, $1,000 on Build, $200,000 on Scale. New organizations may begin in an Evaluation tier with lower rate limits.

What can go wrong, and how do you fix it?

Most failures come from settings carried over from older models, from refusals, or from spend limits. The first four rows below are documented in Anthropic's guides.

ProblemCauseFix
HTTP 400 mentioning temperature, top_p or top_kHaiku 5.5 only accepts default sampling valuesRemove all three fields
HTTP 400 on a request ending with an assistant messagePrefill is rejected, even with thinking offEnd messages with a user turn
HTTP 400 on thinking with budget_tokensOld thinking setupUse thinking: {"type": "adaptive"} or leave it out, and set effort
Reply is empty or cut offThinking tokens count toward max_tokensRaise max_tokens or lower the effort level
stop_reason is refusalNew safety classifiers declined the requestHandle it in code; retrying usually fails again
HTTP 429 with no retry-after headerMonthly spend cap reachedWait for 00:00 UTC on the first of next month, or ask for a higher limit

Note the last row: when your own spend limit is hit, the API returns HTTP 400 with an invalid_request_error. When the tier cap is hit, it returns 429. Automatic retries will not help in either case.

Is this allowed?

Yes, calling the API from your own scripts is the intended use. Keep these rules in mind.

  • Keep the key private. Never paste it into a shared sheet, a public repository or a client-side web page. Script Properties keep it out of your code.
  • Respect the safeguards. Haiku 5.5 runs classifiers in four categories: cyber, frontier_llm, bio and general_harms. Anthropic says benign work can sometimes trigger them, and offers verification programs for legitimate cybersecurity and life sciences work.
  • Mind personal data. If your rows contain customer details, check your own privacy obligations before sending them to any API. This post does not cover them.
  • Do not use it to send spam or unsolicited outreach. An automation that writes bulk messages is still subject to anti-spam and consent laws where you operate.

What's still unclear?

Three points are open as of 16 October 2026.

Quality on your task. The model is new. Anthropic's own materials say Haiku 5.5 suits narrowly scoped tasks such as summaries and classification, and that Sonnet 5.5 and Opus 5.5 remain better for complex agentic coding. Test on a sample of your real data before you trust it.

Token use and cost per task. Artificial Analysis, an independent benchmarking site, reports that at max effort Haiku 5.5 used about 162,000 output tokens per task on its index, roughly three times GPT-6 Luna. At high effort it reported about 55,000. A low per-token price does not guarantee a low bill if you run high effort. It also said its provisional cost figures did not yet include the over-100,000-token price step.

Refusals and benchmark gaps. Artificial Analysis says a safety refusal issue caused over-refusal in pre-release testing and that its AutomationBench-AA score of 35% is likely understated, with Anthropic working on a fix. The two sources also differ on one coding benchmark: Anthropic reports 39.2% on Terminal-Bench 4.0 (a company-reported figure), while Artificial Analysis reports 33%. For automations, log every refusal and check how often it happens on your data.

Priority Tier is also not supported on Haiku 5.5, per the migration guide, so you cannot buy guaranteed capacity for it.

Last checked: 16 October 2026. Code follows Anthropic and Google documentation and has not been run by the author, so try it on a few rows first.

Frequently asked questions

What is the Claude Haiku 5.5 model ID?

On the Claude API the model ID is claude-haiku-5-5. Anthropic's migration guide says it is a fixed ID with no date suffix and no separate alias. Other platforms use their own formats: Amazon Bedrock uses anthropic.claude-haiku-5-5, while Google Cloud, Microsoft Foundry and Claude Platform on AWS use claude-haiku-5-5.

How much does Claude Haiku 5.5 cost per million tokens?

As of 16 October 2026, Anthropic lists $0.10 per million input tokens and $0.50 per million output tokens for prompts up to 100,000 tokens. Above 100,000 tokens the prices rise to $0.50 input and $2.50 output. The Batch API takes 50% off both input and output.

Why does my old Haiku 4.5 code return a 400 error on Haiku 5.5?

Anthropic's migration guide lists the usual causes. Haiku 5.5 rejects temperature or top_p values other than the defaults, any top_k, a thinking budget_tokens setting, and a final assistant message (prefill). Remove those fields, end your messages with a user turn, and use the effort setting instead of a thinking budget.

Is there a free way to try the Claude API with Haiku 5.5?

The API bills per token, separate from the free Claude chat plan. Anthropic said on 7 October 2026 that it would roll out a monthly Claude Platform API credit to Max and Team subscribers that week ($100 for Max 5x, $200 for Max 20x, up to $500 pooled for Team). Check your Console billing page to see what applies to your account.

What happens if Haiku 5.5 refuses a request?

The response comes back with stop_reason set to refusal, and stop_details.category names the reason. Anthropic's docs say Haiku 5.5 has no server-side fallback, and that sending the same request again usually returns another refusal. Your code should check for the refusal and route the item to a person or a different model.

Should I use Haiku 5.5 or Sonnet 5.5 for my automation?

Anthropic says Haiku 5.5 suits narrowly scoped, high-volume work such as classification, summaries and subagent tasks, and that Sonnet 5.5 and Opus 5.5 remain better for complex agentic coding. Start with Haiku on a small sample of your own data, and move up only if the results are not good enough.

Sources

  1. Claude Haiku 5.5 (model overview), Anthropic, Claude Platform Docs (2026-10-16)
  2. Pricing, Anthropic, Claude Platform Docs (2026-10-16)
  3. Claude Haiku 5.5 migration guide, Anthropic, Claude Platform Docs (2026-10-16)
  4. Prompting Claude Haiku 5.5, Anthropic, Claude Platform Docs (2026-10-16)
  5. Effort, Anthropic, Claude Platform Docs (2026-10-16)
  6. Get your Claude API key, Anthropic, Claude Platform Docs (2026-10-16)
  7. Get started with Claude, Anthropic, Claude Platform Docs (2026-10-16)
  8. Rate limits, Anthropic, Claude Platform Docs (2026-10-16)
  9. Batch processing, Anthropic, Claude Platform Docs (2026-10-16)
  10. API overview, Anthropic, Claude Platform Docs (2026-10-16)
  11. Claude Haiku 5.5, Anthropic (2026-10-07)
  12. Anthropic has released Claude Haiku 5.5, scoring 43 on the Artificial Analysis Intelligence Index, Artificial Analysis (2026-10-07)
  13. Anthropic launches Claude Haiku 5.5 with 90% API price reduction, matching GPT-6 Luna, VentureBeat (2026-10-07)
  14. Properties Service, Google for Developers (2026-10-16)
  15. Class UrlFetchApp, Google for Developers (2026-10-16)