gragland / chatgpt-chrome-extension

A ChatGPT Chrome extension. Integrates ChatGPT into every text box on the internet.
MIT License
2.83k stars 455 forks source link

ChatGPTError: ChatGPT error 404 after running node server.js #38

Open Nevaehni opened 1 year ago

Nevaehni commented 1 year ago

$ node --trace-warnings server.js

ChatGPTError: ChatGPT error 404: { "error": { "message": "That model does not exist", "type": "invalid_request_error", "param": null, "code": null } }

at file:///C:/Users/Admin/Desktop/chatgpt-extension/chatgpt-chrome-extension/node_modules/chatgpt/build/index.js:202:29
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {

statusCode: 404, statusText: 'Not Found', [cause]: Response {

[Symbol(state)]: {
  aborted: false,
  rangeRequested: false,
  timingAllowPassed: true,
  requestIncludesCredentials: true,
  type: 'default',
  status: 404,
  timingInfo: {
    startTime: 366.8491999998223,
    redirectStartTime: 0,
    redirectEndTime: 0,
    postRedirectStartTime: 366.8491999998223,
    finalServiceWorkerStartTime: 0,
    finalNetworkResponseStartTime: 0,
    finalNetworkRequestStartTime: 0,
    endTime: 0,
    encodedBodySize: 0,
    decodedBodySize: 0,
    finalConnectionTimingInfo: null
  },
  cacheState: '',
  statusText: 'Not Found',
  headersList: HeadersList {
    [Symbol(headers map)]: Map(7) {
      'date' => 'Thu, 16 Feb 2023 22:35:28 GMT',
      'content-type' => 'application/json; charset=utf-8',
      'content-length' => '158',
      'connection' => 'keep-alive',
      'vary' => 'Origin',
      'x-request-id' => '4482070b845f8d8f373759baf658719a',
      'strict-transport-security' => 'max-age=15724800; includeSubDomains'
    },
    [Symbol(headers map sorted)]: null
  },
  urlList: [
    <ref *1> URL {
      [Symbol(context)]: URLContext {
        flags: 400,
        scheme: 'https:',
        username: '',
        password: '',
        host: 'api.openai.com',
        port: null,
        path: [Array],
        query: null,
        fragment: null
      },
      [Symbol(query)]: URLSearchParams {
        [Symbol(query)]: [],
        [Symbol(context)]: [Circular *1]
      }
    }
  ],
  body: {
    stream: ReadableStream {
      [Symbol(kType)]: 'ReadableStream',
      [Symbol(kState)]: {
        disturbed: true,
        state: 'closed',
        storedError: undefined,
        stream: undefined,
        transfer: [Object],
        controller: [ReadableStreamDefaultController],
        reader: undefined
      },
      [Symbol(used)]: true
    }
  }
},
[Symbol(headers)]: Headers {
  [Symbol(headers list)]: HeadersList {
    [Symbol(headers map)]: Map(7) {
      'date' => 'Thu, 16 Feb 2023 22:35:28 GMT',
      'content-type' => 'application/json; charset=utf-8',
      'content-length' => '158',
      'connection' => 'keep-alive',
      'vary' => 'Origin',
      'x-request-id' => '4482070b845f8d8f373759baf658719a',
      'strict-transport-security' => 'max-age=15724800; includeSubDomains'
    },
    [Symbol(headers map sorted)]: null
  },
  [Symbol(guard)]: 'immutable',
  [Symbol(realm)]: null
}

} }

Node.js v18.8.0

giscafer commented 1 year ago

same error , if you can visit https://chat.openai.com/chat in your browser, i think this error is disapear

Nevaehni commented 1 year ago

I can visit that link, but the error still persists.

TonyLoveCoding commented 1 year ago

Check this issue https://github.com/gragland/chatgpt-chrome-extension/issues/31 AdamSiyala's advice can fix this 404 problem. At least it worked for me.

ajesuscode commented 1 year ago

You need to modify this part of code in server.js to write a correct model name const gptApi = new ChatGPTAPI({ apiKey: process.env.OPENAI_API_KEY, completionParams: { model: "text-davinci-003", top_p: 0.8, }, maxResponseTokens: 300, }); console.log(gptApi);

giscafer commented 1 year ago

@ajesuscode answer form the extension is diference of official https://github.com/gragland/chatgpt-chrome-extension/issues/40

sandeepscet commented 1 year ago

Able to solve by changing initialization in server.js, this is for free users who want to use without API Key. Reverse-proxy

import { ChatGPTUnofficialProxyAPI  } from "chatgpt";
const gptApi = new ChatGPTUnofficialProxyAPI ({
   accessToken: process.env.OPENAI_ACCESS_TOKEN,
    apiReverseProxyUrl: 'https://chat.duti.tech/api/conversation  '
});

Users can generate using this URL and add token into .env file

giscafer commented 1 year ago

Able to solve by changing initialization in server.js, this is for free users who want to use without API Key. Reverse-proxy

const gptApi = new ChatGPTUnofficialProxyAPI ({
   accessToken: process.env.OPENAI_ACCESS_TOKEN,
    apiReverseProxyUrl: 'https://chat.duti.tech/api/conversation  '
});

Users can generate using this URL and add token into .env file

whitch module is the ChatGPTUnofficialProxyAPI import from?

sandeepscet commented 1 year ago

import { ChatGPTUnofficialProxyAPI } from "chatgpt";

giscafer commented 1 year ago

Able to solve by changing initialization in server.js, this is for free users who want to use without API Key. Reverse-proxy

import { ChatGPTUnofficialProxyAPI  } from "chatgpt";
const gptApi = new ChatGPTUnofficialProxyAPI ({
   accessToken: process.env.OPENAI_ACCESS_TOKEN,
    apiReverseProxyUrl: 'https://chat.duti.tech/api/conversation  '
});

Users can generate using this URL and add token into .env file

v4.7.2 works

ajesuscode commented 1 year ago

@ajesuscode answer form the extension is diference of official #40

Didn't get it)) Can you explain widely))?

sbatam commented 1 year ago

Able to solve by changing initialization in server.js, this is for free users who want to use without API Key. Reverse-proxy

import { ChatGPTUnofficialProxyAPI  } from "chatgpt";
const gptApi = new ChatGPTUnofficialProxyAPI ({
   accessToken: process.env.OPENAI_ACCESS_TOKEN,
    apiReverseProxyUrl: 'https://chat.duti.tech/api/conversation  '
});

Users can generate using this URL and add token into .env file

It's not working for me, can you please explain a bit