Skip to content

Commit 7de8e88

Browse files
committed
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.
1 parent 4c5f7e6 commit 7de8e88

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

NEWS

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,15 @@
11
# -*- mode: org; -*-
22

3+
* 0.9.9
4+
5+
** New features and UI changes
6+
7+
- The new option ~gptel-curl-extra-args~ can be used to specify extra
8+
arguments to the Curl command used for the request. This is the
9+
global version of the gptel-backend-specific ~:curl-args~ slot,
10+
which can be used to specify Curl arguments when using a specific
11+
backend.
12+
313
* 0.9.8 2025-03-13
414

515
Version 0.9.8 adds support for new Gemini, Anthropic, OpenAI,
@@ -36,8 +46,7 @@ feature and control of LLM "reasoning" content.
3646

3747
- Add support for Perplexity. While gptel supported Perplexity in
3848
earlier releases by reusing its OpenAI support, there is now first
39-
class support for the Perplexity API, including citations. (This
40-
feature was added by @pirminj.)
49+
class support for the Perplexity API, including citations.
4150

4251
- Add support for DeepSeek. While gptel supported DeepSeek in earlier
4352
releases by reusing its OpenAI support, there is now first class

gptel-curl.el

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,20 @@
3838

3939
(declare-function gptel--stream-convert-markdown->org "gptel-org")
4040

41+
(defcustom gptel-curl-extra-args nil
42+
"Extra arguments to pass to Curl when sending queries.
43+
44+
This should be a list of strings, each one a Curl command line
45+
argument. Note that these should not conflict with the options
46+
in `gptel-curl--common-args', which gptel requires for correct
47+
functioning.
48+
49+
If you want to specify extra arguments only when using a specific
50+
gptel backend, use the `:curl-args' slot of the backend instead.
51+
See `gptel-backend'."
52+
:group 'gptel
53+
:type '(repeat string))
54+
4155
(defconst gptel-curl--common-args
4256
(if (memq system-type '(windows-nt ms-dos))
4357
'("--disable" "--location" "--silent" "-XPOST"
@@ -73,6 +87,7 @@ REQUEST-DATA is the data to send, TOKEN is a unique identifier."
7387
(gptel--log data-json "request body"))
7488
(append
7589
gptel-curl--common-args
90+
gptel-curl-extra-args
7691
(gptel-backend-curl-args gptel-backend)
7792
(list (format "-w(%s . %%{size_header})" token))
7893
(if (length< data-json gptel-curl-file-size-threshold)

0 commit comments

Comments
 (0)