Установка
SKILL.md
AI SDK 6 to 7 Migration
Use content/docs/08-migration-guides/23-migration-guide-7-0.mdx from the AI SDK repo as the source of truth. This skill is the working checklist; read the guide for exact examples or when behavior is unclear.
Migration Workflow
- Ensure the user has a clean backup or committed baseline before editing.
- Inspect
package.jsonand lockfiles to identify installedai,@ai-sdk/*, provider, UI, MCP, and telemetry packages. - Upgrade AI SDK packages to latest versions, and add
@ai-sdk/otelonly if the project uses OpenTelemetry spans. - Update runtime and module assumptions: Node.js must be
>=22, and AI SDK packages are ESM-only. Replacerequire()imports with ESM imports and add"type": "module"or use.mjswhere needed. - Search for the v6 patterns below, migrate only the code that exists, then run typecheck and targeted tests.
Prefer behavior-preserving changes. When v7 changes semantics, decide whether the app wants the new all-steps behavior or the previous final-step-only behavior.
Core API Changes
experimental_customProvider->customProvider.experimental_generateImage->generateImage;Experimental_GenerateImageResult->GenerateImageResult.experimental_transcribe->transcribe;Experimental_TranscriptionResult->TranscriptionResult.experimental_generateSpeech->generateSpeech;Experimental_SpeechResult->SpeechResult.experimental_outputoption/result ->outputoption/result.CallSettings->LanguageModelCallOptions & Omit<RequestOptions, 'timeout'>;prepareCallSettings->prepareLanguageModelCallOptions.stepCountIs->isStepCount.
Prompts and Steps
- Rename top-level
systemtoinstructionsforgenerateText,streamText,generateObject,streamObject, andstreamUI. - Move
{ role: 'system' }messages frompromptormessagesinto top-levelinstructions. Only useallowSystemInMessages: truefor trusted persisted messages. - Rename
experimental_prepareSteptoprepareStep. - In
prepareStep, rename returnedsystemtoinstructions. - In
experimental_repairToolCall, use{ instructions }instead of{ system }. - Audit
prepareStepbehavior: returnedinstructionsandmessagesnow carry forward into later steps. If code depended on one-step-only overrides, rebuild frominitialInstructions,initialMessages, andresponseMessagesexplicitly.
Lifecycle Callbacks
experimental_onStart->onStart.experimental_onStepStart->onStepStart.onFinish->onEnd.onStepFinish->onStepEnd.- For
embed,embedMany, andrerank,experimental_onFinish->onEnd. - Callback event fields use
instructionsinstead ofsystem.
Usage, Telemetry, and Include Options
usage.cachedInputTokens->usage.inputTokenDetails.cacheReadTokens.usage.reasoningTokens->usage.outputTokenDetails.reasoningTokens.- OpenTelemetry moved out of
ai; install@ai-sdk/oteland callregisterTelemetry(new OpenTelemetry(...))at app startup. - Telemetry is enabled by default once an integration is registered. Remove redundant
isEnabled: true; useisEnabled: falseto opt out per call. - Move
experimental_telemetry.tracerinto theOpenTelemetryconstructor. experimental_telemetry->telemetry.- Telemetry integration callbacks:
onRerankFinish->onRerankEnd,onEmbedFinish->onEmbedEnd. Update tracing-channel subscribers for the same event type names. experimental_include->include.includeRawChunks->include.rawChunks.- Request and response bodies are excluded by default. If code reads
request.bodyorresponse.body, opt in withinclude.requestBodyand, forgenerateText,include.responseBody.
Streaming, Messages, and Tools
StreamTextResult.fullStream->stream.streamTextonChunknow receives all stream parts, including lifecycle, boundary, finish, abort, and error parts. Guard bychunk.typebefore assuming text/tool/raw content.step.response.messagesis no longer accumulated across previous steps. Useresult.responseMessagesfor the full response message history, or flattenresult.steps.- Tool execution callbacks:
experimental_onToolCallStart->onToolExecutionStart,experimental_onToolCallFinish->onToolExecutionEnd. - Tool callback
experimental_context->context. - Split shared runtime data from tool-specific data: use top-level
runtimeContextfor orchestration state, declare per-toolcontextSchema, and pass per-tool values throughtoolsContext. - Move
needsApprovalfromtool()/dynamicTool()into per-call or agenttoolApproval. experimental_activeTools->activeTools.ToolCallOptions->ToolExecutionOptions.isToolOrDynamicToolUIPart->isToolUIPart.
Content Parts and Reasoning
- Tool result
{ type: 'media' }is removed; use{ type: 'file-data' }. - Migrate
toModelOutputimage-*,file-*,file-id, andimage-file-idvariants to canonical{ type: 'file', mediaType, data: { type: 'data' | 'url' | 'reference', ... } }. - User message
{ type: 'image', image, mediaType? }is deprecated; use{ type: 'file', mediaType: 'image' | 'image/*', data }. - Add support for the new
reasoning-filecontent type in exhaustive switches, renderers, serializers, and validators. - When adopting top-level
reasoning, remove overlapping provider-specific reasoning settings fromproviderOptionsunless provider-specific settings intentionally take precedence.
Multi-Step Result Shape
result.usagenow includes all steps;result.totalUsageis deprecated. Useresult.finalStep.usagefor final-step-only usage.- Top-level
content,toolCalls,staticToolCalls,dynamicToolCalls,toolResults,staticToolResults,dynamicToolResults,files,sources, andwarningsnow include all steps. UsefinalStepfor previous final-step-only behavior. - Top-level
reasoning,reasoningText,request,response, andproviderMetadataare deprecated for final-step data. Useresult.finalStep.*; forstreamText, awaitresult.finalStep. - Apply the same result-shape rules to
onEndevents.
Stream Response Helpers
The streamText result helper methods are deprecated. Replace result methods with top-level stateless helpers:
result.toUIMessageStream(...)->toUIMessageStream({ stream: result.stream, ... }).result.toUIMessageStreamResponse(...)->toUIMessageStream(...)pluscreateUIMessageStreamResponse({ stream }).result.pipeUIMessageStreamToResponse(response, ...)->toUIMessageStream(...)pluspipeUIMessageStreamToResponse({ response, stream }).result.toTextStreamResponse()->toTextStream({ stream: result.stream })pluscreateTextStreamResponse({ stream }).result.pipeTextStreamToResponse(response)->toTextStream({ stream: result.stream })pluspipeTextStreamToResponse({ response, stream }).
Package-Specific Checks
- MCP:
MCPTransportConfig.redirectnow defaults to'error'. Only setredirect: 'follow'for trusted MCP servers that rely on redirects. - Vue:
@ai-sdk/vueChatclass is deprecated. PreferuseChat, including getter/ref init for reactive chat inputs. - Anthropic and
@ai-sdk/google-vertex/anthropic:providerMetadata.anthropic.cacheCreationInputTokenswas removed. Useusage.inputTokenDetails.cacheWriteTokens; raw Anthropic usage remains atfinalStep.providerMetadata?.anthropic?.usage. - Google: rename
GoogleGenerativeAI*types, classes, and functions toGoogle*, e.g.createGoogleGenerativeAI->createGoogle. Thegoogleentry point is unchanged.
Validation
Run the project typecheck after edits, then the smallest relevant test suite. Also smoke-test streaming, chat UI, tool execution, telemetry, and multi-step flows if the migration touched them. If type errors remain, search the migration guide for the exact removed or renamed symbol before inventing a workaround.
Вставить в README
Ссылка на карточку для вашего README — без картинок и счётчиков.
[DarkPlay: migrate-ai-sdk-v6-to-v7](https://darkplay.ru/ai/skills/vercel-ai-migrate-ai-sdk-v6-to-v7)
Из того же репозитория
Похожие скиллы и другие разделы каталога
Самые востребованные скиллов раздела по установкам и звёздам.
find-skillsvercel-labs · Помогает находить и устанавливать навыки агентов по запросам вроде «как сделать X»…
grill-memattpocock · Настойчивое интервью для доработки плана или дизайна.
hyperframesheygen-com · Обязательная точка входа для любых задач по видео, анимации и motion-графике в…
hyperframes-cliheygen-com · Цикл разработки HyperFrames CLI: init, add, render, preview, publish и другие команды.
agent-browservercel-labs · CLI для автоматизации браузера для ИИ-агентов: навигация по страницам, заполнение форм…
media-useheygen-com · Agent Media OS: единый навык для медиа в HyperFrames — BGM, SFX, изображения, голос, LUT.
hyperframes-registryheygen-com · Установка и подключение блоков реестра в композиции HyperFrames через add и catalog.
grill-with-docsmattpocock · Настойчивое интервью для доработки плана или дизайна, попутно создающее документацию (ADR…
improve-codebase-architecturemattpocock · Поиск в кодовой базе возможностей для углубления, визуальный HTML-отчёт о них и детальный…
tddmattpocock · Разработка через тестирование (TDD): red-green-refactor и интеграционные тесты.Соседние разделы каталога: возможно, нужный инструмент живёт там.
claude-opus-4-5-migrationanthropics · Перенос кода и промптов с Sonnet 4.x и Opus 4.1 на Opus 4.5.
astronomer-data-agentsanthropics · Инженерия данных для Apache Airflow и Astronomer: написание DAG по лучшим практикам…
aws-transformanthropics · Миграция, модернизация и обновление кодовых баз на AWS: .NET Framework в .NET 8/10, COBOL…
dataanthropics · Инженерия данных для Apache Airflow и Astronomer. Создание DAG по лучшим практикам…
Azure Iac Exportergithub · Экспорт существующих ресурсов Azure в шаблоны Infrastructure as Code через анализ Azure…
pwalirezarezvani · Продакшн-тулкит для тестирования на Playwright: 9 навыков, 3 агента, 55 шаблонов…
astronomeranthropics · Data engineering для Airflow и Astronomer: DAG, отладка, lineage, миграция на Airflow 3.
astronomer-data-agentsanthropics · Data engineering для Airflow и Astronomer: DAG, отладка пайплайнов, lineage и миграция.
cplnanthropics · Развёртывание и управление нагрузками в Control Plane — виртуальном облаке поверх AWS…
nganthropics · Помощник по Angular: генерация, ревью, тестирование и миграция приложений.Лучшие ИИ-инструменты для генерации видео
Подборка нейросетей для генерации и монтажа видео. Инструменты, которые превращают текст в готовые ролики, экономят часы на съемках и постпродакшне. Подходит для SMM-специалистов,
VEED.IOVeed
MootionMootion
Sora (OpenAI)OpenAI
viralpulse.appViralpulse
Viral Maker AIViral-makerЛучшие ИИ-инструменты для генерации текста и копирайтинга
Подборка нейросетей для генерации текстов и копирайтинга. Сервисы, которые помогают создавать статьи, посты и рекламные объявления с нуля или по черновику, экономя часы рутинной ра
NeuroscribeNeuroscribe
GoGPTGogpt
НейроТекстерNeuro-texter
ChatGPTOpenAI
Cosmo ScribeCosmoscribe
Memo HelperCopilot33
LibraChatLibrachatЛучшие ИИ-инструменты для генерации изображений
Подборка нейросетей для генерации изображений от фотореализма до концепт-арта. Сервисы, которые экономят часы ручной работы, создавая визуал для блогов, рекламы и дизайна за минуты
MagviMagvi
DALL-E 3OpenAI
SupaLabSupalab
Freestyling.aiFreestyling
ArtGeneration.meArtgeneration
BigjpgBigjpg
Художник от VKVK
Avato AI12ai
Virton AIVirton