Claude Haiku 4.5 is now available through Netlify’s AI Gateway — no extra setup required. You can use the native Anthropic SDK without managing API keys or external accounts. Here’s how to use it today in a Netlify Function with the Anthropic SDK: import Anthropic from "@anthropic-ai/sdk"; export default async function handler(req: Request) { const body = (await req.json().catch(() => null)) as { message?: string; model?: string; } | null; const input = body?.message ?? "Give me pros and cons of using claude-haiku-4-5-20251001 over other models."; const model = body?.model ?? "claude-haiku-4-5-20251001"; const anthropic = new Anthropic(); const response = await anthropic.messages.create({ model, max_tokens: 1024, messages: [ { role: "user", content: input, }, ], }); return Response.json({ answer: response.content[0] }); } export const config = { path: "/anthropic", }; This is supported across Edge, Background, and Scheduled Functions and includes features like Rate-Limiting, access to Netlify's advanced caching primitives, and many others. Learn more in the AI Gateway docs.
Continue reading...
Continue reading...