Fabric | My OpenAI API Key

I am trying to use fabric by Daniel Miessler from GitHub with my OpenAI API key, but I keep getting a “401 Unauthorized” error. Here is the detailed error message:

Error: Client error ‘401 Unauthorized’ for url ‘API OPENAI COM V1 MODELS Link’

When running the following command:

yt --transcript [some YouTube video link] | fabric --pattern summarize

I encounter the same “401 Unauthorized” error along with a traceback ending in BrokenPipeError: [Errno 32] Broken pipe.

Please don’t tell me to check the API Key.

How do I fix this?

1 Like

The above is a very odd error.

The API call to get a listing of models that you have access to would be:

GET https://api.openai.com/v1/models

Either the error is reporting a gross distortion of what is being sent, or you are not sending to a valid address.

Getting models is its own command line method, but it could be automatically invoked if you haven’t setup or specified a model or endpoint.

to start, looking at the repo, the configuration has environment variables:

export OPENAI_BASE_URL=https://YOUR-SERVER:8000/v1/

and a setup that must be run.

    config_patterns_directory = os.path.join(config, "patterns")
    config_context = os.path.join(config, "context.md")
    env_file = os.path.join(config, ".env")
    if not os.path.exists(config):
    if args.setup:
    if not os.path.exists(env_file) or not os.path.exists(config_patterns_directory):
        print("Please run --setup to set up your API key and download patterns.")

Where you’ll be needing to configure how it connects and the model.

The whole thing is just a prompt library. Doing things you can just ask ChatGPT.

You fix it by following readme, I would guess.

1 Like

Links are not allowed in my post; I manually typed some filler for the URL you have listed.

I’m still having trouble with fabric accessing my OpenAI API Key. It was deleted; however, I created a new secret key from the Project API keys page.

Selected ‘Owned by: You’

Created a Name

Assigned to Project

Permissions: All

Create secret key

Saved my key and copied it to the fabric --setup OpenAI API Key input

The input or output tokens must be reduced now.

Error: Error code: 429 - {‘error’: {‘message’: ‘Request too large for gpt-4-turbo-preview in organization APIKEY on tokens per min (TPM): Limit 30000, Requested 30577. The input or output tokens must be reduced in order to run successfully. Visit https://platform.openai.com/account/rate-limits to learn more.’, ‘type’: ‘tokens’, ‘param’: None, ‘code’: ‘rate_limit_exceeded’}}

How come there’s not a free trial?

gpt-4-1106-vision-preview looks like the place to be.

If the API key was automatically deleted, it’s because you are leaking it with your code or application and it was detected in a public place by OpenAI.

1 Like

I was having the same issue @michael.e Were you able to resolve it using env configs?