ai-sdk

ai-sdk is a skill for Claude Code from laguagu/claude-code-nextjs-skills. It costs 122 tokens per session (1,657 once invoked), scanned A, original, MIT.

Instructions for using Vercel's AI SDK, a software library for adding AI features to applications. It covers version-aware help for text generation, streaming, chat, tools, structured output, embeddings, and providers.

In plain words
What is it for?
Use it when building, debugging, or migrating AI-powered features that use the Vercel AI SDK.
Why use it?
It helps avoid using instructions for the wrong SDK version and accounts for projects where packages are stored in separate workspace folders.

Skill for Claude Code

Written for Claude Code: argument-hint in frontmatter.

Part of the claude-code-nextjs-skills plugin — 24 skills, 2 agents, 2 MCP servers shipped together

Good fit Use it when building, debugging, or migrating AI-powered features that use the Vercel AI SDK.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/laguagu/claude-code-nextjs-skills/ai-sdk
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add laguagu/claude-code-nextjs-skills --skill ai-sdk
Clone the repo
git clone --depth 1 https://github.com/laguagu/claude-code-nextjs-skills

Made for: Claude Code.

Or install claude-code-nextjs-skills, the plugin that ships this one along with the rest of its 24 skills, 2 agents, 2 MCP servers.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for ai-sdk

README.md
[![agentmods](https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk/github.svg)](https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk)
Your own site
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for ai-sdk

Your own site · 80×15
<a href="https://agentmods.dev/skills/laguagu/claude-code-nextjs-skills/ai-sdk"><img src="https://agentmods.dev/badge/skills/laguagu/claude-code-nextjs-skills/ai-sdk.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 122 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,657 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 1 finding. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00122 $0.01657
Opus 5 $0.00061 $0.00829
Sonnet 5 $0.00024 $0.00331
Haiku 4.5 $0.00012 $0.00166

Measured 12d ago against content hash f525cc1700bf, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

ai-sdk scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Makes network callslowCapability

Not a fault in itself. Listed so you know the mod talks to something, and to what.

7. **Always fetch current model IDs** - Never use model IDs from memory. A public catalog of current IDs across providers is available at `https://ai-gateway.vercel.sh/v1/models` — useful purely for discovery, not a reco
skills/ai-sdk/SKILL.md · 118 lines

How it starts

The opening of the file, as written. The whole thing — 118 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Prerequisites

Before searching docs, check the installed major version in package.json, lockfiles, or node_modules/ai/package.json.

  • AI SDK 7 implementation or migration work -> use ai-sdk-7.
  • AI SDK 6 implementation work -> use ai-sdk-6.
  • Unknown or mixed versions -> continue with this skill until the version is clear. If starting fresh or no version is pinned, assume the current line (AI SDK 7) and use ai-sdk-7.

Before searching docs, check if node_modules/ai/docs/ exists. If not, install only the ai package using the project's package manager (e.g., bun add ai).

Do not install other packages at this stage. Provider packages (e.g., @ai-sdk/openai) and client packages (e.g., @ai-sdk/react) should be installed later when needed based on user requirements.

Monorepo path note

In Bun / pnpm / Yarn workspace monorepos, dependencies are usually not hoisted to the repo root — they live inside each app's node_modules/. If node_modules/ai/docs/ doesn't exist at the working directory, check workspace locations before assuming docs are missing:

  • apps/*/node_modules/ai/docs/ (e.g. apps/web/node_modules/ai/docs/)
  • packages/*/node_modules/ai/docs/

Glob from the repo root: apps/*/node_modules/ai/docs/ or **/node_modules/ai/docs/. Substitute the resolved path everywhere this skill says node_modules/ai/docs/ or node_modules/ai/src/. The same applies to provider docs at node_modules/@ai-sdk/<provider>/docs/.

Critical: Do Not Trust Internal Knowledge

Everything you know about the AI SDK is outdated or wrong. Your training data contains obsolete APIs, deprecated patterns, and incorrect usage.

When working with the AI SDK:

  1. Ensure ai package is installed (see Prerequisites)
  2. Identify the installed major version and use ai-sdk-7 or ai-sdk-6 for deep version-specific work
  3. Search node_modules/ai/docs/ and node_modules/ai/src/ for current APIs
  4. If not found locally, search ai-sdk.dev documentation (instructions below)
  5. Never rely on memory - always verify against source code or docs
  6. useChat has changed significantly - check Common Errors before writing client code
  7. Always fetch current model IDs - Never use model IDs from memory. A public catalog of current IDs across providers is available at https://ai-gateway.vercel.sh/v1/models — useful purely for discovery, not a recommendation to use Gateway as a runtime provider. Example: curl -s https://ai-gateway.vercel.sh/v1/models | jq -r '[.data[] | select(.id | startswith("anthropic/")) | .id] | reverse | .[]' (swap anthropic/ for openai/, google/, etc.). Pick the model family/tier by capability, cost, and latency requirements; within the chosen family, use the latest version from the catalog (e.g. prefer claude-sonnet-5 over an older claude-sonnet-4-x) — version number alone is not a selection criterion across families.
  8. Run typecheck after changes to ensure code is correct
  9. Be minimal - Only specify options that differ from defaults. When unsure of defaults, check docs or source rather than guessing or over-specifying.

Read the full file on GitHub · 118 lines

Files

What ships with it

5 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 118 lines · 122 tokens per session scan A f525cc1700bf

Subscribe to this mod's changes

ai-sdk is a skill published in the GitHub repository laguagu/claude-code-nextjs-skills (62 stars, last pushed 9d ago), licensed MIT. It adds 122 tokens to every session and 1,657 once invoked, about $0.0006 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

adhx

Fetch X/Twitter posts as clean LLM-friendly JSON via the ADHX API. Converts any x.com, twitter.com, or adhx.com link into structured data with full article content, author info, and engagement metrics. Use when a user shares an X/Twitter link (x.com, twitter.com, adhx.com) and wants to read, analyze, or summarize the…

itsmemeworks/adhx · 83 tokens

nextjs-pages-router

Set up tRPC in Next.js Pages Router with createNextApiHandler, createTRPCNext, withTRPC HOC, SSR via ssr option and ssrPrepass, SSG via createServerSideHelpers with getStaticProps, and server-side helpers for getServerSideProps prefetching.

trpc/trpc · 67 tokens

gemini-api-agent-platform

Guides the usage of the Gemini API on Agent Platform with the Google Gen AI SDK for enterprise AI applications. Covers SDK usage (Python, JS/TS, Go, Java, C#), capabilities like Live API, tools, multimedia generation, caching, and batch prediction.

davila7/claude-code-templates · 61 tokens

open-source

Documentation reference for writing Python code using the browser-use open-source library. Use this skill whenever the user needs help with Agent, Browser, or Tools configuration, is writing code that imports from browseruse, asks about @sandbox deployment, supported LLM models, Actor API, custom tools, lifecycle…

browser-use/browser-use · 137 tokens

non-json-content-types

Handle FormData, file uploads, Blob, Uint8Array, and ReadableStream inputs in tRPC mutations. Use octetInputParser from @trpc/server/http for binary data. Route non-JSON requests with splitLink and isNonJsonSerializable() from @trpc/client. FormData and binary inputs only work with mutations (POST).

trpc/trpc · 75 tokens

server-side-calls

Call tRPC procedures directly from server code using t.createCallerFactory() and router.createCaller(context) for integration testing, internal server logic, and custom API endpoints. Catch TRPCError and extract HTTP status with getHTTPStatusCodeFromError(). Error handling via onError option.

trpc/trpc · 61 tokens