Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

API reference

AI Tools API reference

modern AI developer tools and the Vercel AI SDK

Identifiers
113
With full guides
71
Types
5

Topics covered

  • Vercel AI SDK basics
  • Streaming UI with useChat
  • Structured output with Zod
  • Tool calling
  • Multi-step agents
  • Provider routing
  • Caching AI responses
  • Generative UI

Class

NameWhat it does
Experimental_AgentExperimental_Agent is a reusable AI SDK class that combines a model, instructions, tools, and loop control. It can generate text, stream output, or produce an API response while managing agent steps.
ChatOpenAIClass
PromptTemplateClass
LLMChainClass
ConversationChainClass
RetrievalQAClass
ChatPromptTemplateClass
RecursiveCharacterTextSplitterClass
RunnableSequenceClass
RunnablePassthroughClass
AgentExecutorClass
StateGraphClass
VectorStoreIndexVectorStoreIndex creates a searchable vector index from documents. It chunks documents, embeds the chunks with an embedding model, and stores the embeddings in a vector database.
QueryEngineClass
SimpleDirectoryReaderClass

Function

NameWhat it does
generateTextgenerateText produces text from a prompt with a language model and can call tools during execution. It is suited to non-interactive tasks such as automation, drafting, summarization, and tool-using agents.
streamTextstreamText streams text generated by a language model, making it suitable for chatbots and other real-time applications. It can also work with tools to support streamed UI generation.
generateObjectgenerateObject creates structured, typed data from a prompt and schema with a language model. It supports several output strategies and validates schema-based results.
streamObjectstreamObject streams typed, structured data from a language model using a prompt and schema. It supports object, array, enum, and no-schema output strategies.
embedGenerates an embedding for one value with an embedding model. The returned object includes the original value and its numeric embedding vector.
tooltool() is a TypeScript helper for defining AI SDK tools with inferred input and context types. It connects schemas to execution and lifecycle callbacks without adding runtime behavior.
createOpenAIcreateOpenAI creates a customized OpenAI provider for the AI SDK. Configure credentials, endpoint, headers, or transport, then use the provider to create OpenAI models.
embedManyEmbeds multiple values with an embedding model. Large requests are automatically split into smaller chunks when the model imposes embedding-count or UTF-8 input-byte limits.
useObjectuseObject consumes a streamed JSON response and parses it into a structured object according to a supplied schema. It is intended for AI SDK UI applications that progressively render generated structured data.
convertToCoreMessagesConverts useChat UI messages into CoreMessage objects suitable for AI Core functions such as streamText. The documentation warns that current SDK versions perform this conversion automatically.
createAnthropiccreateAnthropic creates a customized Anthropic provider for the Vercel AI SDK. Configure the provider, then call it with a Claude model identifier to obtain a language model.
createGoogleGenerativeAICreates a customized Google Generative AI provider for the Vercel AI SDK. Use the returned provider to create Google language or embedding models with provider-specific settings.
wrapLanguageModelwrapLanguageModel enhances a LanguageModelV4 by applying one or more middleware layers. It returns a new model instance and can optionally override the model and provider identifiers.
customProviderCreates a custom AI SDK provider that maps application-specific IDs to models from another provider. It can also fall back to another provider for missing models or capabilities.
createProviderRegistryCreates a registry for multiple providers and models. Registered models are retrieved with provider-qualified IDs such as providerId:modelId.
stepCountIsCreates a stop condition that ends a tool-calling loop when it reaches a specified number of steps. Use it with stopWhen in generateText or streamText.
smoothStreamsmoothStream smooths text and reasoning output from streamText by buffering content into configurable chunks and releasing them with optional delays. It returns a TransformStream for streamText's experimental_transform option.
streamUIFunction
createStreamableUICreates a server-to-client stream for React UI. The client can render its value as a normal React node while the server updates, appends, finalizes, or fails the stream.
createStreamableValueCreates a server-to-client stream for any serializable value. Control it with update, appendValue, done, and error, then consume the resulting value with the corresponding RSC reading APIs.
createReactAgentFunction
experimental_generateImageexperimental_generateImage creates images from a text prompt through a selected image model. Optional arguments can request multiple outputs and a specific size.
experimental_transcribeexperimental_transcribe generates a transcript from an audio file using a transcription model. It accepts audio data or a URL and returns the completed transcript as text.
experimental_generateSpeechGenerates speech audio from text with a selected speech model. Configure voice, format, language, provider-specific options, retries, and cancellation as needed.
createMistralcreateMistral creates a configurable Mistral provider for the AI SDK. Configure the provider, then call it with a Mistral model identifier to obtain a model.
createGroqCreates a customized Groq provider for the Vercel AI SDK. Configure credentials and the API endpoint, then call the provider with a Groq model identifier.
createCoherecreateCohere creates a customized Cohere provider instance from optional settings such as an API key, base URL, headers, and fetch implementation. Use the provider to create models for Cohere's chat API.
createDeepSeekcreateDeepSeek creates a configurable DeepSeek provider for the AI SDK. Configure credentials, endpoint, headers, or request handling, then select a DeepSeek model from the returned provider.
createXaicreateXai creates a customized xAI provider from @ai-sdk/xai. Configure its URL, authentication, headers, or fetch implementation, then use the returned provider to select xAI models.
createFireworkscreateFireworks builds a customized Fireworks provider for the AI SDK. Configure credentials, endpoint routing, headers, or request handling, then use the returned provider to create Fireworks models.
createTogetherAIcreateTogetherAI creates a customized Together.ai provider for the AI SDK. Configure its optional API key or API URL, then use the returned provider with Together.ai model identifiers.
createReplicatecreateReplicate creates a customized Replicate provider instance from @ai-sdk/replicate. Configure its API token, request URL, headers, or fetch implementation before selecting Replicate models.
createAmazonBedrockCreates a customized Amazon Bedrock provider for the AI SDK. Configure AWS settings such as the region and credential provider, then use the returned provider to select Bedrock models.
createAzurecreateAzure creates a customized Azure OpenAI provider from settings such as an Azure resource name and API key. The provider can also use a complete Foundry OpenAI v1 base URL or Microsoft Entra ID token authentication.
createVertexcreateVertex creates a customized Google Vertex provider from optional settings such as a Google Cloud project and location. Use the returned provider to select Vertex models for AI SDK operations.
jsonSchemaCreates an AI SDK-compatible JSON schema from a JSON Schema definition, with optional custom validation. Use it for structured-data generation and tool inputs when dynamic schemas or non-Zod validation are needed.
zodSchemazodSchema converts a Zod schema into an AI SDK-compatible schema. It is useful for structured data generation and tools, especially when conversion options such as references must be configured.
cosineSimilarityCalculates the cosine similarity between two numeric vectors. Its signed result ranges from -1 to 1, with values near 1 indicating greater similarity.
simulateReadableStreamCreates a ReadableStream that emits supplied values in order with optional initial and inter-chunk delays. It is mainly useful for testing streaming behavior or reproducing time-delayed responses.
extractReasoningMiddlewareExtracts delimited reasoning from generated model output and exposes it separately from the main text. It supports XML-style tags and custom literal delimiters.

