# Go AI SDK > Build production-grade AI applications in Go Every page is also available as markdown by appending `.md` to its URL. The full documentation in one file: https://goaisdk.com/llms-full.txt ## Introduction - [Go AI SDK](https://goaisdk.com/docs/introduction.md): The Go AI SDK is a powerful toolkit for building AI applications and agents with Go, featuring support for 26+ providers. ## Announcing Go AI - [Announcing the Go AI SDK](https://goaisdk.com/docs/announcing-go-ai.md): A comprehensive toolkit for building AI applications and agents with Go. ## Foundations - [Foundations](https://goaisdk.com/docs/foundations.md): A section that covers foundational knowledge around LLMs and concepts crucial to the Go AI SDK - [Overview](https://goaisdk.com/docs/foundations/overview.md): An overview of foundational concepts critical to understanding the Go AI SDK - [Providers and Models](https://goaisdk.com/docs/foundations/providers-and-models.md): Explains the Go AI SDK's unified provider.Provider interface, listing supported providers, model capabilities, self-hosted models, and the provider registry. - [Prompts](https://goaisdk.com/docs/foundations/prompts.md): Covers text, system, and message prompt formats in the Go AI SDK, including provider-specific options and multi-turn conversation context. - [Tools](https://goaisdk.com/docs/foundations/tools.md): Introduces tools in the Go AI SDK: defining schemas, multi-step tool calling, tool choice, execution callbacks, and handling tool errors in Go. - [Streaming](https://goaisdk.com/docs/foundations/streaming.md): Compares blocking and streaming interfaces for AI apps, then shows basic Go streaming, callbacks, accumulating text, and cancelling streams with StreamText. - [Provider options](https://goaisdk.com/docs/foundations/provider-options.md): Documents ProviderOptions in the Go AI SDK: namespaced provider-specific settings for OpenAI, Anthropic, Google/Vertex, and xAI, with type-safe combining. ## Getting Started - [Getting Started](https://goaisdk.com/docs/getting-started.md): Entry point for Go AI SDK docs, pointing to the quick start, installation, a first example application, and guidance for API servers and frameworks. - [Navigating the Library](https://goaisdk.com/docs/getting-started/navigating-the-library.md): Learn how to navigate the Go AI SDK and choose the right tools for your needs. - [Go Quick Start](https://goaisdk.com/docs/getting-started/golang.md): Step-by-step quick start for building a first AI agent in Go, covering setup, provider choice, adding tools, and enabling multi-step tool calls. ## Agents - [Agents](https://goaisdk.com/docs/agents.md): Landing page for the agents section of the Go AI SDK docs, linking guides on building agents, workflows, callbacks, and call-option configuration. - [Overview](https://goaisdk.com/docs/agents/overview.md): Explains how agents combine LLMs and tools in a loop using ToolLoopAgent, covering execution flow, stopping conditions, callbacks, and structured workflows. - [Building Agents](https://goaisdk.com/docs/agents/building-agents.md): Complete guide to creating agents with ToolLoopAgent in Go: configuration options, system instructions, callbacks, and human-in-the-loop tool approval. - [Workflow Patterns](https://goaisdk.com/docs/agents/workflows.md): Learn workflow patterns for building reliable agents with the Go AI SDK. - [Loop Control](https://goaisdk.com/docs/agents/loop-control.md): Control agent execution with stop conditions, PrepareCall, and manual loop patterns - [Configuring Call Options](https://goaisdk.com/docs/agents/configuring-call-options.md): Shows how to pass runtime inputs to agents in Go using factory functions, so agent settings can be dynamically configured per request in HTTP handlers. - [Agent Callbacks](https://goaisdk.com/docs/agents/callbacks.md): Reference for Go AI SDK agent lifecycle callbacks, covering both legacy and LangChain-style callback types, common use cases, data types, and run tracking. - [WorkflowAgent](https://goaisdk.com/docs/agents/workflow-agent.md): Documents pkg/workflow's WorkflowAgent for durable, serializable Go workflows, covering the constructor, Generate, Stream, and chat transport. - [Agent Skills](https://goaisdk.com/docs/agents/agent-skills.md): Explains agent skills in the Go AI SDK: reusable behaviors registered with agents, covering skill structure, the skill registry, and skills vs. tools. - [Agent Subagents](https://goaisdk.com/docs/agents/agent-subagents.md): Covers hierarchical agent systems in the Go AI SDK where a main agent delegates to subagents, including the subagent registry and delegation tracking. ## AI SDK Core - [AI SDK Core](https://goaisdk.com/docs/ai-sdk-core.md): Learn about AI SDK Core and how to work with Large Language Models in Go - [Core API Overview](https://goaisdk.com/docs/ai-sdk-core/overview.md): Overview of the Go AI SDK Core API: core generation functions, context-based operations, error handling, middleware, telemetry, and Go-specific features. - [Generating Text](https://goaisdk.com/docs/ai-sdk-core/generating-text.md): Shows how to generate and stream text with GenerateText and StreamText in Go, covering message-based generation, settings, and error-handling patterns. - [Generating Structured Data](https://goaisdk.com/docs/ai-sdk-core/generating-structured-data.md): Explains generating structured JSON output with GenerateObject and StreamObject in Go, including the SchemaFor helper, output strategies, and schema naming. - [Tool Calling](https://goaisdk.com/docs/ai-sdk-core/tools-and-tool-calling.md): Covers multi-step tool calling in the Go AI SDK: strict mode, response messages, tool choice, execution options, timeouts, and packaging complex tools. - [Model Context Protocol (MCP)](https://goaisdk.com/docs/ai-sdk-core/mcp-tools.md): Learn how to connect to Model Context Protocol (MCP) servers and use their tools with Go-AI SDK. - [Prompt Engineering](https://goaisdk.com/docs/ai-sdk-core/prompt-engineering.md): Teaches prompt engineering for LLMs in Go, from a slogan-generator quick start to advanced techniques, Go-specific schema patterns, and debugging prompts. - [Settings](https://goaisdk.com/docs/ai-sdk-core/settings.md): Reference for configuring the Go AI SDK: common settings, provider configuration headers, provider-specific options, and checking generation warnings. - [Reasoning](https://goaisdk.com/docs/ai-sdk-core/reasoning.md): Learn how to control reasoning across providers with the top-level Reasoning parameter. - [Upload File and Upload Skill](https://goaisdk.com/docs/ai-sdk-core/upload-file-and-skill.md): Upload provider files and multi-file skills for later reference in model calls. - [Embeddings](https://goaisdk.com/docs/ai-sdk-core/embeddings.md): Explains embedding single and multiple values with the Go AI SDK's Embed and EmbedMany functions, plus similarity, token usage, and embedding middleware. - [Reranking](https://goaisdk.com/docs/ai-sdk-core/reranking.md): Covers reranking documents by relevance with the Go AI SDK's Rerank function, including structured documents, settings, and reranking provider options. - [Image Generation](https://goaisdk.com/docs/ai-sdk-core/image-generation.md): Shows how to generate images in Go with ai.GenerateImage, covering settings, error handling, supported image models, and advanced generation features. - [Transcription](https://goaisdk.com/docs/ai-sdk-core/transcription.md): Shows how to transcribe audio in Go with ai.Transcribe, covering supported audio input formats, accessing results, settings, and transcription models. - [Speech Generation](https://goaisdk.com/docs/ai-sdk-core/speech.md): Shows how to generate speech from text in Go with ai.GenerateSpeech, covering audio data access, settings, supported formats, and performance tips. - [Video Generation](https://goaisdk.com/docs/ai-sdk-core/video-generation.md): Covers text-to-video and image-to-video generation across multiple providers in the Go AI SDK, including async polling with DoStart and DoStatus. - [Realtime Sessions](https://goaisdk.com/docs/ai-sdk-core/realtime.md): Documents provider-neutral realtime session helpers in the Go AI SDK, exposing provider.Experimental_RealtimeModelV4 through ai.ConnectRealtime. - [Language Model Middleware](https://goaisdk.com/docs/ai-sdk-core/middleware.md): Learn how to use middleware to enhance the behavior of language models - [Provider & Model Management](https://goaisdk.com/docs/ai-sdk-core/provider-management.md): Explains centrally managing multiple providers and models in Go using the provider registry, custom providers with middleware, and registry utilities. - [Error Handling](https://goaisdk.com/docs/ai-sdk-core/error-handling.md): Covers Go AI SDK error handling: regular and streaming errors, context cancellation, specific error types, and a comprehensive error-handling example. - [Testing](https://goaisdk.com/docs/ai-sdk-core/testing.md): Describes strategies for testing Go code that calls non-deterministic, slow, and costly language models, with examples and integration-testing tips. - [Telemetry](https://goaisdk.com/docs/ai-sdk-core/telemetry.md): Shows how to enable OpenTelemetry tracing in the Go AI SDK Core, covering telemetry settings, setup in Go, collected data, and semantic conventions. - [Development Tools & Debugging](https://goaisdk.com/docs/ai-sdk-core/devtools.md): Covers debugging, profiling, and testing Go-AI SDK applications, including debug mode, request/response inspection, token usage, and performance profiling. - [Event callbacks](https://goaisdk.com/docs/ai-sdk-core/event-callbacks.md): Subscribe to lifecycle events in GenerateText, StreamText, Embed, EmbedMany, and Rerank calls. ## Advanced - [Advanced](https://goaisdk.com/docs/advanced.md): Landing page for advanced Go AI SDK topics, covering concurrency primitives, caching, rate limiting, deployment, and other production-oriented guides. - [Coding Agents](https://goaisdk.com/docs/advanced/coding-agents.md): How to build AI agents that generate, review, and iteratively refine code using the Go AI SDK. - [Advanced Guides](https://goaisdk.com/docs/advanced-guides.md): In-depth guides for advanced AI application patterns using the Go AI SDK. - [Memory Management](https://goaisdk.com/docs/advanced/memory-management.md): Patterns for managing conversation history in long-running AI applications. - [Prompt Engineering](https://goaisdk.com/docs/advanced/prompt-engineering.md): Advanced guide to prompt engineering for LLMs in Go, covering what a prompt is, a slogan-generator example, advanced techniques, and common pitfalls. - [Provider Architecture](https://goaisdk.com/docs/advanced/provider-architecture.md): How the Go AI SDK's provider abstraction layer works, and how to implement your own provider. - [Stopping Streams](https://goaisdk.com/docs/advanced/stopping-streams.md): Shows how to cancel streaming AI responses in Go using context cancellation, timeouts, HTTP request cancellation, and graceful shutdown patterns. - [Backpressure](https://goaisdk.com/docs/advanced/backpressure.md): How to handle backpressure and cancellation when working with the Go AI SDK - [Caching](https://goaisdk.com/docs/advanced/caching.md): Explains caching AI responses in the Go AI SDK using language model middleware, different storage backends, the OnFinish callback, and streaming caches. - [Multiple Concurrent Streams](https://goaisdk.com/docs/advanced/multiple-streamables.md): Patterns for managing multiple concurrent AI streams in Go with goroutines and channels, including fan-out/fan-in and rate-limited streaming approaches. - [Rate Limiting](https://goaisdk.com/docs/advanced/rate-limiting.md): Shows how to rate limit Go AI SDK applications using a token bucket, a Redis sliding window, middleware, and per-user versus global strategies. - [Language Models as Routers](https://goaisdk.com/docs/advanced/model-as-router.md): Use language models to dynamically route requests to appropriate handlers - [Sequential Generations](https://goaisdk.com/docs/advanced/sequential-generations.md): Learn how to implement sequential generations ("chains") with the Go AI SDK - [Deployment Guide](https://goaisdk.com/docs/advanced/deployment-guide.md): Guide to deploying Go AI SDK applications to production, covering binary compilation, Docker containerization, cloud deployment, and health checks. - [Memory Optimization](https://goaisdk.com/docs/advanced/memory-optimization.md): Explains how retention settings in the Go AI SDK reduce memory consumption by 50-80%, covering usage, streaming support, and performance impact. - [MLflow Observability](https://goaisdk.com/docs/advanced/mlflow-observability.md): Shows how to track and debug Go-AI SDK operations with MLflow Tracing over OpenTelemetry, covering configuration, telemetry settings, and troubleshooting. ## Providers - [Providers](https://goaisdk.com/docs/providers.md): Complete guide to the 49 AI providers supported by the Go-AI SDK, covering provider categories, comparison, selection guidance, and configuration patterns. - [Provider System Overview](https://goaisdk.com/docs/providers/overview.md): Complete guide to the Go-AI SDK provider architecture and capabilities - [OpenAI Provider](https://goaisdk.com/docs/providers/openai.md): Setup and usage guide for OpenAI models (GPT-4, GPT-5, o1, o3) with Go-AI SDK - [Anthropic Provider](https://goaisdk.com/docs/providers/anthropic.md): Setup and usage guide for Anthropic Claude models (Sonnet, Opus, Haiku) with Go-AI SDK - [Google Provider](https://goaisdk.com/docs/providers/google.md): Setup and usage guide for Google's Gemini models in the Go-AI SDK, covering available models, multimodal features, video generation, and configuration. - [Azure OpenAI Provider](https://goaisdk.com/docs/providers/azure.md): Setup guide for Azure OpenAI Service in the Go-AI SDK, covering deployment names as model IDs, Entra ID authentication, and regional/private endpoints. - [AWS Bedrock Provider](https://goaisdk.com/docs/providers/bedrock.md): Setup and usage guide for AWS Bedrock multi-model platform with Go-AI SDK - [Cohere Provider](https://goaisdk.com/docs/providers/cohere.md): Setup and usage guide for Cohere Command and Embed models with Go-AI SDK - [Mistral AI Provider](https://goaisdk.com/docs/providers/mistral.md): Setup and usage guide for Mistral AI models in the Go-AI SDK, covering available models, provider-specific features, rate limits, and pricing. - [Groq Provider](https://goaisdk.com/docs/providers/groq.md): Setup and usage guide for Groq ultra-fast LPU inference with Go-AI SDK - [xAI Provider](https://goaisdk.com/docs/providers/xai.md): Setup and usage guide for xAI's Grok models in the Go-AI SDK, covering the Responses API, provider options, image/video generation, and speech support. - [DeepSeek Provider](https://goaisdk.com/docs/providers/deepseek.md): Setup and usage guide for DeepSeek's reasoning models in the Go-AI SDK, covering available models, provider-specific features, and May 2026 parity updates. - [Perplexity Provider](https://goaisdk.com/docs/providers/perplexity.md): Setup guide for Perplexity's Agent API in the Go-AI SDK, covering model selection, image input, embeddings, and migrating from the Chat Completions API. - [Together AI Provider](https://goaisdk.com/docs/providers/together.md): Setup and usage guide for Together AI open-source model hosting with Go-AI SDK - [Fireworks AI Provider](https://goaisdk.com/docs/providers/fireworks.md): Setup and usage guide for Fireworks AI's fast inference models in the Go-AI SDK, covering available models, async models, and production best practices. - [Replicate Provider](https://goaisdk.com/docs/providers/replicate.md): Setup and usage guide for Replicate's model marketplace in the Go-AI SDK, covering available models, workflow serialization, and example API calls. - [HuggingFace Provider](https://goaisdk.com/docs/providers/huggingface.md): Setup and usage guide for HuggingFace Router Responses API with Go-AI SDK - [Ollama Provider](https://goaisdk.com/docs/providers/ollama.md): Setup and usage guide for Ollama local model deployment with Go-AI SDK - [Google Vertex AI Provider](https://goaisdk.com/docs/providers/google-vertex.md): Setup and usage guide for Google Vertex AI enterprise platform with Go-AI SDK - [Stability AI Provider](https://goaisdk.com/docs/providers/stability.md): Setup and usage guide for Stability AI image generation with Go-AI SDK - [Black Forest Labs Provider](https://goaisdk.com/docs/providers/bfl.md): Setup and usage guide for Black Forest Labs FLUX image models with Go-AI SDK - [FAL Provider](https://goaisdk.com/docs/providers/fal.md): Setup and usage guide for FAL fast image and video generation with Go-AI SDK - [Luma Provider](https://goaisdk.com/docs/providers/luma.md): Setup guide for Luma AI's asynchronous Photon image generation in the Go-AI SDK, covering reference-image-guided generation and workflow serialization. - [ElevenLabs Provider](https://goaisdk.com/docs/providers/elevenlabs.md): Setup guide for ElevenLabs text-to-speech in the Go-AI SDK, covering the provider.SpeechModel interface, generating speech, provider options, and models. - [Deepgram Provider](https://goaisdk.com/docs/providers/deepgram.md): Setup guide for Deepgram speech-to-text in the Go-AI SDK, covering the provider.TranscriptionModel interface, timestamps, models, and speech synthesis. - [AssemblyAI Provider](https://goaisdk.com/docs/providers/assemblyai.md): Setup guide for AssemblyAI transcription in the Go-AI SDK, covering the provider.TranscriptionModel interface, timestamps, supported models, and usage. - [Cartesia Provider](https://goaisdk.com/docs/providers/cartesia.md): Setup and usage guide for Cartesia speech synthesis and transcription with Go-AI SDK - [Fish Audio Provider](https://goaisdk.com/docs/providers/fishaudio.md): Setup and usage guide for Fish Audio speech synthesis and transcription with Go-AI SDK - [Hume Provider](https://goaisdk.com/docs/providers/hume.md): Setup guide for Hume's expressive text-to-speech in the Go-AI SDK, noting it only supports speech synthesis, with workflow serialization details. - [Rev.ai Provider](https://goaisdk.com/docs/providers/revai.md): Setup guide for Rev.ai's asynchronous, job-based transcription in the Go-AI SDK, noting only TranscriptionModel is supported, plus provider options. - [Baseten Provider](https://goaisdk.com/docs/providers/baseten.md): Setup and usage guide for Baseten Model APIs and custom deployments with Go-AI SDK - [Cerebras Provider](https://goaisdk.com/docs/providers/cerebras.md): Setup and usage guide for Cerebras ultra-fast wafer-scale inference with Go-AI SDK - [DeepInfra Provider](https://goaisdk.com/docs/providers/deepinfra.md): Setup and usage guide for DeepInfra serverless GPU inference with Go-AI SDK - [GMI Cloud Provider](https://goaisdk.com/docs/providers/gmicloud.md): Setup and usage guide for GMI Cloud OpenAI-compatible inference with Go-AI SDK - [Z.AI Provider](https://goaisdk.com/docs/providers/zai.md): Setup guide for Z.AI's GLM chat models over an OpenAI-compatible API in the Go-AI SDK, covering available models, provider options, and basic usage. - [MiniMax Provider](https://goaisdk.com/docs/providers/minimax.md): Setup and usage guide for MiniMax chat and video models with Go-AI SDK - [Moonshot AI Provider](https://goaisdk.com/docs/providers/moonshot.md): Setup guide for Moonshot AI's Kimi and legacy Moonshot v1 chat models in the Go-AI SDK, covering provider options, metadata, and workflow serialization. - [Alibaba Cloud Provider](https://goaisdk.com/docs/providers/alibaba.md): Setup and usage guide for Alibaba Cloud Qwen and Wan models with Go-AI SDK - [KlingAI Provider](https://goaisdk.com/docs/providers/klingai.md): Setup guide for KlingAI's video generation in the Go-AI SDK, covering text-to-video, image-to-video, motion control, async polling, and error handling. - [AI Gateway](https://goaisdk.com/docs/providers/gateway.md): Use Vercel's AI Gateway for unified multi-provider access, automatic failover, and cost optimization. - [Vercel AI Provider](https://goaisdk.com/docs/providers/vercel.md): Setup and usage guide for the Vercel AI OpenAI-compatible endpoint with Go-AI SDK - [Gladia Provider](https://goaisdk.com/docs/providers/gladia.md): Setup and usage guide for Gladia speech-to-text transcription with Go-AI SDK - [QuiverAI Provider](https://goaisdk.com/docs/providers/quiverai.md): Covers generating SVGs and vectorizing raster images with QuiverAI through the Go-AI image model interface, including provider options and setup. - [LMNT Provider](https://goaisdk.com/docs/providers/lmnt.md): Setup and usage guide for LMNT text-to-speech synthesis with Go-AI SDK - [Prodia Provider](https://goaisdk.com/docs/providers/prodia.md): Setup and usage guide for Prodia image and video generation with the Go AI SDK. - [Voyage Provider](https://goaisdk.com/docs/providers/voyage.md): Setup guide for Voyage embedding and reranking models in the Go-AI SDK, covering model IDs, retrieval-optimized usage, and May 2026 parity updates. - [TypeSafe AI Provider](https://goaisdk.com/docs/providers/typesafeai.md): Setup and usage guide for TypeSafe AI evaluation models with Go-AI SDK - [OpenAI-compatible providers](https://goaisdk.com/docs/providers/openai-compatible.md): Configure OpenAI-compatible endpoints with Go AI SDK provider options and warnings. - [OpenResponses Provider](https://goaisdk.com/docs/providers/openresponses.md): Explains the OpenResponses provider for Responses-compatible APIs like LMStudio, Ollama, and LocalAI, covering custom tools and streaming text parts. - [Topaz Provider](https://goaisdk.com/docs/providers/topaz.md): Setup and usage guide for Topaz Labs image and video enhancement with the Go AI SDK. - [You.com Tools](https://goaisdk.com/docs/providers/youcom-tools.md): Reference for pkg/providers/youcom, a Go port of the You.com AI SDK plugin providing search, research, and content-extraction tools for agents. - [Alibaba Video Generation](https://goaisdk.com/docs/providers/alibaba-video-generation.md): Guide to image-to-video generation using the Alibaba DashScope provider in the Go-AI SDK, covering available models, image formats, and limitations. - [Anthropic Advanced Features](https://goaisdk.com/docs/providers/anthropic-advanced-features.md): Covers advanced Claude model features in the Go-AI SDK, including Fast Mode, adaptive thinking, combining features, and AWS Bedrock support. - [ByteDance Video Generation](https://goaisdk.com/docs/providers/bytedance-video-generation.md): Guide to text-to-video and image-to-video generation with the ByteDance Volcengine provider in the Go-AI SDK, covering start/end frames and resolution. - [FAL Video Generation](https://goaisdk.com/docs/providers/fal-video-generation.md): Guide to image-to-video generation using the FAL provider in the Go-AI SDK, covering supported image formats, parameters, and memory considerations. - [OpenAI Responses API: Custom Tools & Shell Container Tools](https://goaisdk.com/docs/providers/openai-responses-tools.md): Covers Custom Tool, Tool Search, and Shell Container Tool types in the OpenAI Responses API, and how to use PrepareTools with them in the Go-AI SDK. ## Reference - [API Reference](https://goaisdk.com/docs/reference.md): Complete API reference index for the Go-AI SDK, linking core functions, tool and helper APIs, type definitions, provider interfaces, and middleware. - [Agent UI Stream Helpers](https://goaisdk.com/docs/reference/ai/agent-ui-stream-helpers.md): API reference for pkg/agent UI stream helpers that bridge ToolLoopAgent streams to UI-transport-friendly forms, including CreateAgentUIStream. - [Agent](https://goaisdk.com/docs/reference/ai/agent.md): API reference for agent.Agent, the Go AI SDK interface implemented by autonomous agents that use tools and make decisions to complete tasks. - [Callback Events](https://goaisdk.com/docs/reference/ai/callback-events.md): Structured lifecycle events for observability in GenerateText, StreamText, and ToolLoopAgent - [Code Mode](https://goaisdk.com/docs/reference/ai/code-mode.md): API reference for pkg/codemode, a Go port of @ai-sdk/code-mode letting a model write JavaScript that calls host tools instead of per-call tool use. - [CosineSimilarity](https://goaisdk.com/docs/reference/ai/cosine-similarity.md): API reference for CosineSimilarity, a Go AI SDK function that measures similarity between two embedding vectors, returning a value from -1 to 1. - [Dynamic Tools](https://goaisdk.com/docs/reference/ai/dynamic-tool.md): API reference for dynamic tools in the Go AI SDK: registering tools at runtime with types.Tool.Type set to types.ToolTypeDynamic instead of a static, typed definition. - [EmbedMany](https://goaisdk.com/docs/reference/ai/embed-many.md): API reference for EmbedMany, a Go AI SDK function that generates vector embeddings for multiple text inputs in a single batched operation. - [Embed](https://goaisdk.com/docs/reference/ai/embed.md): API reference for Embed, the Go AI SDK function that generates a single vector embedding for one text input using an embedding model. - [GenerateID / CreateIDGenerator](https://goaisdk.com/docs/reference/ai/generate-id.md): API reference for GenerateID and CreateIDGenerator, Go AI SDK helpers that create unique identifier strings for tool calls and requests. - [GenerateImage](https://goaisdk.com/docs/reference/ai/generate-image.md): API reference for GenerateImage, the Go AI SDK function that generates images from text prompts using a configured image model and provider. - [GenerateObject](https://goaisdk.com/docs/reference/ai/generate-object.md): API reference for GenerateObject, the Go AI SDK function that generates structured JSON objects conforming to a schema using language models. - [GenerateSpeech](https://goaisdk.com/docs/reference/ai/generate-speech.md): API reference for GenerateSpeech, the Go AI SDK function that generates speech audio from text using a configured speech model and provider. - [GenerateText](https://goaisdk.com/docs/reference/ai/generate-text.md): API reference for GenerateText, the Go AI SDK function that generates text with support for tool calling, streaming, and multi-step conversations. - [Harness Sandbox: Vercel](https://goaisdk.com/docs/reference/ai/harness-sandbox-vercel.md): API reference for pkg/harness/sandbox/vercel, a Go port of the Vercel Sandbox harness provider - [HasToolCall](https://goaisdk.com/docs/reference/ai/has-tool-call.md): Built-in StopCondition that stops the tool-calling loop when a specific tool is called - [LlamaIndex Adapter](https://goaisdk.com/docs/reference/ai/llamaindex.md): API reference for pkg/llamaindex, a Go port of @ai-sdk/llamaindex that adapts LlamaIndex chat-engine responses into AI SDK UI message stream chunks. - [Middleware Aliases](https://goaisdk.com/docs/reference/ai/middleware-aliases.md): Reference for the middleware type aliases, wrapper functions, and built-in middleware constructors that pkg/ai re-exports for discoverability. - [Rerank](https://goaisdk.com/docs/reference/ai/rerank.md): API reference for Rerank, the Go AI SDK function that reorders documents by relevance to a query using a specialized reranking model. - [IsStepCount](https://goaisdk.com/docs/reference/ai/step-count-is.md): API reference for IsStepCount (formerly StepCountIs), a built-in StopCondition that stops the Go AI SDK's tool-calling loop once a given number of steps completes. - [StopCondition](https://goaisdk.com/docs/reference/ai/stop-condition.md): Type reference for StopCondition and StopConditionState in the Go AI SDK, covering the function type, evaluation order, and usage with StopWhen. - [StreamObject](https://goaisdk.com/docs/reference/ai/stream-object.md): API reference for StreamObject, the Go AI SDK function that streams structured object generation, parsing and validating partial JSON as it arrives. - [StreamText](https://goaisdk.com/docs/reference/ai/stream-text.md): API reference for StreamText, the Go AI SDK function that streams text generation, returning tokens incrementally as the model produces them. - [Stream Transport Helpers](https://goaisdk.com/docs/reference/ai/stream-transport-helpers.md): Reference for Go AI SDK stream transport helpers that convert stream results into HTTP-friendly payloads, including CreateUIMessageStreamResponse. - [ToolLoopAgent](https://goaisdk.com/docs/reference/ai/tool-loop-agent.md): API reference for agent.ToolLoopAgent, the Go AI SDK type that creates an agent continuously using tools in a loop until the task completes. - [Tool](https://goaisdk.com/docs/reference/ai/tool.md): API reference for the Tool type in the Go AI SDK, defining tools that language models can call to perform actions or retrieve information. - [Transcribe](https://goaisdk.com/docs/reference/ai/transcribe.md): API reference for Transcribe, the Go AI SDK function that converts audio to text using a transcription model, including URL and base64 input. - [Built-in Middleware](https://goaisdk.com/docs/reference/middleware/built-in-middleware.md): Catalog of built-in Go AI SDK middleware, including DefaultSettingsMiddleware, DefaultInstructionsMiddleware, ExtractJSONMiddleware, ExtractReasoningMiddleware, SimulateStreamingMiddleware, and AddToolInputExamplesMiddleware. - [Middleware Interface](https://goaisdk.com/docs/reference/middleware/middleware-interface.md): API reference for LanguageModelMiddleware, EmbeddingModelMiddleware, and ImageModelMiddleware, the Go AI SDK structs for implementing custom model-behavior middleware. - [WrapLanguageModel](https://goaisdk.com/docs/reference/middleware/wrap-language-model.md): API reference for WrapLanguageModel, the Go AI SDK function that wraps a language model with middleware to add default settings, logging, or other behavior. - [Custom Provider Guide](https://goaisdk.com/docs/reference/providers/custom-provider.md): Guide for implementing custom AI providers for the Go-AI SDK, covering the provider interface, a custom language model, and streaming support. - [EmbeddingModel Interface](https://goaisdk.com/docs/reference/providers/embedding-model.md): API reference for the EmbeddingModel interface in the Go AI SDK, defining the methods every embedding model implementation must satisfy. - [ImageModel Interface](https://goaisdk.com/docs/reference/providers/image-model.md): API reference for the ImageModel interface in the Go AI SDK, defining the methods and ImageGenerateOptions every image model implementation must satisfy. - [LanguageModel Interface](https://goaisdk.com/docs/reference/providers/language-model.md): API reference for the LanguageModel interface in the Go AI SDK, defining the methods and GenerateOptions every language model implementation must satisfy. - [SpeechModel Interface](https://goaisdk.com/docs/reference/providers/speech-model.md): API reference for the SpeechModel interface in the Go AI SDK, defining the methods every text-to-speech model implementation must satisfy. - [TranscriptionModel Interface](https://goaisdk.com/docs/reference/providers/transcription-model.md): API reference for the TranscriptionModel interface in the Go AI SDK, defining the methods every speech-to-text model implementation must satisfy. - [Provider Registry](https://goaisdk.com/docs/reference/registry/provider-registry.md): API reference for the Go AI SDK's provider registry, which lets you register and access multiple AI providers globally through string IDs. - [JSON Schema](https://goaisdk.com/docs/reference/schema/json-schema.md): API reference for JSON Schema types in the Go AI SDK, covering the Schema and Validator interfaces, creating schemas, constraints, and circular refs. - [Error Types](https://goaisdk.com/docs/reference/types/errors.md): API reference for Go AI SDK error types, covering common errors returned by SDK functions and recommended error-handling patterns for applications. - [Message Types](https://goaisdk.com/docs/reference/types/messages.md): API reference for Go AI SDK message types, covering MessageRole, Message, and ContentPart implementations like TextContent, ImageContent, and FileContent. - [Tool Types](https://goaisdk.com/docs/reference/types/tools.md): API reference for Go AI SDK tool-related types, covering Tool, ToolCall, ToolResult, ToolChoice, and the ToolExecutor function signature. - [Usage Types](https://goaisdk.com/docs/reference/types/usage.md): API reference for Go AI SDK usage types that track token counts and costs across API calls, including input and output token detail breakdowns. - [Download API Reference](https://goaisdk.com/docs/reference/download-api.md): API reference for the Go-AI SDK's Download API, which fetches files securely with built-in size limits that prevent memory-exhaustion attacks. ## Migration Guides - [Migrating from v0.1.x to v0.2.0](https://goaisdk.com/docs/migration-guides/from-v0.1-to-v0.2.md): Breaking changes in Go AI SDK v0.2.0, the TypeScript AI SDK v6.0 parity release. - [Migrating from the TypeScript AI SDK](https://goaisdk.com/docs/migration-guides/from-typescript-ai-sdk.md): Map Vercel AI SDK (ai@7.0.x) calls to their Go SDK equivalents, and see where the Go port has to diverge. - [Migrating from v0.3.x to v0.4.0](https://goaisdk.com/docs/migration-guides/from-v0.3-to-v0.4.md): Runtime behavior changes in Go AI SDK v0.4.0 — deferred streaming tool execution, xAI's Responses API default, and stricter MCP redirect handling. - [Migrating from v0.4.x to v0.5.0](https://goaisdk.com/docs/migration-guides/from-v0.4-to-v0.5.md): Migration guide for upgrading Go AI SDK apps from v0.4.x to v0.5.0, covering runtime context changes, tool approval, provider updates, and breaking changes. - [Known differences from the TypeScript AI SDK](https://goaisdk.com/docs/migration-guides/known-differences.md): Behavior that is intentionally different in Go, and features that only exist in the TypeScript SDK. - [May 31 Stream, Telemetry, and Provider Migration](https://goaisdk.com/docs/migration-guides/may31-stream-telemetry-provider-parity.md): Maps the May 31 TypeScript AI SDK changes to Go-AI SDK API names, covering stream helpers, FullStream, UI message conversion, and telemetry setup. - [Token usage differentiation](https://goaisdk.com/docs/migration-guides/token-usage-differentiation.md): Explains the TextTokens and ImageTokens fields added to types.InputTokenDetails in v0.2.0, letting you cost multimodal requests accurately in Go. ## Troubleshooting - [Troubleshooting](https://goaisdk.com/docs/troubleshooting.md): Landing page for Go AI SDK troubleshooting guides, covering common issues, a quick diagnostic guide, debug mode, and where to get further help. - [Common Errors](https://goaisdk.com/docs/troubleshooting/common-errors.md): Covers the most frequent Go AI SDK errors and fixes, including API key issues, nil pointer errors, channel/streaming errors, and import/type errors. - [Provider Errors](https://goaisdk.com/docs/troubleshooting/provider-errors.md): Troubleshooting guide for provider-specific Go AI SDK errors across OpenAI, Anthropic, Google Gemini, Azure OpenAI, and AWS Bedrock integrations. - [Rate Limit Issues](https://goaisdk.com/docs/troubleshooting/rate-limits.md): Covers handling rate limiting and quota exhaustion in the Go AI SDK, including client-side rate limiting, concurrent request management, and monitoring. - [Context Cancellation](https://goaisdk.com/docs/troubleshooting/context-cancellation.md): Debugging guide for Go context timeout and cancellation issues in the Go AI SDK, covering propagation, goroutines, and streaming context problems. - [Streaming Issues](https://goaisdk.com/docs/troubleshooting/streaming-issues.md): Solves common Go AI SDK streaming problems, covering channel-related issues, stream interruption, concurrent streaming, and buffer and memory issues. - [Tool Calling Errors](https://goaisdk.com/docs/troubleshooting/tool-calling-errors.md): Debugging guide for Go AI SDK tool execution and schema issues, covering tool definition errors, tool choice problems, and async tool execution. - [Schema Validation Errors](https://goaisdk.com/docs/troubleshooting/schema-validation.md): Fixes JSON schema validation errors when generating structured data with the Go AI SDK, covering type mismatches, nested structures, and arrays. - [Performance Optimization](https://goaisdk.com/docs/troubleshooting/performance.md): Covers optimizing slow Go AI SDK operations, including slow response times, memory issues, caching for performance, and concurrent processing patterns. - [Debugging Guide](https://goaisdk.com/docs/troubleshooting/debugging.md): Comprehensive debugging techniques for Go AI applications, covering debug logging, goroutine debugging, pprof profiling, and stream debugging tools. - [Timeout Errors](https://goaisdk.com/docs/troubleshooting/timeout-errors.md): Explains timeout errors in the Go-AI SDK, covering how to detect, handle, and prevent them, plus recommended timeouts and async processing patterns. ## General - [Agent Callbacks](https://goaisdk.com/docs/agent-callbacks.md): Legacy reference for Go-AI SDK agent callback support, covering the OnStepFinish callback, other callbacks, a complete example, and TypeScript comparison. - [Fireworks Kimi K2.5: Extended Reasoning](https://goaisdk.com/docs/fireworks-kimi-k2-5.md): Explains extended reasoning and thinking options for Fireworks AI's Kimi K2.5 model in the Go AI SDK, covering model IDs, token budgets, and history modes. - [MCP Tool Serialization](https://goaisdk.com/docs/mcp-serialization.md): Documents GetSerializableTools() in the Go-AI SDK for retrieving MCP tool definitions in a storable, transmittable format, with pagination support. - [XAI Advanced Usage Reporting](https://goaisdk.com/docs/xai-usage-reporting.md): Explains advanced token usage tracking for xAI models in the Go-AI SDK, covering cached tokens, reasoning tokens, and cost tracking. ## Guides - [Streaming in Go AI SDK](https://goaisdk.com/docs/guides/STREAMING.md): Explains the Go AI SDK's Next()-based streaming pattern, covering chunk types, advanced patterns, error handling, and migrating from io.Reader. - [Download Security and Size Limits](https://goaisdk.com/docs/guides/download-security.md): Explains built-in protection against memory-exhaustion attacks when the Go-AI SDK downloads files from URLs, covering default limits and customization. - [May 2026 Migration Guide](https://goaisdk.com/docs/guides/migration-may-2026.md): Covers agent, registry, middleware, and operational API changes from the Go AI SDK's May 2026 parity cycle, including tool approval and sandbox API. - [Tool Reference (Anthropic)](https://goaisdk.com/docs/guides/tool-reference.md): Explains Anthropic tool references in the Go AI SDK, which let you reuse previously defined tool definitions to reduce token usage and improve performance. - [Tool Result Content Arrays](https://goaisdk.com/docs/guides/tool-result-content-arrays.md): Explains the content array feature for tool results in the Go AI SDK, letting tools return rich structured content like text, images, and files. ## Security - [Security Advisory: Unbounded Download DoS Prevention](https://goaisdk.com/docs/security/ADVISORY-Download-DoS.md): Security advisory describing an unbounded download denial-of-service vulnerability in the Go-AI SDK, its fix, mitigation steps, and impact assessment.