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("YOUR_TOKENREX_API_KEY")
cfg.BaseURL = "https://tokenrex.ai/api/public/v1"
client := openai.NewClientWithConfig(cfg)

Build this with TokenRex

TokenRex is an LLM marketplace by Asirex Labs. Choose an enabled model, create a private API key and use the supported endpoint shown in Docs. Check live prices before your first request.