Skip to Content

Go SDK

Use the Go SDK when your backend services are written in Go and you want governed AI calls with typed provider clients.

Install

go get github.com/keelapi/keel-go

Quick example

import "github.com/keelapi/keel-go/providers/openai" client := openai.NewClient(openai.Config{}) response, err := client.Chat.Completions.Create(ctx, openai.ChatCompletionParams{ Model: "gpt-4o", Messages: []openai.ChatCompletionMessage{ {Role: "user", Content: "Hello!"}, }, }) if err != nil { // handle error } fmt.Println(response.Choices[0].Message.Content)

The SDK evaluates governance before the provider call. If governance blocks the request, the wrapper returns an error before any provider call is made. The core Go client also exposes typed *keel.KeelError and *keel.ThrottledError values for API and throttle handling.

For provider wrappers, streaming, error handling, configuration, and the direct client reference, see SDKs.

Last updated on Edit this page on GitHub