Unable to use API: `AuthenticationError: No such organization`

I am unable to use the OpenAI API with my organization ID. Whenever I try to use it, I get the error: openai.error.AuthenticationError: No such organization:

Here is my code with the organization ID removed:

import os
import openai
from dotenv import load_dotenv


openai.organization = "[ORG-ID REDACTED]"
openai.api_key = os.getenv("OPENAI_API_KEY")

completion = openai.ChatCompletion.create(
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who won the world series in 2020?"},
        {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
        {"role": "user", "content": "Where was it played?"}


Make sure that the OpenAI API key used has the appropriate permissions to access the organization. You can check this in the OpenAI dashboard under the “API Keys” section.

Assuming that you already double-check the Org ID and it is correct and belongs to the organization.

If the issue persists, you may want to contact OpenAI support for further assistance.

Welcome to the community @ty

If you’re not a member of multiple orgs, you shouldn’t be using the organization header.

If you are, you can:

  • change your organisation using the user drop down the top right of the page and create a new API key from there.
  • Specify the default org to use with the API keys and not use the org header
1 Like