Skip to main content

AI SDK by Vercel

还没翻译译自英文(ai-sdk.dev)本页 32 段都还没译

The AI SDK is the TypeScript toolkit designed to help developers build AI-powered applications and agents with React, Next.js, Vue, Svelte, Node.js, and more.

Why use the AI SDK?

Integrating large language models (LLMs) into applications is complicated and heavily dependent on the specific model provider you use.

The AI SDK standardizes integrating artificial intelligence (AI) models across supported providers. This enables developers to focus on building great AI applications, not waste time on technical details.

The AI SDK also includes a harness abstraction for using established agent harnesses such as Claude Code, Codex, and Pi through HarnessAgent. Harnesses are decoupled from model providers, but use compatible stream and response primitives so AI SDK UI and agent surfaces can consume them in the same way.

For example, here’s how you can generate text with various models using the AI SDK:

This part of the page is interactive; see it on the original page.

The AI SDK has these primary surfaces:

  • AI SDK Core: A unified API for generating text, structured objects, tool calls, and building agents with LLMs.
  • AI SDK UI: A set of framework-agnostic hooks for quickly building chat and generative user interfaces.
  • AI SDK Harnesses: A uniform API for running established agent harnesses with HarnessAgent.

Model Providers

The AI SDK supports multiple model providers.

This part of the page is interactive; see it on the original page.

Templates

We've built some templates that include AI SDK integrations for different use cases, providers, and frameworks. You can use these templates to get started with your AI-powered application.

Starter Kits

This part of the page is interactive; see it on the original page.

Feature Exploration

This part of the page is interactive; see it on the original page.

Frameworks

This part of the page is interactive; see it on the original page.

Generative UI

This part of the page is interactive; see it on the original page.

Security

This part of the page is interactive; see it on the original page.

Join our Community

If you have questions about anything related to the AI SDK, you're always welcome to ask our community on the Vercel Community.

llms.txt (for Cursor, Windsurf, Copilot, Claude etc.)

You can access the entire AI SDK documentation in Markdown format at ai-sdk.dev/llms.txt. This can be used to ask any LLM (assuming it has a big enough context window) questions about the AI SDK based on the most up-to-date documentation.

Example Usage

For instance, to prompt an LLM with questions about the AI SDK:

  1. Copy the documentation contents from ai-sdk.dev/llms.txt
  2. Use the following prompt format:
Documentation:
{paste documentation here}
---
Based on the above documentation, answer the following:
{your question}