Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to change openai's apikey settings #270

Open
rwmjhb opened this issue May 12, 2024 · 2 comments
Open

How to change openai's apikey settings #270

rwmjhb opened this issue May 12, 2024 · 2 comments

Comments

@rwmjhb
Copy link

rwmjhb commented May 12, 2024

Describe the bug
For some reasons, I couldn't get the apikey from openai's official website, so I registered openrouter.ai to get the apikey, but when I used openrouter's key to allow 01, the following error occurred. Maybe I need Change api_base code, how can I change this code?


yuki@YukideAir software % poetry run 01

Starting...

INFO: Started server process [73644]
INFO: Waiting for application startup.

Ready.

INFO: Application startup complete.
INFO: Uvicorn running on http://0.0.0.0:10001 (Press CTRL+C to quit)
This process is not trusted! Input event monitoring will not be possible until it is added to accessibility clients.
INFO: ('127.0.0.1', 50159) - "WebSocket /" [accepted]
INFO: connection open

Hold the spacebar to start recording. Press CTRL-C to exit.
INFO: 127.0.0.1:50172 - "GET / HTTP/1.1" 405 Method Not Allowed
INFO: 127.0.0.1:50172 - "GET /favicon.ico HTTP/1.1" 404 Not Found
Recording started...
Recording stopped.
Traceback (most recent call last):
File "/Users/yuki/Documents/01/software/source/server/server.py", line 264, in listener
text = stt(audio_file_path)
^^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Documents/01/software/source/server/services/stt/openai/stt.py", line 6, in stt
return stt(audio_file_path)
^^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Documents/01/software/source/server/services/stt/openai/stt.py", line 123, in stt
return stt_wav(input_data)
^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Documents/01/software/source/server/services/stt/openai/stt.py", line 111, in stt_wav
transcript = client.audio.transcriptions.create(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/resources/audio/transcriptions.py", line 115, in create
return self._post(
^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 1208, in post
return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 897, in request
return self._request(
^^^^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 935, in _request
return self._retry_request(
^^^^^^^^^^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 1021, in _retry_request
return self._request(
^^^^^^^^^^^^^^
File "/Users/yuki/Library/Caches/pypoetry/virtualenvs/01os-GY_JcNW2-py3.11/lib/python3.11/site-packages/openai/_base_client.py", line 988, in _request
raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'error': {'message': 'Incorrect API key provided: sk-or-v1*************************************************************c565. You can find your API key at https://platform.openai.com/account/api-keys.', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_api_key'}}


Desktop (please complete the following information):

  • OS: macbook air M2 14.1.2 (23B92)
  • Python Version 3.11
@mitstastic
Copy link

Check https://litellm.vercel.app/docs/providers/openrouter
You would likely need to first use the command "export OPENROUTER_API_KEY=your_open_router_key" and specify the domain with --server-host/--server-url in your terminal but it currently isn't clear if other providers are working atm in the 01's current branch

@rwmjhb
Copy link
Author

rwmjhb commented May 14, 2024

Check https://litellm.vercel.app/docs/providers/openrouter You would likely need to first use the command "export OPENROUTER_API_KEY=your_open_router_key" and specify the domain with --server-host/--server-url in your terminal but it currently isn't clear if other providers are working atm in the 01's current branch

OH,I found that your question exactly what I want to know!I'll follow it as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants