Learn how to use provider-specific options to control reasoning, caching, and other advanced features.
Provider options let you pass provider-specific configuration that goes beyond the standard settings shared by all providers. They are set via the providerOptions property on functions like generateText and streamText.
Provider options are namespaced by the provider name (e.g. openai, anthropic) so you can even include options for multiple providers in the same call — only the options matching the active provider are used. See Prompts: Provider Options for details on applying options at the message and message-part level.
For controlling reasoning effort, consider using the top-level reasoning
parameter instead of provider-specific options.
It provides a portable setting that works across all providers that support
reasoning. Use provider-specific options only when you need features like
exact token budgets.
The sections below cover the most frequently used provider options, focusing on reasoning and output control for OpenAI and Anthropic. For a complete reference, see the individual provider pages:
For reasoning models (e.g. gpt-6-astra, gpt-6-sol, gpt-6-luna), reasoningEffort controls how much internal reasoning the model performs before responding. Lower values are faster and cheaper; higher values produce more thorough answers.
import { openai, type OpenAILanguageModelResponsesOptions,} from '@ai-sdk/openai';import { generateText } from 'ai';const result = await generateText({ model: openai('gpt-6-astra'), prompt: 'Invent a new holiday and describe its traditions.', providerOptions: { openai: { reasoningEffort: 'low', // 'low' | 'medium' | 'high' | 'xhigh' | 'max' } satisfies OpenAILanguageModelResponsesOptions, },});console.log('Text:', result.text);console.log('Usage:', result.usage);console.log( 'Reasoning tokens:', result.finalStep.providerMetadata?.openai?.reasoningTokens,);
Value
Behavior
'none'
No reasoning (GPT-5.1 models only)
'minimal'
Bare-minimum reasoning
'low'
Fast, concise reasoning
'medium'
Balanced (default)
'high'
Thorough reasoning
'xhigh'
Extra-high reasoning on supported models
'max'
Maximum reasoning on supported models
Supported effort levels vary by model. Using an effort with an unsupported
model will result in an error.
When working with reasoning models, you may want to see how the model arrived at its answer. The reasoningSummary option surfaces the model's thought process.
When reasoningEffort is set to a value other than 'none', the OpenAI Responses provider defaults reasoningSummary to 'detailed'. Set reasoningSummary: null to omit reasoning summaries.
import { openai, type OpenAILanguageModelResponsesOptions,} from '@ai-sdk/openai';import { streamText } from 'ai';const result = streamText({ model: openai('gpt-6-astra'), prompt: 'Tell me about the Mission burrito debate in San Francisco.', providerOptions: { openai: { reasoningSummary: 'detailed', // 'auto' | 'detailed' } satisfies OpenAILanguageModelResponsesOptions, },});for await (const part of result.stream) { if (part.type === 'reasoning') { console.log(`Reasoning: ${part.textDelta}`); } else if (part.type === 'text-delta') { process.stdout.write(part.textDelta); }}
import { openai, type OpenAILanguageModelResponsesOptions,} from '@ai-sdk/openai';import { generateText } from 'ai';const result = await generateText({ model: openai('gpt-6-astra'), prompt: 'Tell me about the Mission burrito debate in San Francisco.', providerOptions: { openai: { reasoningSummary: 'auto', } satisfies OpenAILanguageModelResponsesOptions, },});console.log('Reasoning:', result.finalStep.reasoning);
Control the length and detail of the model's text response independently of reasoning:
import { openai, type OpenAILanguageModelResponsesOptions,} from '@ai-sdk/openai';import { generateText } from 'ai';const result = await generateText({ model: openai('gpt-6-luna'), prompt: 'Write a poem about a boy and his first pet dog.', providerOptions: { openai: { textVerbosity: 'low', // 'low' | 'medium' | 'high' } satisfies OpenAILanguageModelResponsesOptions, },});
Anthropic's thinking feature gives Claude models a dedicated "thinking" phase before they respond. You enable it by providing a thinking object with a token budget.
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';import { generateText } from 'ai';const { text, reasoning, reasoningText } = await generateText({ model: anthropic('claude-opus-4-20250514'), prompt: 'How many people will live in the world in 2040?', providerOptions: { anthropic: { thinking: { type: 'enabled', budgetTokens: 12000 }, } satisfies AnthropicLanguageModelOptions, },});console.log('Reasoning:', reasoningText);console.log('Answer:', text);
The budgetTokens value sets the upper limit on how many tokens the model can use for its internal reasoning. Higher budgets allow deeper reasoning but increase latency and cost.
Thinking is supported on claude-opus-4-20250514, claude-sonnet-4-20250514,
and claude-sonnet-4-5-20250929 models.
The effort option provides a simpler way to control reasoning depth without specifying a token budget. It affects thinking, text responses, and function calls.
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';import { generateText } from 'ai';const { text, usage } = await generateText({ model: anthropic('claude-opus-5-5'), prompt: 'How many people will live in the world in 2040?', providerOptions: { anthropic: { effort: 'low', // 'low' | 'medium' | 'high' } satisfies AnthropicLanguageModelOptions, },});
You can combine multiple provider options in a single call. For example, using both reasoning effort and reasoning summaries with OpenAI:
import { openai, type OpenAILanguageModelResponsesOptions,} from '@ai-sdk/openai';import { generateText } from 'ai';const result = await generateText({ model: openai('gpt-6-astra'), prompt: 'What are the implications of quantum computing for cryptography?', providerOptions: { openai: { reasoningEffort: 'high', reasoningSummary: 'detailed', } satisfies OpenAILanguageModelResponsesOptions, },});
Or enabling thinking with a low effort level for Anthropic:
import { anthropic, AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';import { generateText } from 'ai';const result = await generateText({ model: anthropic('claude-opus-4-20250514'), prompt: 'Explain the Riemann hypothesis in simple terms.', providerOptions: { anthropic: { thinking: { type: 'enabled', budgetTokens: 8000 }, effort: 'medium', } satisfies AnthropicLanguageModelOptions, },});
Provider options work the same way when using the Vercel AI Gateway. Use the underlying provider name (e.g. openai, anthropic) as the key — not gateway. The AI Gateway forwards these options to the target provider automatically.
import type { OpenAILanguageModelResponsesOptions } from '@ai-sdk/openai';import { generateText } from 'ai';const result = await generateText({ model: 'openai/gpt-6-astra', // AI Gateway model string prompt: 'What are the implications of quantum computing for cryptography?', providerOptions: { openai: { reasoningEffort: 'high', reasoningSummary: 'detailed', } satisfies OpenAILanguageModelResponsesOptions, },});
You can also combine gateway-specific options (like routing and fallbacks) with provider-specific options in the same call:
import type { AnthropicLanguageModelOptions } from '@ai-sdk/anthropic';import type { GatewayProviderOptions } from '@ai-sdk/gateway';import { generateText } from 'ai';const result = await generateText({ model: 'anthropic/claude-sonnet-4', prompt: 'Explain quantum computing', providerOptions: { // Gateway-specific: control routing gateway: { order: ['vertex', 'anthropic'], } satisfies GatewayProviderOptions, // Provider-specific: enable reasoning anthropic: { thinking: { type: 'enabled', budgetTokens: 12000 }, } satisfies AnthropicLanguageModelOptions, },});