branch: elpa/gptel
commit 7de8e885c12865beb6d2ec8bf6698ce3b2ad4f7f
Author: Karthik Chikmagalur <karthikchikmaga...@gmail.com>
Commit: Karthik Chikmagalur <karthikchikmaga...@gmail.com>

    gptel-curl: Add gptel-curl-extra-args
    
    * gptel-curl.el (gptel-curl--get-args, gptel-curl-extra-args): Add
    a user option to specify additional Curl command line arguments
    for the request command.  This is the global version of the
    gptel-backend-specific :curl-args slot. (#283, #661)
    
    * NEWS: Update.
---
 NEWS          | 13 +++++++++++--
 gptel-curl.el | 15 +++++++++++++++
 2 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/NEWS b/NEWS
index 74ab005707..dda92bc0ee 100644
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,15 @@
 # -*- mode: org; -*-
 
+* 0.9.9
+
+** New features and UI changes
+
+- The new option ~gptel-curl-extra-args~ can be used to specify extra
+  arguments to the Curl command used for the request.  This is the
+  global version of the gptel-backend-specific ~:curl-args~ slot,
+  which can be used to specify Curl arguments when using a specific
+  backend.
+
 * 0.9.8 2025-03-13
 
 Version 0.9.8 adds support for new Gemini, Anthropic, OpenAI,
@@ -36,8 +46,7 @@ feature and control of LLM "reasoning" content.
 
 - Add support for Perplexity.  While gptel supported Perplexity in
   earlier releases by reusing its OpenAI support, there is now first
-  class support for the Perplexity API, including citations.  (This
-  feature was added by @pirminj.)
+  class support for the Perplexity API, including citations.
 
 - Add support for DeepSeek.  While gptel supported DeepSeek in earlier
   releases by reusing its OpenAI support, there is now first class
diff --git a/gptel-curl.el b/gptel-curl.el
index de6904fcf9..11ced1fbe4 100644
--- a/gptel-curl.el
+++ b/gptel-curl.el
@@ -38,6 +38,20 @@
 
 (declare-function gptel--stream-convert-markdown->org "gptel-org")
 
+(defcustom gptel-curl-extra-args nil
+  "Extra arguments to pass to Curl when sending queries.
+
+This should be a list of strings, each one a Curl command line
+argument.  Note that these should not conflict with the options
+in `gptel-curl--common-args', which gptel requires for correct
+functioning.
+
+If you want to specify extra arguments only when using a specific
+gptel backend, use the `:curl-args' slot of the backend instead.
+See `gptel-backend'."
+  :group 'gptel
+  :type '(repeat string))
+
 (defconst gptel-curl--common-args
   (if (memq system-type '(windows-nt ms-dos))
       '("--disable" "--location" "--silent" "-XPOST"
@@ -73,6 +87,7 @@ REQUEST-DATA is the data to send, TOKEN is a unique 
identifier."
       (gptel--log data-json "request body"))
     (append
      gptel-curl--common-args
+     gptel-curl-extra-args
      (gptel-backend-curl-args gptel-backend)
      (list (format "-w(%s . %%{size_header})" token))
      (if (length< data-json gptel-curl-file-size-threshold)

Reply via email to