| name | clade-performance-tuning |
| description | Optimize Anthropic API latency — streaming, prompt caching, model selection,
Use when working with performance-tuning patterns.
connection reuse, and parallel requests.
Trigger with "anthropic slow", "claude latency", "speed up anthropic",
"anthropic performance", "claude response time".
|
| allowed-tools | Read, Write, Edit |
| version | 1.0.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","anthropic","claude","performance","latency"] |
| compatibility | Designed for Claude Code |
Anthropic Performance Tuning
Overview
Claude latency has two components: time to first token (TTFT) and tokens per second (TPS). Different strategies target each.
Latency Benchmarks (approximate)
| Model | TTFT (p50) | TTFT (p95) | Output TPS |
|---|
| Claude Haiku 4.5 | 200ms | 600ms | ~150 |
| Claude Sonnet 4 | 400ms | 1.2s | ~90 |
| Claude Opus 4 | 800ms | 2.5s | ~40 |
Optimization Strategies
Instructions
Step 1: Always Stream
const stream = client.messages.stream({
model: 'claude-sonnet-4-20250514',
max_tokens: 1024,
messages,
});
for await (const event of stream) {
if (event.type === 'content_block_delta') {
yield event.delta.text;
}
}
Step 2: Prompt Caching — Faster TTFT
const message = await client.messages.create({
model: 'claude-sonnet-4-20250514',
: ,
: [{
: ,
: largeSystemPrompt,
: { : },
}],
messages,
}, {
: { : },
});