Skip to content

Error: Incorrect API key #2

@Couscous2terter

Description

@Couscous2terter

Whenever I put my OpenAI API key, I get the following error (see below). I tried different API keys, but I still get the same error each time. Do you know what could be the problem ?

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 162, in script
    python:
  File "game/script.rpy", line 178, in <module>
    messages = chatgpt.completion(messages,apikey)
Exception: Error: 401, {
    "error": {
        "message": "Incorrect API key provided: sk-svcac****************************************************r-IL. You can find your API key at https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": "invalid_api_key"
    }
}


-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 162, in script
    python:
  File "C:\Users\macha\Desktop\Renpy\renpy\ast.py", line 834, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\macha\Desktop\Renpy\renpy\python.py", line 1187, in py_exec_bytecode
    exec(bytecode, globals, locals)
  File "game/script.rpy", line 178, in <module>
    messages = chatgpt.completion(messages,apikey)
  File "python-packages/chatgpt/__init__.py", line 38, in completion
Exception: Error: 401, {
    "error": {
        "message": "Incorrect API key provided: sk-svcac****************************************************r-IL. You can find your API key at https://platform.openai.com/account/api-keys.",
        "type": "invalid_request_error",
        "param": null,
        "code": "invalid_api_key"
    }
}


Windows-10-10.0.26100 AMD64
Ren'Py 8.3.7.25031702
Ren'Py Tutorial Game Ren'Py 8.3.7.25031702
Sun Jun  1 16:15:50 2025

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions