All posts
Build a chatbot in Go
Tutorials 9 min read· Aug 12, 2026· By Tutorials

Build a chatbot in Go

Go standard library + go-openai client, wired to TokenRex.

go-openai supports a custom base URL via ClientConfig. Streaming works through channels.

go
cfg := openai.DefaultConfig("sk-tb-...")
cfg.BaseURL = "https://tokenrex.ai/api/public"
client := openai.NewClientWithConfig(cfg)

Ready to build?

Grab a key, keep your OpenAI SDK, and pay only for what you use.

Start free