Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

ai-sdk-core

БесплатноЗапускает вложенные скриптыНе проверен

Build backend AI with Vercel AI SDK v5/v6. Covers v6 beta (Agent abstraction, tool approval, reranking), v4→v5 migration (breaking changes), latest models…

ovachieverот ovachiever★ 56 звёзд на GitHub19 установок в других каталогах

Об этом скилле

AI SDK Core

Backend AI with Vercel AI SDK v5 and v6 Beta.

Installation:

npm install ai @ai-sdk/openai @ai-sdk/anthropic @ai-sdk/google zod
# Beta: npm install ai@beta @ai-sdk/openai@beta

AI SDK 6 Beta (November 2025)

Status: Beta (stable release planned end of 2025) Latest: [email protected] (Nov 22, 2025)

New Features

1. Agent Abstraction Unified interface for building agents with ToolLoopAgent class:

  • Full control over execution flow, tool loops, and state management
  • Replaces manual tool calling orchestration

2. Tool Execution Approval (Human-in-the-Loop) Request user confirmation before executing tools:

  • Static approval: Always ask for specific tools
  • Dynamic approval: Conditional based on tool inputs
  • Native human-in-the-loop pattern

3. Reranking Support Improve search relevance by reordering documents:

  • Supported providers: Cohere, Amazon Bedrock, Together.ai
  • Specialized reranking models for RAG workflows

4. Structured Output (Stable) Combine multi-step tool calling with structured data generation:

  • Multiple output strategies: objects, arrays, choices, text formats
  • Now stable and production-ready in v6

5. Call Options Dynamic runtime configuration:

  • Type-safe parameter passing
  • RAG integration, model selection, tool customization
  • Provider-specific settings adjustments

6. Image Editing (Coming Soon) Native support for image transformation workflows.

Migration from v5

Unlike v4→v5, v6 has minimal breaking changes:

  • Powered by v3 Language Model Specification
  • Most users require no code changes
  • Agent abstraction is additive (opt-in)

Install Beta:

npm install ai@beta @ai-sdk/openai@beta @ai-sdk/react@beta

Official Docs: https://ai-sdk.dev/docs/announcing-ai-sdk-6-beta


Latest AI Models (2025)

OpenAI

GPT-5 (Aug 7, 2025):

  • 45% less hallucination than GPT-4o
  • State-of-the-art in math, coding, visual perception, health
  • Available in ChatGPT, API, GitHub Models, Microsoft Copilot

GPT-5.1 (Nov 13, 2025):

  • Improved speed and efficiency over GPT-5
  • Available in API platform
import { openai } from '@ai-sdk/openai';
const gpt5 = openai('gpt-5');
const gpt51 = openai('gpt-5.1');

Anthropic

Claude 4 Family (May-Oct 2025):

  • Opus 4 (May 22): Best for complex reasoning, $15/$75 per million tokens
  • Sonnet 4 (May 22): Balanced performance, $3/$15 per million tokens
  • Opus 4.1 (Aug 5): Enhanced agentic tasks, real-world coding
  • Sonnet 4.5 (Sept 29): Most capable for coding, agents, computer use
  • Haiku 4.5 (Oct 15): Small, fast, low-latency model
import { anthropic } from '@ai-sdk/anthropic';
const sonnet45 = anthropic('claude-sonnet-4-5-20250929');  // Latest
const opus41 = anthropic('claude-opus-4-1-20250805');
const haiku45 = anthropic('claude-haiku-4-5-20251015');

Google

Gemini 2.5 Family (Mar-Sept 2025):

  • Pro (March 2025): Most intelligent, #1 on LMArena at launch
  • Pro Deep Think (May 2025): Enhanced reasoning mode
  • Flash (May 2025): Fast, cost-effective
  • Flash-Lite (Sept 2025): Updated efficiency
import { google } from '@ai-sdk/google';
const pro = google('gemini-2.5-pro');
const flash = google('gemini-2.5-flash');
const lite = google('gemini-2.5-flash-lite');

v5 Core Functions (Basics)

generateText() - Text completion with tools streamText() - Real-time streaming generateObject() - Structured output (Zod schemas) streamObject() - Streaming structured data

See official docs for usage: https://ai-sdk.dev/docs/ai-sdk-core


Cloudflare Workers Startup Fix

Problem: AI SDK v5 + Zod causes >270ms startup time (exceeds Workers 400ms limit).

Solution:

// ❌ BAD: Top-level imports cause startup overhead
import { createWorkersAI } from 'workers-ai-provider';
const workersai = createWorkersAI({ binding: env.AI });

// ✅ GOOD: Lazy initialization inside handler
app.post('/chat', async (c) => {
  const { createWorkersAI } = await import('workers-ai-provider');
  const workersai = createWorkersAI({ binding: c.env.AI });
  // ...
});

Additional:

  • Minimize top-level Zod schemas
  • Move complex schemas into route handlers
  • Monitor startup time with Wrangler

v5 Tool Calling Changes

Breaking Changes:

  • parameters → inputSchema (Zod schema)
  • Tool properties: args → input, result → output
  • ToolExecutionError removed (now tool-error content parts)
  • maxSteps parameter removed → Use stopWhen(stepCountIs(n))

New in v5:

  • Dynamic tools (add tools at runtime based on context)
  • Agent class (multi-step execution with tools)

Critical v4→v5 Migration

AI SDK v5 introduced extensive breaking changes. If migrating from v4, follow this guide.

Breaking Changes Overview

  1. Parameter Renames
    • maxTokens → maxOutputTokens
    • providerMetadata → `provi
Полный SKILL.md на GitHub

Установить ai-sdk-core в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

Вложенные файлы

.claude-plugin/plugin.jsonREADME.mdVERIFICATION_REPORT.mdreferences/links-to-official-docs.mdreferences/production-patterns.mdreferences/providers-quickstart.mdreferences/top-errors.mdreferences/v5-breaking-changes.mdscripts/check-versions.shtemplates/agent-with-tools.tstemplates/anthropic-setup.tstemplates/cloudflare-worker-integration.tstemplates/generate-object-zod.tstemplates/generate-text-basic.tstemplates/google-setup.tstemplates/multi-step-execution.tstemplates/nextjs-server-action.tstemplates/openai-setup.tstemplates/package.jsontemplates/stream-object-zod.tstemplates/stream-text-chat.tstemplates/tools-basic.ts

FAQ

Что делает скилл ai-sdk-core?

Build backend AI with Vercel AI SDK v5/v6. Covers v6 beta (Agent abstraction, tool approval, reranking), v4→v5 migration (breaking changes), latest models (GPT-5/5.1, Claude 4.x, Gemini 2.5), Workers startup fix, and 12 error solutions (AI_APICallError, AI_NoObjectGeneratedError, streamText silent errors). Use when: implementing AI SDK v5/v6, migrating v4→v5, troubleshooting errors, fixing Workers startup issues, or updating to latest models.

Как установить скилл ai-sdk-core?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл ai-sdk-core запускает скрипты?

Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.

Похожие скиллы

Сравнить ai-sdk-core с