Anthropic models support matrix
Anthropic models and their capabilities: claude-sonnet-5, claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5, claude-opus-4-1, and claude-sonnet-4-0 all support Image Input, Object Generation, Tool Usage, and Tool Streaming.
generateText with Claude 4 basic usage
The generateText function from the AI SDK can call Claude 4 with minimal setup. It returns an object containing `text`, `reasoningText`, and `reasoning` properties. Basic usage: import { anthropic } from '@ai-sdk/anthropic'; import { generateText } from 'ai'; const { text, reasoningText, reasoning } = await generateText({ model: anthropic('claude-sonnet-4-20250514'), prompt: 'How will quantum computing impact cryptography by 2050?' }); console.log(text);
generateText with extended thinking and reasoning
The generateText function returns reasoning capabilities when extended thinking is enabled. The response object contains: `text` (the main response), `reasoningText` (the full reasoning text), and `reasoning` (reasoning details including redacted reasoning). Extended thinking is configured via providerOptions.anthropic.thinking with budgetTokens set to control the thinking budget.
streamText with Claude 4 and extended thinking
The streamText function supports Claude 4 with extended thinking. Configure it by passing model as anthropic('claude-sonnet-4-20250514'), setting providerOptions.anthropic.thinking to { type: 'enabled', budgetTokens: <number> }, and including the 'anthropic-beta': 'interleaved-thinking-2025-05-14' header for interleaved thinking. The result includes a stream property that can be passed to toUIMessageStream.
useChat hook with Claude 4
The useChat hook from '@ai-sdk/react' can be used to build chat interfaces with Claude 4. It is instantiated with a DefaultChatTransport configuration specifying the API endpoint (e.g., { api: '/api/chat' }). The hook returns messages and a sendMessage function. Messages contain an id, role, and parts array where each part has a type (text, reasoning, etc.) and text content.
Claude 4 capabilities overview
Claude 4 excels at complex reasoning, code generation and analysis, detailed content creation, and agentic capabilities. It is ideal for powering sophisticated AI workflows, customer-facing agents, and applications requiring nuanced understanding and responses. Claude 4 builds on extended thinking capabilities to enable more sophisticated problem-solving through careful, step-by-step reasoning.
Anthropic supports text generation with extended thinking
Anthropic's Claude 4 models support text generation through the generateText function. The response includes reasoning capabilities when extended thinking is enabled, returning text, reasoningText, and reasoning properties. This addresses text generation capability.
Claude models image input capability
The following Claude models support image input: claude-opus-5, claude-sonnet-5, claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-1, claude-opus-4-0, and claude-sonnet-4-0.
Claude models object generation capability
All Claude models support object generation: claude-opus-5, claude-sonnet-5, claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-1, claude-opus-4-0, and claude-sonnet-4-0.
Claude models computer use capability
All Claude models support computer use: claude-opus-5, claude-sonnet-5, claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-1, claude-opus-4-0, and claude-sonnet-4-0.
Claude models tool search capability
The following Claude models support tool search: claude-opus-5, claude-sonnet-5, claude-fable-5, claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-5. Tool search is not supported by claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-opus-4-1, claude-opus-4-0, or claude-sonnet-4-0.
Claude models compaction capability
The following Claude models support compaction: claude-opus-5, claude-sonnet-5, and claude-fable-5. Compaction is not supported by claude-opus-4-8, claude-opus-4-7, claude-opus-4-6, claude-sonnet-4-6, claude-opus-4-5, claude-haiku-4-5, claude-sonnet-4-5, claude-opus-4-1, claude-opus-4-0, or claude-sonnet-4-0.
Anthropic thinking configuration with budgetTokens
When configuring Anthropic models with extended reasoning, you can set provider-specific options using middleware with providerOptions.anthropic.thinking.type set to 'enabled' and budgetTokens set to a specific value (e.g., 32000).