📁 ai-sdk/docs/reference/ai-sdk-core

File: ai-sdk-core.md | Updated: 11/15/2025

Source: https://ai-sdk.dev/docs/reference/ai-sdk-core

AI SDK

Menu

v5 (Latest)

AI SDK 5.x

AI SDK by Vercel

AI SDK 6 Beta

Foundations

Overview

Providers and Models

Prompts

Tools

Streaming

Getting Started

Navigating the Library

Next.js App Router

Next.js Pages Router

Svelte

Vue.js (Nuxt)

Node.js

Expo

Agents

Agents

Building Agents

Workflow Patterns

Loop Control

AI SDK Core

Overview

Generating Text

Generating Structured Data

Tool Calling

Model Context Protocol (MCP) Tools

Prompt Engineering

Settings

Embeddings

Image Generation

Transcription

Speech

Language Model Middleware

Provider & Model Management

Error Handling

Testing

Telemetry

AI SDK UI

Overview

Chatbot

Chatbot Message Persistence

Chatbot Resume Streams

Chatbot Tool Usage

Generative User Interfaces

Completion

Object Generation

Streaming Custom Data

Error Handling

Transport

Reading UIMessage Streams

Message Metadata

Stream Protocols

AI SDK RSC

Advanced

Reference

AI SDK Core

generateText

streamText

generateObject

streamObject

embed

embedMany

generateImage

transcribe

generateSpeech

tool

dynamicTool

experimental_createMCPClient

Experimental_StdioMCPTransport

jsonSchema

zodSchema

valibotSchema

ModelMessage

UIMessage

validateUIMessages

safeValidateUIMessages

createProviderRegistry

customProvider

cosineSimilarity

wrapLanguageModel

LanguageModelV2Middleware

extractReasoningMiddleware

simulateStreamingMiddleware

defaultSettingsMiddleware

stepCountIs

hasToolCall

simulateReadableStream

smoothStream

generateId

createIdGenerator

AI SDK UI

AI SDK RSC

Stream Helpers

AI SDK Errors

Migration Guides

Troubleshooting

Copy markdown

AI SDK Core

=========================================================================

AI SDK Core is a set of functions that allow you to interact with language models and other AI models. These functions are designed to be easy-to-use and flexible, allowing you to generate text, structured data, and embeddings from language models and other AI models.

AI SDK Core contains the following main functions:

generateText()

Generate text and call tools from a language model.
streamText()

Stream text and call tools from a language model.
generateObject()

Generate structured data from a language model.
streamObject()

Stream structured data from a language model.
embed()

Generate an embedding for a single value using an embedding model.
embedMany()

Generate embeddings for several values using an embedding model (batch embedding).
experimental_generateImage()

Generate images based on a given prompt using an image model.
experimental_transcribe()

Generate a transcript from an audio file.
experimental_generateSpeech()

Generate speech audio from text.

It also contains the following helper functions:

tool()

Type inference helper function for tools.
experimental_createMCPClient()

Creates a client for connecting to MCP servers.
jsonSchema()

Creates AI SDK compatible JSON schema objects.
zodSchema()

Creates AI SDK compatible Zod schema objects.
createProviderRegistry()

Creates a registry for using models from multiple providers.
cosineSimilarity()

Calculates the cosine similarity between two vectors, e.g. embeddings.
simulateReadableStream()

Creates a ReadableStream that emits values with configurable delays.
wrapLanguageModel()

Wraps a language model with middleware.
extractReasoningMiddleware()

Extracts reasoning from the generated text and exposes it as a `reasoning` property on the result.
simulateStreamingMiddleware()

Simulates streaming behavior with responses from non-streaming language models.
defaultSettingsMiddleware()

Applies default settings to a language model.
smoothStream()

Smooths text streaming output.
generateId()

Helper function for generating unique IDs
createIdGenerator()

Creates an ID generator

On this page

AI SDK Core

Deploy and Scale AI Apps with Vercel.

Vercel delivers the infrastructure and developer experience you need to ship reliable AI-powered applications at scale.

Trusted by industry leaders:

  • OpenAI
  • Photoroom
  • leonardo-ai Logoleonardo-ai Logo
  • zapier Logozapier Logo

Talk to an expert