Hook

NameWhat it does
useChatuseChat is a React hook for building conversational interfaces. It streams provider responses, maintains chat state, and updates the UI as messages arrive.
useCompletionuseCompletion is a React hook for text-completion interfaces. It streams provider output, manages completion state, and exposes complete for starting generation.
useAssistantHook

Type Alias

NameWhat it does
CoreMessageCoreMessage is the union used to describe system, user, assistant, and tool messages for AI SDK Core functions. Its role determines the allowed content structure, including multimodal user content and tool results.
UIMessageUIMessage is the AI SDK’s complete, UI-facing representation of a message and its application state. It carries identity, role, optional metadata, and typed parts for rendering text, data, and tool interactions.
LanguageModelV2Type Alias
ToolCallPartToolCallPart is the AI SDK content-part shape for a model-generated tool invocation. It identifies the call, names the target tool, and stores schema-shaped arguments.
ToolResultPartToolResultPart represents one completed tool call within a tool message. It links the result to the call and tool, stores JSON-serializable output, and optionally carries provider-specific metadata.
StreamDataType Alias
ModelMessageModelMessage is the AI SDK Core type for conversation messages sent to models. It unifies system, user, assistant, and tool messages, including multimodal content and tool interactions.
ToolSetToolSet is the AI SDK type for a named collection of tools available to model-generation functions. It enables typed tool calls and results across streamText and generateText.

Const

