karthink / gptel

A simple LLM client for Emacs
GNU General Public License v3.0
1.06k stars 116 forks source link

Make API host configurable #67

Closed tshu-w closed 1 year ago

tshu-w commented 1 year ago

This is a similar PR to https://github.com/karthink/gptel/pull/49. I submitted a new PR because:

  1. @christianromney has not replied for a month
  2. The API key may also be related to the host for some API proxy services like https://aiproxy.io
  3. Most API proxies use the same basePath & Path as the OpenAI API, i.e. "/v1/chat/completions", so we only need to make the Host configurable.
karthink commented 1 year ago

Looks good, thank you!

It will be good to list some supported hosts/proxies in the README. Do you know of any? I haven't used any except openai.com so far.

karthink commented 1 year ago

Could you add these two things to the README:

  1. A note at the top about the breaking change (auth-source now looks for "api.openai.com" instead of "openai.com" by default)
  2. Examples of other API hosts supported by gptel now (in the new "Additional Configuration" section)
tshu-w commented 1 year ago

It will be good to list some supported hosts/proxies in the README. Do you know of any? I haven't used any except openai.com so far.

I'm not sure if it's appropriate to list in the README,

There are some projects on GitHub that convert Azure API to OpenAI API format (deployed by yourself, using Azure API KEY):

  1. https://github.com/stulzq/azure-openai-proxy
  2. https://github.com/diemus/azure-openai-proxy
  3. https://github.com/haibbo/cf-openai-azure-proxy

There are also projects that reverse proxy OpenAI API (deployed by yourself, using the OpenAI API KEY):

  1. https://github.com/janlay/openai-cloudflare
  2. https://github.com/x-dr/chatgptProxyAPI
  3. https://gist.github.com/noobnooc/d0407b5fb81cff9d36f981170b99d4e6

There are also services that proxy OpenAI API for unsupported countries or regions (no need to deploy, using a third-party paid KEY):

  1. https://aiproxy.io
  2. https://openai-sb.com
  3. https://chat-ai.logcg.com
karthink commented 1 year ago

Ah, okay, I misunderstood what the hostname is for. I assumed you could use it with the azure OpenAI API directly, for instance.

In that case please just add the mention of the breaking change to the top of the Readme and we can merge this.

tshu-w commented 1 year ago

Ah, okay, I misunderstood what the hostname is for. I assumed you could use it with the azure OpenAI API directly, for instance.

In that case please just add the mention of the breaking change to the top of the Readme and we can merge this.

I have submitted a new commit.

karthink commented 1 year ago

Cheers @tshu-w