SDK API
AI SDK functions with working examples
generateText( )
Text and structured data generation with Output.object()
streamText( )
Streaming text and structured data with Output.object()
generateImage( )
Image generation examples
generateSpeech( )
Speech synthesis examples
transcribe( )
Audio transcription examples
tool( )
AI SDK tool API examples and patterns
Agent( )
AI SDK agent API examples and patterns
All SDK API Patterns


AI SDK Gemini Flash Text
Generate text and analyze market research using Google's Gemini 2.5 Flash. Includes interactive charts and data visualization.


Claude Structured Output
Generate structured output from AI prompts using Anthropic Claude. Create typed data with generateText and Output.object().


Gemini Structured Output
Generate structured output from AI prompts using Google Gemini. Create typed data with generateText and Output.object().


OpenAI Structured Output
Generate structured output from AI prompts using OpenAI. Create typed data with generateText and Output.object().


Generate Text
Generate text from prompts using AI. Simple interface with character counting and response rendering.


Streaming Structured Output
Stream structured output from AI prompts in real-time using streamText with Output.object(). Generate typed data with useObject and live rendering.


Stream Text
Stream text responses from AI prompts in real-time. Includes character counting and live response rendering with useCompletion.


Generate Image (Fal.ai)
Generate images from text prompts using Fal.ai's Flux model. Fast and high-quality image generation.


Generate Image (Google Gemini)
Generate images from text prompts using Google Gemini's image model.


Generate Image (OpenAI)
Generate images from text prompts using OpenAI's DALL-E 3. Create high-quality images with AI.


Generate Speech (ElevenLabs)
Convert text to speech using ElevenLabs API. Includes multiple voices and high-quality audio generation.


Generate Speech (OpenAI)
Convert text to speech using OpenAI's API. Includes multiple voices, speed control, and real-time playback for voiceovers and accessibility.


Transcribe Audio (ElevenLabs)
Transcribe audio files using ElevenLabs API. Includes real-time transcription and language detection.


Transcribe Audio (OpenAI)
Transcribe audio files using OpenAI's API. Includes real-time transcription and language detection.


HIL Needs Approval
Demonstrate tool approval with async generators. Includes real-time feedback, approval workflows, and interactive management.


HIL Tool Approval Basic
Chat assistant with human approval workflows for safe tool execution.


Scrape - Cheerio (lightweight)
Scrape websites using Cheerio's fast HTML parser. Includes URL scraping, website crawling, and content extraction without external API costs.


Scrape - Jina AI (advanced)
Scrape websites using Jina AI's reader service with JavaScript rendering. Includes URL scraping, website crawling, and content extraction with AI-powered parsing.


Scrape - Markdown.new (free)
Scrape websites using Cloudflare's markdown.new service. Extract clean markdown content from any URL. No API key required.


Search - Exa AI (robust)
Search the web using Exa's semantic API and real-time crawling. Includes URL search, content extraction, Wikipedia, Reddit, and news search tools.


Search - Firecrawl (robust)
Search the web using Firecrawl's API and real-time crawling. Includes URL search, content extraction, Wikipedia, Reddit, and news search tools.


Tool API Context
Pass arbitrary context from generateText/streamText to tool execution via experimental_context. Access context in tool execute functions for dynamic behavior.


Dynamic Tool
Create dynamic tools with runtime-generated schemas using dynamicTool. Demonstrates unit conversion tools where schema adapts based on conversion type (temperature, length, weight, currency) and supports dynamic model selection.


Tool Input Lifecycle Hooks
Explore tool input lifecycle hooks: onInputStart, onInputDelta, and onInputAvailable. See how to track tool input generation in real-time during streaming.


Preliminary Tool Results
Return preliminary tool results using async iterables. Stream status updates during tool execution before the final result is available.


Tool Call Repair
Repair invalid tool calls using experimental_repairToolCall. Fix schema validation errors without requiring additional steps that pollute message history.



