ASD

Ai Sdk

Responde preguntas sobre la AI SDK y ayuda a construir funciones con IA: agentes, chatbots, RAG, streaming, tool calling, salida estructurada, embeddings y hooks como useChat.

Oficial

Reemplaza a: Implementar bucles de tool-calling manualmente

Estrellas
26.2k

en todo el repo

Actividad
56

0–100, la ruta de este skill

Actualizado
el mes pasado

último commit aquí

Commits
3

últimos 90 días

Contexto
1.4k tok

151 tok en reposo

Paquete
1 archivo

5 KB

Instalar

Funciona con cualquier agente que lea SKILL.md

npx -y skills add vercel/ai --skill use-ai-sdk --agent claude-code

Se instala solo en este repositorio.

Este skill makes network requests.

Qué hace

  • Consulta la documentación embebida en node_modules/ai/docs/ y el código fuente en vez de confiar en memoria entrenada
  • Ayuda a construir agentes, chatbots, RAG y generación de texto usando la AI SDK
  • Configura AI Gateway para acceder a modelos de OpenAI, Anthropic, Google, etc. con una sola API
  • Verifica la versión instalada de ai contra la última disponible y recomienda actualizar si está desactualizada
  • Usa abstracciones como ToolLoopAgent en vez de implementar bucles de tool-calling manualmente

Úsalo cuando

  • El usuario pregunta por funciones de la AI SDK como generateText, streamText, ToolLoopAgent, embed o tools
  • Quiere construir agentes de IA, chatbots, sistemas RAG o funciones de generación de texto
  • Tiene dudas sobre proveedores de IA, streaming, tool calling, salida estructurada o embeddings
  • Usa hooks de React como useChat o useCompletion

