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

Proxy through server #37

Open
aehlke opened this issue Mar 2, 2023 · 5 comments
Open

Proxy through server #37

aehlke opened this issue Mar 2, 2023 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@aehlke
Copy link

aehlke commented Mar 2, 2023

Describe the feature or improvement you're requesting

I want to meter users by proxying requests through my server, but I still want to use your nice interface to the API instead of creating a new one for the server interaction. So I'd love to be able to send the requests to a custom hostname or base URL, without needing an API key and then I can ship this to iOS apps too.

Additional context

No response

@MarcoDotIO
Copy link
Member

So more or less a way of changing the base URL used for the API? I can add in a parameter to change out the URL for proxies, as long as your own proxy has the same mechanisms of handling traffic from and to the app.

@MarcoDotIO MarcoDotIO self-assigned this Mar 2, 2023
@MarcoDotIO MarcoDotIO added the enhancement New feature or request label Mar 2, 2023
@aehlke
Copy link
Author

aehlke commented Mar 2, 2023

Thanks for the reply. I've read through more of your source and think the ideal for my use case at least would be to be able to swap in both a custom base URL as well as a custom "base API client" so that I can use my own server's auth schemes.

In my case I generate OpenAPI clients for my server via openapi-generator using URLTask async/await in swift5. I'm thinking how best to abstract OpenAI.swift in this project to allow swapping in alternative API clients for users who already have something working for server auth or other network/header needs for delivering the request payload. Maybe define a protocol and let the user swap in something that bridges to the user's API client library to the payload you want to deliver

@MarcoDotIO
Copy link
Member

Thanks for the reply. I've read through more of your source and think the ideal for my use case at least would be to be able to swap in both a custom base URL as well as a custom "base API client" so that I can use my own server's auth schemes.

In my case I generate OpenAPI clients for my server via openapi-generator using URLTask async/await in swift5. I'm thinking how best to abstract OpenAI.swift in this project to allow swapping in alternative API clients for users who already have something working for server auth or other network/header needs for delivering the request payload. Maybe define a protocol and let the user swap in something that bridges to the user's API client library to the payload you want to deliver

I'll create a branch for this repo, and I will let you try it out to see if it fits within your requirements. Once a decision is a made, I'll go ahead and release the feature for my next version that'll include Whisper's endpoints.

@aehlke
Copy link
Author

aehlke commented Mar 3, 2023

Thank you, happy to give feedback. For now I've forked to meet my needs but didn't find a nice way to contribute something back upstream, so it's great if you have a better way in mind.

@MarcoDotIO
Copy link
Member

Heyo,

It's a pleasure to have you suggest the feature in the first place. I'd be more than happy to see how your own implementation went. I do agree that having a more advanced feature for proxy servers would be beneficial for this project. Let me know if you're interested in publishing a PR or just willing to share your own code.

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

No branches or pull requests

2 participants