Providers
The Go-AI SDK supports 49 AI providers (pkg/providers/*), giving you access to the latest language models, embedding models, image generation, video generation, speech synthesis, and transcription services. Five providers — LMNT, Ollama, Stability AI, Vercel, and You.com — are Go-only additions with no upstream TypeScript AI SDK equivalent.
Provider Categories
Top Providers
The most popular and widely-used AI providers:
- OpenAI - GPT-4, GPT-5, o1, o3 models
- Anthropic - Claude Sonnet, Opus, Haiku
- Google - Gemini models
- Azure OpenAI - Enterprise OpenAI deployment
- AWS Bedrock - Multi-model AWS platform
- AWS Bedrock Anthropic (
pkg/providers/anthropicaws, "anthropic-aws") - Claude on Bedrock, rebuilt on the shared Anthropic language model
Popular Providers
High-performance providers with specialized capabilities:
- Cohere - Command and Embed models, reranking
- Mistral AI - Open-source language models
- Groq - Ultra-fast inference
- xAI - Grok models (Responses API, image, video, speech)
- DeepSeek - Advanced reasoning models
- Perplexity - Search-augmented Agent API
Open Source & Serving
Platforms for running open-source models:
- Together AI - Open-source model hosting, reranking
- Fireworks AI - Fast open-source inference
- Replicate - Run any open-source model
- HuggingFace - Router Responses API for HF models
- Ollama - Local model deployment (Go-only)
- Google Vertex AI - Enterprise AI platform
- GMI Cloud - OpenAI-compatible chat hosting
- Z.AI - OpenAI-compatible chat hosting
- MiniMax - Chat language models
- Moonshot AI - Kimi language models
- DeepInfra - Serverless GPU inference
- Baseten - ML model deployment
- Cerebras - Ultra-fast inference
Specialized Providers
Providers for specific use cases:
- Alibaba Cloud - Qwen language models & Wan video generation
- KlingAI - Professional video generation with motion control
- Stability AI - Image generation (Stable Diffusion) (Go-only)
- Black Forest Labs - FLUX image and video models
- FAL - Image, video, speech, and transcription
- QuiverAI - SVG generation and image vectorization
- Prodia - Fast FLUX and Stable Diffusion image generation
- ByteDance - Seedance/Seedream video and image (Volcengine Ark)
- Luma - Async image generation
- Replicate video, xAI video - see their provider pages
Speech, Transcription & Audio
- ElevenLabs - Speech synthesis and transcription
- Deepgram - Speech transcription
- AssemblyAI - Audio intelligence
- Cartesia - Speech and transcription
- Fish Audio - Speech and transcription
- Hume - Speech synthesis
- Rev.ai - Transcription with validated job polling
- Gladia - Transcription
- LMNT - Speech synthesis (Go-only)
Embeddings & Reranking
- Voyage - Embeddings and reranking models
Infrastructure & Tools
- AI Gateway - Unified multi-provider routing, failover, batch, video, realtime
- Vercel - OpenAI-compatible Vercel AI API (Go-only)
- OpenResponses - Open Responses API protocol (custom tools, QuiverAI's transport)
- OpenAI-compatible providers - shared request/response conventions
- TypeSafe AI - Evaluation models for
ai.ExperimentalEvaluate - You.com - Search, research, and contents tools (not a model provider) (Go-only)
Quick Start
1. Install the SDK
go get github.com/digitallysavvy/go-ai
2. Choose a Provider
import (
"github.com/digitallysavvy/go-ai/pkg/ai"
"github.com/digitallysavvy/go-ai/pkg/providers/openai"
)
provider := openai.New(openai.Config{
APIKey: os.Getenv("OPENAI_API_KEY"),
})
model, err := provider.LanguageModel("gpt-4")
3. Generate Text
result, err := ai.GenerateText(ctx, ai.GenerateTextOptions{Model: model, Prompt: "What is the Go-AI SDK?"})
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Text)
Provider Comparison
Language Models
| Provider | Best Models | Context Length | Streaming | Tools | Reasoning |
|---|---|---|---|---|---|
| OpenAI | GPT-4o, o1, o3 | 128K+ | Yes | Yes | Yes (o1/o3) |
| Anthropic | Claude Opus 4.5 | 200K | Yes | Yes | Yes |
| Gemini 2.0 Flash | 1M+ | Yes | Yes | Yes | |
| Alibaba | Qwen Max, QwQ | 32K | Yes | Yes | Yes (QwQ) |
| Groq | Llama 3.3 | 8K-128K | Yes | Yes | No |
| DeepSeek | DeepSeek-V3 | 64K | Yes | Yes | Yes |
Image & Video Generation
| Provider | Best Models | Speed | Quality | Features |
|---|---|---|---|---|
| Alibaba Cloud | Wan 2.6 | Medium | High | Text/Image/Reference-to-video |
| Stability AI | SDXL, SD3 | Fast | High | Flexible |
| Black Forest Labs | FLUX.1 Pro | Medium | Excellent | Photorealistic |
| FAL | FLUX, SD | Very Fast | High | Video support |
| Prodia | FLUX, SD | Very Fast | High | Image + video |
Speech & Audio
| Provider | Capability | Quality | Speed | Features |
|---|---|---|---|---|
| ElevenLabs | TTS | Excellent | Fast | Voice cloning |
| Deepgram | STT | Excellent | Real-time | Diarization |
| AssemblyAI | STT | Excellent | Fast | Summarization |
Provider Selection Guide
For Production Applications
Best Overall: OpenAI, Anthropic, Google
- Enterprise-grade reliability
- Excellent documentation
- Strong safety measures
For Cost-Effective Solutions
Best Value: Groq, Together AI, DeepInfra
- Lower pricing
- Good performance
- Open-source model access
For Specialized Tasks
Video Generation: KlingAI, Alibaba Cloud (Wan), FAL Image Generation: Stability AI, Black Forest Labs, FAL, Prodia, QuiverAI Speech Synthesis: ElevenLabs Transcription: Deepgram, AssemblyAI Fast Inference: Groq, Cerebras Local Deployment: Ollama Chinese Language: Alibaba Cloud (Qwen)
For Enterprise
Best Choice: Azure OpenAI, AWS Bedrock, Google Vertex AI
- Private deployment options
- Compliance features
- SLA guarantees
Configuration Patterns
Environment Variables
provider := openai.New(openai.Config{
APIKey: os.Getenv("OPENAI_API_KEY"),
})
Custom Base URL
provider := openai.New(openai.Config{
APIKey: os.Getenv("API_KEY"),
BaseURL: "https://custom-endpoint.com/v1",
})
Regional Configuration
provider, err := azure.New(azure.Config{
ResourceName: os.Getenv("AZURE_RESOURCE_NAME"),
APIKey: os.Getenv("AZURE_API_KEY"),
UseDeploymentBasedURLs: true,
})
if err != nil {
log.Fatal(err)
}
Common Features
Streaming
All major providers support streaming responses:
stream, err := ai.StreamText(ctx, ai.StreamTextOptions{Model: model, Prompt: "Write a story"})
for chunk := range stream.Chunks() {
fmt.Print(chunk.Text)
}
Tool Calling
Most providers support function calling:
result, err := ai.GenerateText(ctx, ai.GenerateTextOptions{
Model: model,
Prompt: "What's the weather?",
Tools: []types.Tool{weatherTool},
StopWhen: []ai.StopCondition{ai.IsStepCount(5)},
})
Structured Output
Generate JSON conforming to a schema:
personSchema := schema.NewSimpleJSONSchema(map[string]interface{}{
"type": "object",
"properties": map[string]interface{}{
"name": map[string]string{"type": "string"},
"age": map[string]string{"type": "number"},
},
"required": []string{"name", "age"},
})
result, err := ai.GenerateObject(ctx, ai.GenerateObjectOptions{
Model: model,
Schema: personSchema,
Prompt: "Describe a person",
})
Error Handling
Rate Limits
result, err := ai.GenerateText(ctx, ai.GenerateTextOptions{
Model: model,
Prompt: prompt,
})
if err != nil {
var providerErr *providererrors.ProviderError
if errors.As(err, &providerErr) && providerErr.StatusCode == 429 {
time.Sleep(time.Second * 5)
// Retry
}
}
Provider-Specific Errors
Each provider has unique error codes and handling - see individual provider documentation.
Best Practices
- Use Environment Variables: Never hardcode API keys
- Handle Rate Limits: Implement exponential backoff
- Monitor Costs: Track token usage across providers
- Test Locally: Use Ollama for development
- Fallback Providers: Have backup providers configured
- Validate Models: Check model availability before deployment
Next Steps
- Explore the Overview Guide for detailed provider concepts
- Read individual provider documentation for specific features
- Check API Reference for complete API details
- Review Examples for implementation patterns