Open meltingscales opened 11 months ago
This is intended behavior. To send no API key, use an empty string (""
).
This is intended behavior. To send no API key, use an empty string (
""
).
if you set it empty string you getting illegal header as above, I searched a lot, it turned that my server just accept any api key, as Beaver header, if I not setup authorisation. @meltingscales - may be your server too.
@rattrayalex Please reopen issue, and see what happens if you use an empty string: https://github.com/encode/httpx/issues/1640#issuecomment-842036339
LocalProtocolError: Illegal header value b'Bearer '
Need check empty case in this: https://github.com/openai/openai-python/blob/da48e4cac78d1d4ac749e2aa5cfd619fde1e6c68/src/openai/_client.py#L160
I created PR: https://github.com/openai/openai-python/pull/1594/files
Ah, thank you – you're correct that we should not send the Authorization
header when the api key is empty. We'll try to fix that soon.
Confirm this is an issue with the Python library and not an underlying OpenAI API
Describe the bug
Summary: When running "LM Studio" for local AI models, I cannot use the
openai
package to interact with the REST API, because it does not require an API key.Solution:
I was able to fix this by commenting out the below lines in
./openai/_client.py>OpenAI>__init__#L92
:To Reproduce
Reproduce:
Code snippets
No response
OS
Windows 10.0.22621 Build 22621
Python version
Python 3.12.0 | packaged by Anaconda, Inc. | (main, Oct 2 2023, 17:20:38) [MSC v.1916 64 bit (AMD64)] on win32
Library version
openai v1.3.8