karthink / gptel

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

I get wrong-type-argument lisp error when querying ChatGTP #37

Closed boina closed 1 year ago

boina commented 1 year ago

I installed gptel package from MELPA. It's the latest version as far as I can tell (20230407.32). I'm using with a free openai account. I'm not sure if this package works with the free account.

When I send a query I get the following error:

Debugger entered--Lisp error: (wrong-type-argument integer-or-marker-p nil)
  make-overlay(38 nil)
  pulse-momentary-highlight-region(38 nil)
  gptel-curl--stream-cleanup(#<process gptel-curl> "finished\n")

In the message buffer I have this output:

gptel-curl--sentinel
Send your query with C-c RET!
Mark set
Querying ChatGPT...
HTTP/2 429: Could not parse HTTP response.
Entering debugger...
Mark set

I also evaluated the function in https://github.com/karthink/gptel/issues/10#issuecomment-1463617391 and go this output:

HTTP/2 429 
date: Sat, 08 Apr 2023 11:20:35 GMT
content-type: application/json; charset=utf-8
content-length: 206
vary: Origin
x-request-id: 1d3db88ff14cfd42943bbb25cbafa753
strict-transport-security: max-age=15724800; includeSubDomains
cf-cache-status: DYNAMIC
server: cloudflare
cf-ray: 7b4a1f350d0f194a-BCN
alt-svc: h3=":443"; ma=86400, h3-29=":443"; ma=86400

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}
(a0ea421e57ee8e0ec12316d692184b48 . 376)

I'm running emacs 28.2 in Archlinux. curl version is 8.0.1 Although it says my quota is over I couldn't make it work a single time. Also, I'm not sure it's relevant but when I check my keys in the openai website I see that my keys were never used.

José.

karthink commented 1 year ago

There are two issues here.

  1. gptel is not capturing/displaying the quota error correctly.
  2. You're not able to use your API key to get a response from OpenAI.

I'll address 1 soon.

For 2, I'm not sure what's going on -- many users have confirmed that gptel works with a free account. Could you try (setq gptel-stream nil) and try, just to be sure?

karthink commented 1 year ago

I just pushed a fix (1cd0f585) that should address the wrong-type-argument error.

boina commented 1 year ago

I installed the latest version with the fix for wrong-type-argument.

When I set gptel-stream to nil and send a query to chatGTP I get this:

ChatGPT error: You exceeded your current quota, please check your plan and billing details.

and when I set gptel-stream to 1 I get this other message:

ChatGPT error (HTTP/2 429): Could not parse HTTP response.

Also,

1) just in case some other setting from my init file could be causing some trouble I tried in a vanilla emacs but got the same error. 2) Another thing I tried is to intentionally set a wrong api key. And I get the same error.

karthink commented 1 year ago

and when I set gptel-stream to 1 I get this other message:

ChatGPT error (HTTP/2 429): Could not parse HTTP response.

Hmm, the error message is still wrong. To be clear, gptel itself no longer throws an error, correct?

karthink commented 1 year ago
  1. gptel is not capturing/displaying the quota error correctly.

The error should now be identified correctly and consistently (36051b15).

boina commented 1 year ago

I have tried with a brand new account (I had my own from openai before chatGPT was around) and now it works. So the problem is not the gptel package, is my account. The insufficient quota message is correct then although I don't know why. I will see if I can get an answer from openai.

Thanks for the help anyway.

fosskers commented 1 year ago

I'm also currently suffering from this. Specifically, the claim that my quota is exceeded even though I've never used the API keys.

EDIT: Ah.

expired

Note also:

included

karthink commented 1 year ago

Could you provide some more detail? What error exactly do you mean?

Also, could you run

(setq gptel--debug t)

and retry? A buffer should pop up with the response from ChatGPT. That should have more information.

fosskers commented 1 year ago

I see this in my *Messages* buffer:

ChatGPT error: (HTTP/2 429) You exceeded your current quota, please check your plan and billing details.

The corresponding JSON from the debug output is:

{
    "error": {
        "message": "You exceeded your current quota, please check your plan and billing details.",
        "type": "insufficient_quota",
        "param": null,
        "code": null
    }
}
karthink commented 1 year ago

@fosskers This isn't a gptel bug -- I'd check on the OpenAI account webpage.

fosskers commented 1 year ago

I added a credit card, changed the model to GPT4, and now it seems to be working. Thanks!