SoftwareBuild

go-ai-sdk

Developer SDK

Write 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.

Editor showing a Go program: a GenerateText call with a typed tool, a multi-step loop and output decoded into a Go struct
A tool-calling AI feature with a typed answer in about 40 lines of Go.
Why go-ai-sdk

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.

What makes it different

Why it’s built the way it is.

01

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.

02

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.

03

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.

04

Familiar to TypeScript teams

Concepts and naming follow the Vercel AI SDK. The code itself is idiomatic Go: context, iterators, generics and typed errors.

How it works

From setup to everyday use.

  1. 1

    Add the module

    go get github.com/azrtydxb/go-ai-sdk (Go 1.26 or later).

  2. 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. 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. 4

    Observe and control

    Retries, timeouts, tool approvals and telemetry hooks come built in. An OpenTelemetry bridge covers tracing.

A closer look

See go-ai-sdk at work.

Terminal output of the example: the tool call, the decoded reply fields, step and token counts, and go list showing no dependencies
Typed replies, and nothing in the core module except the standard library.
Editor showing a provider registry with OpenAI, Anthropic, Azure, Bedrock and Google, and a model chosen from a setting
Switch provider with a setting, not a rewrite.
Features

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.
Use cases

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.

Build

AI that writes code to senior standards, with memory and context.

See it on your own data.

We run the demo with your data, then propose a scope and pricing.

info@azrty.com+971 58 562 6444Meydan Grandstand, 6th floor, Dubai
go-ai-sdk: One Go SDK for 40 AI providers. | Azrty