#502·go-openai

Add possability to create NewClient with custom endpoint (localhost)

Author: JackBekketCreated Sep 28, 2023Updated Aug 24, 2025
Labelsenhancement

Is your feature request related to a problem? Please describe. As of now, the openai chatGPT API in the sashabaranov/go-openai project only supports a hardcoded end-point. This limitation restricts the flexibility and customizability that users might require in certain scenarios.

Basically I have gpt4all working locally, and it has openai API compatible supported. Which means, if I could change endpoint of API to localhost -- I would able to use go-openai locally

Describe the solution you'd like I want to be able to use go-openai which can call custom end-point and not only openai.com

Let's say that go-openai.NewClient(api_key) can be called like go-openai.NewClient(api_key,api_endpoint)