
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)