joshcho / ChatGPT.el

ChatGPT in Emacs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for ChatGPT API

jimeh opened this issue · comments

I think at this point it would be nice to create a dedicated "low-level" SDK for all of the openai APIs, including embeddings or completions which are super useful. We can then build various "front-end" UI tools for emacs, such as

  • make this function prettier
  • replace recursion with loop
  • write a docstring for thing-at-point
  • ...

The possibilities of having this on an emacs key binding are freaking wow.

How about creating an organization emacs-openai where we could gather all the AI tools for Emacs? I made this recently but it could be cleaned up and packaged as more general tool as well.

I will be working on incorporating the ChatGPT API over the next couple weekends. @Fuco1 makes some good points; a collaborated dedicated effort sounds appropriate.

The API looks exciting, but I believe it's worth keeping the current method of communicating with ChatGPT as an option after API support is added.

I'm mostly saying that because the API does require a paid account, and even when paying, the pricing is usage based compared to ChatGPT Plus which is a fixed monthly fee for what I at least assume is unlimited usage.

It's worth noting that the usage based pricing unless you are extreme customer is order of magnitude less expensive. With the usage-based scheme, the $20 gives you ten million tokens, which is 20 thousand pages of conversation. Hardly what you would ever use with the normal chat.

OTOH, the API does not actually implement the chatgpt as available on chat.openai.com. You would have to emulate the way they pass context and conversation history to the model, which I'm not sure is public knowledge.

You would have to emulate the way they pass context and conversation history to the model, which I'm not sure is public knowledge

According to the API docs, you can do this by sending the whole conversation in each POST request. I imagine this will increase the token cost of conversations considerably.

Actually, there is an organization https://github.com/emacs-openai which exists since january. It's a good place to develop a generic API package and some goodies.

I'm creating a generic API package for OpenAI. It already supports most of the requests, including ChatGPT. Feel free to try it out! :D

Indirectly supported via chatgpt-wrapper, see c38c915