No lo uses cuando

    Qué lo activa

    Di cualquiera de estas frases y el agente debería cargar este skill.

    • ¿Cómo uso streamText con la AI SDK?
    • Ayúdame a construir un agente con ToolLoopAgent
    • Quiero añadir un chatbot con useChat a mi app
    • ¿Cómo configuro AI Gateway para usar varios proveedores?

    SKILL.md

    En inglés

    What the AI SDK Is

    The AI SDK by Vercel (the ai package on npm) is a TypeScript toolkit for building AI applications. It provides a unified API across model providers for text generation, structured output, tool calling, agents, embeddings, and framework UI integrations.

    Critical: Do Not Trust Your Own Memory

    Whatever you remember about the AI SDK is likely outdated. The SDK changes frequently across versions - APIs are renamed, removed, and added. Your training data almost certainly contains obsolete APIs, deprecated patterns, and model IDs that no longer exist. UI hooks like useChat are among the most frequently changed APIs, so be especially careful with client code.

    Never write AI SDK code from memory. Always verify every API, option, and pattern against the documentation and source code for the version that is actually installed in the project.

    Use the Bundled, Version-Matched Docs

    The ai package ships its full documentation and source code inside node_modules. These always match the installed version, so trust them over anything you remember.

    1. Ensure ai is installed. If node_modules/ai/ does not exist, install only the ai package using the project's package manager (e.g. pnpm add ai). Install provider packages (e.g. @ai-sdk/openai) and framework packages (e.g. @ai-sdk/react) later, when the task requires them.
    2. Read and grep the bundled docs at node_modules/ai/docs/ and the source at node_modules/ai/src/.
    3. Provider and framework packages bundle their own docs at node_modules/@ai-sdk/<name>/docs/.
    4. If something isn't in the bundled docs, search https://ai-sdk.dev/docs. You can append .md to any docs page URL to get its markdown, and search via https://ai-sdk.dev/api/search-docs?q=your_query.
    5. If you cannot find support for an answer in the docs or source, say so explicitly — do not guess.

    AI Gateway: The Fastest Way to Start

    The Vercel AI Gateway is the fastest way to get started with the AI SDK. It provides access to models from OpenAI, Anthropic, Google, and other providers through a single API, without installing provider packages or managing multiple API keys.

    To set it up:

    1. Authenticate with OIDC (for Vercel deployments) or get an AI Gateway API key.
    2. Provide it to your app via the AI_GATEWAY_API_KEY environment variable.
    3. Reference models with provider/model strings.

    For exact setup, authentication, and usage, read the bundled guide and the AI Gateway docs.

    Choosing a Model

    Never use model IDs from memory — models are released and retired frequently. Fetch the current list before writing code that references a model. Do not truncate the list (e.g. with head) so you can find the newest models:

    # All available models
    curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '.data[].id'
    
    # Filter by provider (e.g. anthropic, openai, google)
    curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]'
    

    When multiple versions of a model exist, prefer the one with the highest version number.

    Building and Consuming Agents

    Use the SDK's built-in agent abstraction (such as ToolLoopAgent) rather than hand-rolling tool-calling loops. For end-to-end type safety, infer the UI message type from your agent definition when consuming it on the client (e.g. with useChat). Consuming an agent is framework-specific: check package.json to detect the stack, then follow the matching quickstart.

    Look up the current agent, tool, and type-safety APIs in the bundled docs (node_modules/ai/docs/, especially the agents section) or at https://ai-sdk.dev/docs.

    DevTools

    AI SDK DevTools captures your AI SDK calls - requests, responses, tool calls, token usage, and multi-step runs - so you can inspect exactly what your agents do. Use it while developing to debug generations. It is a separate package and is intended for local development only.

    For setup instructions, read the bundled DevTools documentation.

    Keep the SDK Current

    Outdated installs are the most common source of errors. Compare the installed version against the latest:

    • Installed: the version field in node_modules/ai/package.json.
    • Latest: run npm view ai version.

    If the installed version is a major version (or more) behind the latest, tell the user they are on an old release, and recommend upgrading before continuing. Migration guides are at https://ai-sdk.dev/docs/migration-guides.

    After Making Changes

    Run the project's type checker. Be minimal — only set options that differ from the defaults, checking docs or source for the defaults rather than over-specifying. Most type errors come from remembered, now-changed APIs; re-check the current docs and source when they occur.

    Reproducido de vercel/ai bajo licencia NOASSERTION. Leer esta página en markdown.

    Archivos

    1 archivo en el paquete. Solo se lee SKILL.md al activarse — las referencias se cargan si el skill decide que las necesita.

    Antes de instalar

    Requiere tener el paquete ai instalado (node_modules/ai/) y, para el Gateway, una variable de entorno AI_GATEWAY_API_KEY o autenticación OIDC.

    Necesita en el PATH:curljq

    Detalles

    Creador
    vercel
    Licencia
    NOASSERTION
    Recursos incluidos
    Solo SKILL.md
    Repositorio
    vercel/ai
    Código fuente
    Ver SKILL.md

    Etiquetas

    Más de vercel/ai

    Este repo incluye 13 skills. Si instalas uno, normalmente ya tienes los demás.

    Actualiza las dependencias SDK principales de los paquetes harness. Úsalo cuando te pidan actualizar los SDKs de harness o sus dependencias adaptadoras.

    Costo de contexto al activarse
    951 tok
    Tamaño del paquete
    1 archivo
    Última actualización
    hace 6 días
    Oficialherramientas desarrollo

    Guía para añadir nuevos paquetes harness de AI SDK. Úsala al crear un paquete @ai-sdk/harness-<name> que adapte un runtime de coding-agent a HarnessV1.

    Costo de contexto al activarse
    3.1k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    Oficialherramientas desarrollo

    Guía para añadir nuevos paquetes de proveedores de IA al AI SDK. Úsala al crear un paquete @ai-sdk/<provider> para integrar un servicio de IA en el SDK.

    Costo de contexto al activarse
    2.7k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    Oficialherramientas desarrollo

    Añade nuevos IDs de modelo o elimina IDs obsoletos en los proveedores existentes del AI SDK, incluyendo tipos, docs, ejemplos y tests.

    Costo de contexto al activarse
    2.4k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    Oficialherramientas desarrollo

    Migra aplicaciones de AI SDK 6.x a AI SDK 7.0; útil al actualizar paquetes de Vercel AI SDK o corregir errores de migración a v7.

    Costo de contexto al activarse
    2.1k tok
    Tamaño del paquete
    1 archivo
    Última actualización
    el mes pasado
    Oficialherramientas desarrollo

    Crea y mantiene Architecture Decision Records (ADR) optimizados para agentes de código: propone, redacta, actualiza, acepta/rechaza, deprecia o supersede ADRs usando preguntas socráticas y una checklist de validación.

    Costo de contexto al activarse
    4.1k tok
    Tamaño del paquete
    11 archivos
    Última actualización
    hace 3 meses
    Oficialdocumentos

    Skills relacionados

    Integra el procesamiento de pagos de PayPal, con soporte para express checkout, suscripciones y gestión de reembolsos en flujos de comercio electrónico.

    Costo de contexto al activarse
    1k tok
    Tamaño del paquete
    2 archivos
    Última actualización
    hace 2 meses
    desarrollo apis

    Construye sistemas RAG (Retrieval-Augmented Generation) para aplicaciones LLM con bases de datos vectoriales y búsqueda semántica, integrando conocimiento externo.

    Costo de contexto al activarse
    1.1k tok
    Tamaño del paquete
    2 archivos
    Última actualización
    el mes pasado
    desarrollo apis

    Construye servicios backend de Node.js listos para producción con Express/Fastify, cubriendo middleware, manejo de errores, autenticación, bases de datos y diseño de APIs.

    Costo de contexto al activarse
    499 tok
    Tamaño del paquete
    3 archivos
    Última actualización
    hace 2 meses
    desarrollo apis