Docs / Recipes / Go

// LANGUAGE SDK · GO

Go — OpenAI-compatible base-URL swap

Pattern A · full governance

Use the official openai-go client (or any OpenAI-compatible client) and point it at the gateway. One option changes; the receipt comes back on the response.

Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the x-agentics-receipt response header.

Install

shell
go get github.com/openai/openai-go

Swap the base URL

Point your OpenAI-compatible Go client at https://agentics.you/api/v1 with your AGENTICS_API_KEY as the key. That is the only change.

Go
import ( "github.com/openai/openai-go" "github.com/openai/openai-go/option" ) client := openai.NewClient( option.WithBaseURL("https://agentics.you/api/v1"), // the only change option.WithAPIKey("ak_…"), // AGENTICS_API_KEY option.WithHeader("x-agentics-user", "alice@acme.com"), )

Run one call → see the receipt

No OpenAI-compatible library for your stack? A raw HTTP request works and returns the same header:

cURL
curl https://agentics.you/api/v1/chat/completions -i \ -H "Authorization: Bearer ak_…" \ -H "Content-Type: application/json" \ -H "x-agentics-user: alice@acme.com" \ -d '{"model":"@anthropic/claude-opus-4-8", "messages":[{"role":"user","content":"hi"}]}' # response header: x-agentics-receipt: <receipt_hash>