ai-sdk-6
БесплатноБез исполняемых скриптовНе проверенVercel AI SDK v6 development, for projects already on ai@6. Use when building or maintaining AI agents, chatbots, tool integrations, streaming apps, or…
от laguagu★ 75 звёзд на GitHubОб этом скилле
AI SDK 6 maintenance
Apply this skill only to ai@6 projects. Resolve compatible provider and UI
packages from the existing manifest/lockfile. Use ai-sdk when the major is
unknown and ai-sdk-7 for an authorized upgrade.
Read the resolved ai/docs/, provider docs and source/types for the exact minor
release. In a monorepo, resolve from the app using the dependency. Default web
docs and repository main can describe v7. ai bundles docs/ from 6.0.32; the
tree mirrors the website paths (mapping in ai-sdk). If installed docs are
unavailable, select the ai@<resolved-version> tag in vercel/ai and read
content/docs/.
Feature links here use a checked v6 documentation snapshot
as a fallback; match the project's release when available. This tag selects
documentation, not an application dependency version.
Boundaries that differ from old and new code
- Text functions use
system;ToolLoopAgentusesinstructions. - Loop limits use
stopWhen: stepCountIs(...). Text functions default to one step (tool execution without a follow-up answer);ToolLoopAgentdefaults to 20. convertToModelMessagesis async; await it.- Use text functions with
Outputfor new schema output; legacy object functions are deprecated. - Tools use
inputSchema; SDK-executed approval is tool-levelneedsApproval. V6 does not know v7'stoolApproval: unless a typecheck rejects it, it is ignored and the tool runs without approval. - React
useChatowns messages and stream status, not form input. Use the appropriate transport and UI-message response protocol. - Core completion callbacks are
onFinish; resultusageis final-step usage, whiletotalUsagecovers all steps.
Use a configured model verified for the actual provider. Typecheck and test a multi-turn stream with relevant tool/approval/error states after integration changes.
Core shape
Checked with [email protected], @ai-sdk/[email protected], [email protected], React 19 and
TypeScript 5.9: tsc --noEmit, plus a mock-model run through one tool step and
the follow-up answer. A string model resolves through the AI Gateway. In v7,
system, stepCountIs and result.toUIMessageStreamResponse() become
instructions, isStepCount and
createUIMessageStreamResponse({ stream: toUIMessageStream({ stream: result.stream }) }).
// app/api/chat/route.ts
import { convertToModelMessages, stepCountIs, streamText, tool, validateUIMessages,
type InferUITools, type UIDataTypes, type UIMessage } from 'ai';
import { z } from 'zod';
const tools = {
weather: tool({
inputSchema: z.object({ city: z.string() }),
execute: async ({ city }) => ({ city, celsius: 21 }),
}),
};
export type ChatMessage = UIMessage<never, UIDataTypes, InferUITools<typeof tools>>;
export async function POST(req: Request) {
const { messages } = await req.json();
const uiMessages = await validateUIMessages<ChatMessage>({ messages, tools });
const result = streamText({
model: 'provider/model-id', // configured gateway ID, or a provider instance
system: 'Answer briefly.',
messages: await convertToModelMessages(uiMessages),
tools,
stopWhen: stepCountIs(5),
});
return result.toUIMessageStreamResponse();
}
// app/page.tsx
'use client';
import { useChat } from '@ai-sdk/react';
import { DefaultChatTransport } from 'ai';
import type { ChatMessage } from './api/chat/route';
const transport = new DefaultChatTransport<ChatMessage>({ api: '/api/chat' });
export default function Chat() {
const { messages, sendMessage, status } = useChat<ChatMessage>({ transport });
return (
<form action={(form) => void sendMessage({ text: String(form.get('text')) })}>
{messages.map((m) => <div key={m.id}>{m.parts.map((part, i) =>
part.type === 'text' ? <p key={i}>{part.text}</p>
: part.type === 'tool-weather' && part.state === 'output-available'
? <p key={i}>{part.output.city}: {part.output.celsius} °C</p> : null)}</div>)}
<input name="text" disabled={status === 'submitted' || status === 'streaming'} />
</form>
);
}
Read for the feature
- Agents: loop limits, call options and context.
- Core functions: output and stream contracts.
- Tools: execution, approval and typed states.
- UI hooks: transport, restoration and stream lifetime.
- Middleware: provider interception.
- MCP: transport and cleanup.
- Workflows: when a loop needs explicit orchestration.
- Examples: version-matched official implementations.
Установить ai-sdk-6 в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл ai-sdk-6?
Vercel AI SDK v6 development, for projects already on ai@6. Use when building or maintaining AI agents, chatbots, tool integrations, streaming apps, or structured output in a v6 codebase. New projects and ai@7 code use ai-sdk-7; an unknown version goes through ai-sdk. Covers ToolLoopAgent, useChat, generateText, streamText, tool approval, provider tools, MCP integration, and Output patterns.
Как установить скилл ai-sdk-6?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл ai-sdk-6 запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic