gptel icon indicating copy to clipboard operation
gptel copied to clipboard

Support for request-functions

Open joergdw opened this issue 1 year ago • 1 comments

I have a case where I, instead of setting gptel-api-key, would rather like to provide a function that performs requests for given data, request-method and some headers. I think this is more secure as this extension then does not need to know a secret. And it is more flexible, when you have some non-standard API-authentication-mechanisms.

Would that be possible to add something suitable?

joergdw avatar Aug 05 '24 14:08 joergdw

I'm not sure what you're asking for. gptel-api-key can be set to a function that returns the key instead of the key. Similarly, the :key field for custom gptel backends can be set to a function. This is the recommended approach in the README.

To send a bespoke request with more control than gptel-send, check gptel-request and the wiki.

karthink avatar Aug 10 '24 03:08 karthink