NameWhat it does
PineconeConst
WeaviateConst
QdrantConst
ChromaConst
MilvusConst
pgvectorThe RAG workflow uses pgvector with Postgres to store embeddings alongside chunked source content. Vector distance then supports similarity-based retrieval for AI applications.
FAISSConst
Hugging Face TransformersHugging Face Transformers is represented in the Vercel AI SDK by the Hugging Face provider. Use its provider instance to create language models for text generation and streaming.
OllamaOllama is available to the AI SDK through community providers. Install one, import its provider, and create a model by passing an Ollama model name.
OpenAI APIConst
Anthropic APIAnthropic is the AI SDK provider for Anthropic Messages API models. Import anthropic from @ai-sdk/anthropic, select a model by ID, and pass it to AI SDK generation functions.
Google Gemini APIThe Google provider lets AI SDK applications call Google Gemini models through @ai-sdk/google. Use google(modelId) to create a model for AI SDK generation functions, with authentication supplied by the documented environment variable.
Mistralmistral is the default Mistral provider from @ai-sdk/mistral. Call it with a model ID to create a model for AI SDK text generation and streaming.
CohereThe Cohere provider integrates Cohere language and embedding models with the AI SDK through @ai-sdk/cohere. Use the default cohere instance for standard setup or createCohere for customization.
Replicatereplicate is the default Replicate provider from @ai-sdk/replicate. Use replicate.image(modelId) to create an image model for AI SDK generation functions.
Together AItogetherai is the default Together.ai provider exported by @ai-sdk/togetherai. Call it with a Together.ai model ID to create a model for use with AI SDK generation APIs.
Groqgroq is the default Groq provider instance exported by @ai-sdk/groq. Use it with a model identifier to create a language model for AI SDK operations.
LiteLLMConst
InstructorConst
DSPyConst
GuidanceConst
OutlinesConst
vLLMConst
LangChainThe @ai-sdk/langchain adapter connects LangChain and LangGraph with the AI SDK. It converts their streams and messages for AI SDK UI components, including text, tools, multimodal content, and typed data events.
LlamaIndexThe LlamaIndex adapter connects LlamaIndex ChatEngine or QueryEngine streams to AI SDK UI integrations. Use @ai-sdk/llamaindex to convert engine output into a client-consumable UI message stream.
HaystackConst
Semantic KernelConst
AutoGenConst
CrewAIConst
MastraConst
Pydantic AIConst
LangSmithLangSmith adds monitoring and evaluation to AI SDK applications. Initialize tracing with wrapAISDK, and use traceable for custom spans around model or tool work.
LangfuseConst
HeliconeConst
Weights & BiasesWeights & Biases observability for the AI SDK is provided through Weave. It uses OpenTelemetry to capture AI SDK traces, including prompts, responses, flow, and cost, for inspection in Weave.
PhoenixConst
BraintrustBraintrust integrates with the AI SDK through OpenTelemetry to log and monitor LLM interactions. Configure its exporter for Next.js or its span processor for standalone Node.js.
Model Context ProtocolConst
System PromptA system prompt provides initial instructions that guide and constrain a model’s behavior. In the current AI SDK, pass it through instructions, alongside prompt or messages.
Few-shot PromptingConst
Structured OutputThe AI SDK generates schema-conforming structured data through the output option on generateText and streamText. Choose an output specification such as Output.object() or Output.array() and supply a supported schema.
Streaming ResponsesStreaming exposes parts of an AI response as soon as they are generated, so a UI can begin rendering earlier than with a blocking response. It improves perceived responsiveness for conversational interfaces.
Token StreamingToken streaming uses streamText to deliver language-model text incrementally. It enables responsive chatbots and other real-time applications, and can also work with tools to generate UI components.
Rate LimitingRate limiting protects an API by restricting each client's requests within a time window. The documented example uses Upstash Redis and Upstash Ratelimit to allow five requests every 30 seconds and reject excess traffic.
CachingCache AI provider responses temporarily and replay them for repeated requests. The recommended method uses language model middleware, with simulateReadableStream for cached streaming output.
RetriesmaxRetries controls how many times the AI SDK retries failures while starting a model call. It defaults to 2 and can be set to 0 to disable retries.
Provider AbstractionProvider abstraction gives AI SDK Core a common interface for working with models from different providers. It lets applications use the same API while switching among provider integrations more easily.

Search across every package and filter by type in your dashboard.

Start learning