Skip to Content
SDKsGo Reference

Go Reference Client

The Go package is Keel’s official generated/reference client. Use it when your Go service needs OpenAPI-derived bindings for Keel’s public API.

Go is not a first-class runtime wrapper SDK. The package does not maintain provider-specific wrappers, streaming helpers, custom retry/backoff policy, or custom error types.

Install

go get github.com/keelapi/keel-go

Package

Runtime API calls use the generated client package:

import keelclient "github.com/keelapi/keel-go/pkg/keelclient"

The repository root package is documentation-only.

Basic example

package main import ( "context" "log" "net/http" "os" keelclient "github.com/keelapi/keel-go/pkg/keelclient" ) func main() { client, err := keelclient.NewKeelHTTPClient( os.Getenv("KEEL_BASE_URL"), keelclient.WithRequestEditorFn(func(ctx context.Context, req *http.Request) error { req.Header.Set("Authorization", "Bearer "+os.Getenv("KEEL_API_KEY")) return nil }), ) if err != nil { log.Fatal(err) } resp, err := client.CreatePermitV1PermitsPost( context.Background(), nil, map[string]interface{}{ "project_id": os.Getenv("KEEL_PROJECT_ID"), "idempotency_key": "example-1", "subject": map[string]interface{}{ "type": "user", "id": "user-123", }, "action": map[string]interface{}{ "name": "generate.text", }, "resource": map[string]interface{}{ "type": "ai_model", "id": "gpt-4", "attributes": map[string]interface{}{ "provider": "openai", "model": "gpt-4", "operation": "generate.text", "estimated_input_tokens": 100, }, }, }, ) if err != nil { log.Fatal(err) } defer resp.Body.Close() }

The generated client returns standard *http.Response values. Callers own status handling, response decoding, retry policy, and transport configuration.

Regeneration

The canonical OpenAPI source is generated by keel-api and published as a public artifact. Regenerate the Go client from that OpenAPI contract in the keel-go repo with:

make generate
Last updated on Edit this page on GitHub