karthink / gptel

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

feature request: additional curl arguments #283

Open xeechou opened 2 months ago

xeechou commented 2 months ago

Hello, great package, however my proxy setup(out of my control) requires curl arguments like -k or --ssl-no-revoske to work. Would you be able to add additional user argument to curl. Thanks.

karthink commented 2 months ago

This is available via the :curl-args slot of a gptel backend definition.

For example:

(gptel-make-openai "ChatGPT-no-ssl-check"
   :key 'gptel-api-key
   :stream t
   :models '("gpt-3.5-turbo" "gpt-3.5-turbo-16k" "gpt-4"
             "gpt-4-turbo-preview" "gpt-4-32k" "gpt-4-1106-preview"
             "gpt-4-0125-preview")
   :curl-args '("--ssl-no-revoke" "-k"))

If you want this globally, you can add it to gptel-curl--common-args instead, which see.

xeechou commented 2 months ago

hi thanks. I can't change gptel-curl--common-args though. it's a constant.

karthink commented 2 months ago

hi thanks. I can't change gptel-curl--common-args though. it's a constant.

Does adding :curl-args to the backend definition not work for you?

karthink commented 2 months ago

On second thought I don't want to make gptel-curl--common-args customizable, since removing things from it will break gptel. I suggest adding :curl-args to the gptel backend you want to use.

For ChatGPT in particular, you can use the code I provided above, OR add it to the pre-defined backend using:

(setf (gptel-backend-curl-args gptel--openai)
      '("--ssl-no-revoke" "-k"))

For any other LLM provider you can add :curl-args to the setup code provided in the README.

xeechou commented 2 months ago

yes it did work with :curl-args however I have to add it to every backend I use..