lks-ai / anynode

A Node for ComfyUI that does what you ask it to do
MIT License
426 stars 27 forks source link

General question: how do I set up my OpenAI API Key #6

Open KannManMachen opened 1 month ago

KannManMachen commented 1 month ago

I think there are many people (including me) who are integrating an LLM into their ComfyUI workflow for the first time with the help of anynode. So please forgive this generic question about setting up the OpenAI API.

I have already generated a project API key, but now I don't know how to connect my portable ComfyUI version under Windows 11 with the API key. Can anyone give me a tip on how to proceed?

Would this be the right guide for this: https://platform.openai.com/docs/quickstart?context=python

Cheers :)

lks-ai commented 1 month ago

Yes, that guide is the official one. Get your API key that way.

Once you have it, you can follow this for Windows:

https://www.howtogeek.com/787217/how-to-edit-environment-variables-on-windows-10-or-11/

That explains it pretty well and you should be setting the variable name OPENAI_API_KEY and value set to the key you got from the first guide.

gonzalu commented 3 weeks ago

I always get errors:

{"model": "gpt-4o", "server": "", "api_key": "", "prompt": "Convert the image to high contrast B&W", "last_comment": null, "inputs": ["Type: <class 'torch.Tensor'>, Shape: (1, 1152, 896, 3), Dtype: torch.float32", "Type: <class 'NoneType'>"], "imports": [], "function": "An error occurred: Error code: 404 - {'error': {'message': 'The model `gpt-4o` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}", "last_error": null}

But my Environment is properly set:

image