go-ai-sdk
Developer SDKWrite your AI features in Go once. Run them on any of 40 model providers.
An open-source Go library for building AI features across 40 providers: text and streaming, structured output, tools, embeddings, images and speech.

Every AI provider has its own dialect
Go suits the services that sit around AI models. The trouble is that every provider has its own API for chat, tools, structured output and streaming. So teams write and maintain one integration per vendor, and switching provider for cost, data residency or quality turns into a rewrite. go-ai-sdk gives Go developers a single, consistent API across the lot.
Why it’s built the way it is.
One API, 40 providers
OpenAI, Anthropic, Google, Azure OpenAI, Amazon Bedrock, Vertex AI, Mistral, xAI and more all answer to the same calls. Changing provider is one line of code, or just a setting.
Answers land in Go types
Structured output decodes the model’s answer into your own structs. Where a provider has a native JSON mode, the SDK uses it; where it doesn’t, a forced tool call does the job.
A core with no dependencies
The root module uses only the Go standard library. OpenTelemetry support is its own module, added only if you want it.
Familiar to TypeScript teams
Concepts and naming follow the Vercel AI SDK. The code itself is idiomatic Go: context, iterators, generics and typed errors.
From setup to everyday use.
- 1
Add the module
go get github.com/azrtydxb/go-ai-sdk (Go 1.26 or later).
- 2
Pick a model
Create a provider directly, or resolve a "provider:model" string through the registry so the choice can sit in configuration.
- 3
Call it
Generate or stream text. Hand the model typed tools to call in a multi-step loop, or ask it for a Go struct back.
- 4
Observe and control
Retries, timeouts, tool approvals and telemetry hooks come built in. An OpenTelemetry bridge covers tracing.
See go-ai-sdk at work.


What it does, in detail.
Generation
- Text and streaming GenerateText and StreamText; streamed parts arrive as a Go iterator.
- Structured output GenerateObject and the output modes decode answers straight into typed Go values.
- Reasoning A single reasoning-effort option, mapped onto each provider’s own setting.
- Embeddings and reranking Embed and EmbedMany batch automatically. Reranking works with Cohere, Voyage and Mixedbread.
Tools and agents
- Typed tools A tool is a Go function. Its JSON Schema comes from the argument struct.
- Multi-step tool loop The SDK runs the call, tool, answer loop for you, with limits and a callback at each step.
- Tool approvals A tool call can pause for an inline decision, or suspend and resume once someone approves it.
- Agents An agent bundles a model, instructions and tools. One agent can serve as a tool for another.
- MCP client Connects to Model Context Protocol servers over stdio or Streamable HTTP and uses their tools as they are.
Media
- Images and video Image generation across several providers. Video through Luma, fal and Replicate.
- Speech Text-to-speech and transcription, live streaming transcription with Deepgram and OpenAI included.
- Files Upload files to OpenAI and Anthropic, then refer to them in your prompts.
Production
- Retries and typed errors Every model call passes through one shared retry wrapper, and its errors can be inspected with errors.As.
- Timeouts Separate limits for the whole run, for each step and for streams that stall.
- Middleware and registry Wrap any model in shared behaviour. Resolve models from "provider:model" strings.
- OpenTelemetry An optional module emits spans following the GenAI semantic conventions.
Who uses it, and for what.
AI features in Go services
Add summarising, classification, extraction or chat to the Go back ends you already have. No separate Python or Node service needed.
Keeping provider choice open
Send calls to OpenAI, Azure, Bedrock or an in-house gateway by changing configuration, whether the driver is data residency, cost or quality.
Agents and tool use
Build assistants that reach your own systems through typed tools and MCP servers, with an approval step in front of anything sensitive.
At a glance
- Language
- Go 1.26 or later
- Providers
- 40, among them OpenAI, Anthropic, Google, Azure OpenAI, Amazon Bedrock, Vertex AI, Mistral, Cohere, Groq, xAI and DeepSeek
- Dependencies
- None in the core module; the OpenTelemetry bridge is a separate module
- Integrates with
- Model Context Protocol servers, OpenTelemetry and any OpenAI-compatible endpoint
- Licence
- Open source, Apache 2.0
Questions
Is it really open source?
Yes. go-ai-sdk is released under the Apache 2.0 licence. You can use it in commercial products, modify it and ship it, with no licence fee to pay.
Does our data pass through Azrty?
No. The SDK is a library inside your application. It talks straight to the providers or gateways you configure, and nothing comes to us.
Can we use models hosted in our own region or on-premises?
Yes. Point it at Azure OpenAI, Amazon Bedrock or Vertex AI in whichever region you choose. Or at any OpenAI-compatible endpoint, such as a self-hosted model server or an internal gateway.
Is it ready for production?
Yes. It is tested end to end, with a shared conformance suite that runs across providers. We build our own products on it.
Can Azrty help us build with it?
Yes. We offer implementation help and support to teams building AI features in Go, and the cost depends on the scope. Book a call and we’ll talk it through.
AI that writes code to senior standards, with memory and context.
Procoder
Quality gates for AI coding agents. Work that is untested, unformatted or unfinished doesn't get to call itself done.
Learn moreKnowledge baseKryton
A self-hosted knowledge base with wiki links and a knowledge graph. Your team and your AI assistants read and write it together.
Learn moreAI memoryNovamem
A memory service for AI agents. They remember what matters between conversations, privately for each person or shared across a project.
Learn moreAI code reviewKuvryn Scout
Keeps reviewing your GitHub and GitLab repositories with standard analysers and AI rules, and files what it finds as issues without repeating itself.
Learn moreAI software factoryNovaForge
A self-hosted Git platform where AI agents pick up work in isolated runs. Quality gates and an independent review decide what gets merged.
Learn moreSee it on your own data.
We run the demo with your data, then propose a scope and pricing.