A comprehensive Go SDK for the Mistral AI API with 100% feature parity with the official Python SDK (v2.4.9). Realtime audio uses nhooyr.io/websocket; the rest of the SDK remains standard-library based for maximum compatibility, security, and performance.
๐ v2.4.9 Released: Python SDK v2.4.9 compatibility with realtime audio transcription over WebSocket, RAG search indexes, connector activation, batch deletion, workflow schedule and bulk helpers, guardrails, prompt cache keys, built-in tools, and JSON schema response formats.
๐ง v2.0.1 Critical Fix: Added User-Agent header to all HTTP requests to prevent Cloudflare 400 errors. This resolves issues when using the SDK directly or through proxies/gateways.
Complete parity with Mistral Python SDK v2.4.9. Latest REST endpoints, request shapes, and generated endpoint groups are implemented.
Realtime audio uses nhooyr.io/websocket; the rest of the SDK remains standard-library based.
Full-featured chat with streaming, tool calling, and all advanced parameters.
Document processing with OCR and speech-to-text transcription with timestamps.
Complete file management and fine-tuning API for custom model training.
Conversations, Libraries, Documents, Accesses, and Mistral Agents APIs.
Comprehensive test suite covering all major functionality and edge cases.
Zero security vulnerabilities. Comprehensive security audit passed.
All 12 Mistral AI APIs fully implemented with 100+ methods:
go get github.com/ZaguanLabs/mistral-go/v2/sdkpackage main
import (
"context"
"fmt"
"log"
"github.com/ZaguanLabs/mistral-go/v2/sdk"
)
func main() {
client := sdk.NewClient("your-api-key")
response, err := client.Chat(context.Background(), &sdk.ChatRequest{
Model: "mistral-large-latest",
Messages: []sdk.Message{
{Role: "user", Content: "Hello, Mistral!"},
},
})
if err != nil {
log.Fatal(err)
}
fmt.Println(response.Choices[0].Message.Content)
}stream, err := client.ChatStream(context.Background(), &sdk.ChatRequest{
Model: "mistral-large-latest",
Messages: []sdk.Message{
{Role: "user", Content: "Tell me a story"},
},
})
if err != nil {
log.Fatal(err)
}
defer stream.Close()
for {
chunk, err := stream.Recv()
if err == io.EOF {
break
}
if err != nil {
log.Fatal(err)
}
fmt.Print(chunk.Choices[0].Delta.Content)
}Major milestone release achieving 100% feature parity with the official Mistral Python SDK!
See the full CHANGELOG.md for complete details.
Huge thanks to Gage Technologies for creating the initial version of this SDK! ๐
This project builds upon their excellent foundation from the original repository. We're grateful for their pioneering work in bringing Mistral AI capabilities to the Go ecosystem.
MIT Licensed- The Mistral Go SDK is free and open source software. You're welcome to use, modify, and distribute it for any purpose.