{
 "kind": "tool",
 "slug": "ai",
 "path": "tools/ai/",
 "name": "AI SDK",
 "maker": null,
 "density": "profile",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Model SDKs",
   "tools/ai-sdks/"
  ]
 ],
 "lead": "Vercel's unified SDK for building AI apps with OpenAI, Anthropic, Google and more.",
 "chips": [
  {
   "label": "Model SDKs",
   "path": "tools/ai-sdks/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install ai"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/vercel/ai"
  },
  {
   "label": "Website",
   "href": "https://ai-sdk.dev/docs"
  },
  {
   "label": "Its AgentGid profile",
   "path": "agents/vercel-ai-sdk/"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "Apache-2.0",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": null,
   "note": "License from npm.",
   "src": "https://github.com/vercel/ai"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 24, 2026",
   "note": "Latest GitHub release Nov 23, 2026. ",
   "src": "https://github.com/vercel/ai"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "280 projects",
   "status": "info",
   "sub": "#2 of 92 in its category",
   "note": "Dependency in 280 public GitHub projects set up for AI coding agents that we scanned (4.5%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Docs for agents",
   "status": "yes",
   "sub": "llms.txt",
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": "https://ai-sdk.dev/llms.txt"
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What AI SDK does",
   "parts": [
    {
     "t": "prose",
     "text": "AI SDK puts one TypeScript call, <code>generateText</code>, in front of many model providers, and by default it routes a plain model string like <code>'openai/gpt-6-astra'</code> through Vercel's AI Gateway instead of asking you to wire up each provider."
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "AI SDK popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "86",
       "of": "/ 100",
       "l": "Gid Score, #34 overall"
      },
      {
       "n": "48.5M",
       "l": "downloads a week, npm"
      },
      {
       "n": "28.2K",
       "l": "GitHub stars"
      },
      {
       "n": "280",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How AI SDK is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "AI SDK is a dependency in 280 of the 6,258 public GitHub projects set up for AI coding agents that we scanned (5.8% of the 4,867 JavaScript/TypeScript ones), #2 of 92 in model sdks.",
      "Counting the projects our scan samples by dependency (Solana 3,067, Ethereum and EVM 1,774, 3D and games 3,130, agent frameworks and SDKs 13,750), it appears in 1,554; those are left out of every share on this page.",
      "The most used alternative in our scan is OpenAI (286 projects).",
      "Projects that use it most often also use Zod (83.6%), Tailwind Merge (56.1%), Class Variance Authority (52.5%).",
      "It is more common in projects set up for Kiro (9.3%) than for GitHub Copilot (4.2%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "157 projects, 4.8%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "145 projects, 5.9%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "127 projects, 4.2%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "32 projects, 6.8%",
       "v": "Gemini CLI",
       "path": "agents/gemini-cli/"
      },
      {
       "l": "25 projects, 7.3%",
       "v": "OpenCode",
       "path": "agents/opencode/"
      },
      {
       "l": "25 projects, 5.3%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      },
      {
       "l": "17 projects, 6.1%",
       "v": "Devin Desktop",
       "path": "agents/devin-desktop/"
      },
      {
       "l": "13 projects, 9.3%",
       "v": "Kiro",
       "path": "agents/kiro/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 83.6% of its projects",
       "v": "Zod",
       "path": "tools/zod/"
      },
      {
       "l": "In 56.1% of its projects",
       "v": "Tailwind Merge",
       "path": "tools/tailwind-merge/"
      },
      {
       "l": "In 52.5% of its projects",
       "v": "Class Variance Authority",
       "path": "tools/class-variance-authority/"
      },
      {
       "l": "In 56.4% of its projects",
       "v": "clsx",
       "path": "tools/clsx/"
      },
      {
       "l": "In 57.1% of its projects",
       "v": "Lucide React",
       "path": "tools/lucide-react/"
      },
      {
       "l": "In 70.4% of its projects",
       "v": "React",
       "path": "tools/react/"
      },
      {
       "l": "In 91.1% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      },
      {
       "l": "In 52.5% of its projects",
       "v": "Next.js",
       "path": "tools/next/"
      }
     ]
    }
   ]
  },
  {
   "id": "profile",
   "nav": "Profile",
   "h2": "AI SDK in practice",
   "parts": [
    {
     "t": "h3",
     "text": "Strengths"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "A model string is enough to start",
       "v": "Out of the box, the SDK sends requests through the Vercel AI Gateway. A string like <code>'anthropic/claude-opus-5.5'</code> picks the provider and model, with no provider package to install first."
      },
      {
       "l": "Direct provider packages when you want them",
       "v": "You can skip the gateway. Install <code>@ai-sdk/openai</code>, <code>@ai-sdk/anthropic</code> or <code>@ai-sdk/google</code> and pass <code>anthropic('claude-opus-5-5')</code> to the same <code>generateText</code> call."
      },
      {
       "l": "Structured output from a Zod schema",
       "v": "<code>generateText</code> takes an <code>output: Output.object({ schema })</code> option with a Zod schema and returns a typed <code>output</code>. The README demonstrates it with a recipe object."
      },
      {
       "l": "Tool calls arrive in the UI with a state",
       "v": "In the README's agent example, each tool invocation reaches the React component with a <code>state</code>. You can show a placeholder at <code>input-available</code> and the result at <code>output-available</code>."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Watch out for"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "Needs Node.js 22 or newer",
       "v": "The README sets Node.js 22+ as the requirement for local development."
      },
      {
       "l": "The default path runs through Vercel",
       "v": "The README's basic examples pass a bare model string, and its own code comment notes this goes through Vercel AI Gateway. To call a provider directly, you have to install that provider's package."
      },
      {
       "l": "Older tutorials show a different API",
       "v": "A 2025 post imports <code>useChat</code> from <code>ai/react</code> and uses <code>handleInputChange</code>. The current README imports it from <code>@ai-sdk/react</code> and calls <code>sendMessage</code>. Check the date on any example before copying it."
      }
     ]
    },
    {
     "t": "h3",
     "text": "Generate a typed object with a Zod schema"
    },
    {
     "t": "tabs",
     "label": "Example",
     "items": [
      {
       "tab": "Ts",
       "code": "import { generateText, Output } from 'ai';\nimport { z } from 'zod';\n\nconst { output } = await generateText({\n  model: 'openai/gpt-6-astra',\n  output: Output.object({\n    schema: z.object({\n      recipe: z.object({\n        name: z.string(),\n        ingredients: z.array(\n          z.object({ name: z.string(), amount: z.string() }),\n        ),\n        steps: z.array(z.string()),\n      }),\n    }),\n  }),\n  prompt: 'Generate a lasagna recipe.',\n});"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "profile",
   "h2": "More about AI SDK",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "Agent Skills for it",
       "path": "skills/",
       "items": [
        "ai-sdk: Answer questions about the AI SDK and help build AI-powered features. Use when developers: (1) Ask about AI SDK functions like generateText,"
       ]
      },
      {
       "title": "Packages around it",
       "items": [
        "@ai-sdk/openai: OpenAI provider",
        "@ai-sdk/react: React hooks (useChat)",
        "@ai-sdk/google: Google provider",
        "@ai-sdk/anthropic: Anthropic provider",
        "@ai-sdk/openai-compatible: OpenAI-compatible provider",
        "@ai-sdk/groq: Groq provider"
       ]
      },
      {
       "title": "More in Model SDKs",
       "path": "tools/ai-sdks/",
       "items": [
        {
         "text": "OpenAI Python Library",
         "path": "tools/openai-pypi/"
        },
        {
         "text": "Anthropic Python SDK",
         "path": "tools/anthropic/"
        },
        {
         "text": "Google GenAI Python SDK",
         "path": "tools/google-genai-pypi/"
        },
        {
         "text": "Hugging Face Hub",
         "path": "tools/huggingface-hub/"
        },
        {
         "text": "LiteLLM",
         "path": "tools/litellm/"
        },
        {
         "text": "Ollama",
         "path": "tools/ollama-pypi/"
        },
        {
         "text": "Transformers.js",
         "path": "tools/huggingface/"
        },
        {
         "text": "Pi-AI",
         "path": "tools/mariozechner-pi-ai/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "AI SDK",
       "me": true,
       "facts": [
        "Apache-2.0",
        "Gid 86",
        "48.5M/wk"
       ]
      },
      {
       "name": "OpenAI",
       "why": "Official TypeScript SDK for accessing OpenAI APIs including GPT and embeddings.",
       "path": "tools/openai-npm/",
       "facts": [
        "Apache-2.0",
        "Gid 81",
        "62.5M/wk"
       ]
      },
      {
       "name": "Anthropic SDK",
       "why": "Official TypeScript SDK for calling Claude API and building agent applications.",
       "path": "tools/anthropic-ai/",
       "facts": [
        "Apache-2.0",
        "Gid 74",
        "75M/wk"
       ]
      },
      {
       "name": "Google Generative AI",
       "why": "Official SDK for Google Gemini API to build AI-powered applications.",
       "path": "tools/google-genai-npm/",
       "facts": [
        "Apache-2.0",
        "Gid 69",
        "34.2M/wk"
       ]
      },
      {
       "name": "Ollama JavaScript Library",
       "why": "Official JavaScript client library for Ollama to run and interact with local language models.",
       "path": "tools/ollama-npm/",
       "facts": [
        "MIT",
        "Gid 57",
        "1.3M/wk"
       ]
      },
      {
       "name": "Groq SDK",
       "why": "Official TypeScript SDK for calling Groq's fast language models API.",
       "path": "tools/groq-sdk/",
       "facts": [
        "Apache-2.0",
        "Gid 47",
        "1.2M/wk"
       ]
      },
      {
       "name": "Replicate",
       "why": "JavaScript client library for calling Replicate's AI model API.",
       "path": "tools/replicate-npm/",
       "facts": [
        "Apache-2.0",
        "Gid 41",
        "713K/wk"
       ]
      }
     ],
     "more": "Compare AI SDK with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "install",
     "intro": "Install it.",
     "code": "npm install ai"
    },
    {
     "t": "h3",
     "text": "Rules for your agent"
    },
    {
     "t": "rules",
     "label": "Paste into AGENTS.md or CLAUDE.md",
     "text": "## AI SDK\n- Install the core package with `npm install ai`, and check that the project runs on Node.js 22+.\n- A bare model string such as `'openai/gpt-6-astra'` goes through the Vercel AI Gateway. To call a provider directly, install its package (`@ai-sdk/openai`, `@ai-sdk/anthropic`, `@ai-sdk/google`) and pass e.g. `anthropic('claude-opus-5-5')`.\n- For structured data, use `generateText` with `output: Output.object({ schema })` and a Zod schema, then read `output`.\n- For chat UIs, install the framework package (e.g. `@ai-sdk/react`), use `useChat`, call `sendMessage({ text })`, and render `message.parts` by `part.type`.\n- Render tool parts by `invocation.state`: handle `'input-available'` and `'output-available'`.\n- In Next.js routes that stream agent output, return `createAgentUIStreamResponse({ agent, messages })`. The RSC examples also set `export const maxDuration = 30` to allow streaming up to 30 seconds.\n- If the repo uses Claude Code or Cursor, add the official skill with `npx skills add vercel/ai`.\n"
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm ai"
  ],
  [
   "Category",
   "Model SDKs"
  ],
  [
   "License",
   "Apache-2.0"
  ],
  [
   "Latest version",
   "@ai-sdk/vue@3.0.303, October 9, 2026"
  ],
  [
   "On GitHub since",
   "May 2023"
  ],
  [
   "Gid Score",
   "85.9"
  ],
  [
   "Rank in category",
   "#2 of 92"
  ],
  [
   "GitHub",
   "vercel/ai"
  ],
  [
   "Last change",
   "Nov 24, 2026"
  ]
 ],
 "good": [
  "Used by Elementor, OpenCode, as listed by the source; we have not checked each one."
 ],
 "checked_line": "From the package registry, GitHub and our scan of public agent projects; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/vercel.png"
}