Anthropic Messages API
Haiku 5.5 API & SDK Quickstart
Integrate Claude Haiku 5.5 using official Anthropic client libraries. Take advantage of streaming, structured tool use, and 90% prompt caching discounts:
Model Identifier
claude-5-5-haiku-latest Alias pointing to latest production build Max Output Tokens
8,192 Tokens Context window: 200,000 tokens 1. Python SDK Streaming Example
pip install anthropicimport anthropic
client = anthropic.Anthropic()
with client.messages.stream(
model="claude-5-5-haiku-latest",
max_tokens=1024,
temperature=0.7,
system="You are an expert low-latency AI coding assistant.",
messages=[
{"role": "user", "content": "Write an asynchronous token bucket rate limiter in Python."}
]
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True) 2. TypeScript with Prompt Caching (90% Discount)
npm install @anthropic-ai/sdkimport Anthropic from '@anthropic-ai/sdk';
const anthropic = new Anthropic();
async function main() {
const message = await anthropic.messages.create({
model: 'claude-5-5-haiku-latest',
max_tokens: 1024,
system: [
{
type: 'text',
text: 'Massive 50,000-word product documentation text here...',
cache_control: { type: 'ephemeral' } // 90% discount on cache read!
}
],
messages: [
{ role: 'user', content: 'What is the return policy outlined in section 4?' }
]
});
console.log(message.content[0].text);
}
main();