Official Go SDK for Zaguán CoreX - The enterprise AI gateway that unifies access to 15+ AI providers through a single, elegant API. With Zaguán, you can seamlessly switch between OpenAI, Anthropic, Google, DeepSeek, Groq, Perplexity, xAI, and more without changing your code.
✅ Production Ready (v0.2.0): Major quality improvements with 63% test coverage (221 tests), zero security vulnerabilities, zero code quality issues, comprehensive input validation, and race-free concurrent code. Quality Grade: A-
One API, Every AI Provider - Stop managing multiple SDKs and API keys. Zaguán provides a unified interface to all major AI providers.
Zaguán CoreX eliminates vendor lock-in and optimizes costs while unlocking advanced capabilities:
Drop-in replacement for the OpenAI SDK with familiar interfaces and minimal code changes.
First-class support for Claude's Messages API with extended thinking and prompt caching.
Access 15+ providers: OpenAI, Anthropic, Google, DeepSeek, Groq, Perplexity, xAI, and more.
Full type safety with comprehensive Go structs and compile-time checks.
Efficient SSE streaming for real-time responses with idiomatic Go channels.
Built-in usage monitoring and billing insights with credit-based billing.
Native support for reasoning tokens, prompt caching, and provider-specific features.
Idiomatic use of context.Context for cancellation and timeouts.
Structured errors, logging interface, request IDs, and observability built-in.
221 comprehensive tests covering all major functionality with mock servers and edge cases.
All 7 gosec security warnings fixed. Production-ready security posture.
All 3 staticcheck warnings resolved. Clean, maintainable codebase.
Verified with Go's race detector. Safe for production concurrent workloads.
go get github.com/ZaguanLabs/zaguan-sdk-go/sdkpackage main
import (
"context"
"fmt"
"log"
zaguansdk "github.com/ZaguanLabs/zaguan-sdk-go/sdk"
)
func main() {
// Create a client
client := zaguansdk.NewClient(zaguansdk.Config{
BaseURL: "https://api.zaguanai.com",
APIKey: "your-api-key",
})
// Chat completion (OpenAI style)
resp, err := client.Chat(context.Background(), zaguansdk.ChatRequest{
Model: "openai/gpt-4o",
Messages: []zaguansdk.Message{
{Role: "user", Content: "Hello, world!"},
},
}, nil)
if err != nil {
log.Fatal(err)
}
fmt.Println(resp.Choices[0].Message.Content)
}// Streaming chat completion
stream, err := client.ChatStream(context.Background(), zaguansdk.ChatRequest{
Model: "openai/gpt-4o",
Messages: []zaguansdk.Message{
{Role: "user", Content: "Tell me a story"},
},
}, nil)
if err != nil {
log.Fatal(err)
}
defer stream.Close()
// Process streaming chunks
for {
chunk, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
log.Fatal(err)
}
fmt.Print(chunk.Choices[0].Delta.Content)
}Access any of the 15+ supported AI providers with a simple model name change:
// OpenAI
openaiResp, _ := client.Chat(ctx, zaguansdk.ChatRequest{
Model: "openai/gpt-4o",
Messages: []zaguansdk.Message{{Role: "user", Content: "Hello!"}},
}, nil)
// Anthropic
anthropicResp, _ := client.Chat(ctx, zaguansdk.ChatRequest{
Model: "anthropic/claude-3-5-sonnet",
Messages: []zaguansdk.Message{{Role: "user", Content: "Hello!"}},
}, nil)
// Google Gemini
googleResp, _ := client.Chat(ctx, zaguansdk.ChatRequest{
Model: "google/gemini-2.0-flash",
Messages: []zaguansdk.Message{{Role: "user", Content: "Hello!"}},
}, nil)Zaguán CoreX supports 18+ AI providers with 500+ models:
Contributions are welcome! Whether it's bug reports, feature requests, or pull requests, we appreciate all forms of contribution.
Apache 2.0 Licensed - The Zaguán SDK for Go is free and open source software. You're welcome to use, modify, and distribute it for any purpose.