Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base url #886

Open
ashish111333 opened this issue Oct 24, 2024 · 5 comments
Open

Base url #886

ashish111333 opened this issue Oct 24, 2024 · 5 comments

Comments

@ashish111333
Copy link

ashish111333 commented Oct 24, 2024

is it possible to change base Url for chat completion requests ?

@wcu1117
Copy link

wcu1117 commented Oct 28, 2024

i had the same error,when I set the proxyURL, are you finished it?

@stormeyes
Copy link

stormeyes commented Oct 28, 2024

same here.

@ashish111333
Copy link
Author

I have not tried it just wanted to ask if we can provide our own Base URL for Open Ai client. @wcu1117

@jeremylazarus
Copy link

Try this. I'm using a man-in-the-middle proxy to view my requests with this:

	// client := openai.NewClient(apiKey) // Default client
	// Custom client config
	config := openai.DefaultConfig(apiKey)
	config.BaseURL = "http://localhost:8500/v1"
	client := openai.NewClientWithConfig(config)

@wcu1117
Copy link

wcu1117 commented Oct 29, 2024

Try this. I'm using a man-in-the-middle proxy to view my requests with this:

	// client := openai.NewClient(apiKey) // Default client
	// Custom client config
	config := openai.DefaultConfig(apiKey)
	config.BaseURL = "http://localhost:8500/v1"
	client := openai.NewClientWithConfig(config)

Well, it works! But why can't I set the proxy like this?
transport := &http.Transport{ Proxy: http.ProxyURL(proxy), } //config.BaseURL = proxyUrl config.HTTPClient = &http.Client{ Transport: transport, } client := openai.NewClientWithConfig(config)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants