OpenInterpreter / 01

The #1 open-source voice interface for desktop, mobile, and ESP32 chips.
https://01.openinterpreter.com/
GNU Affero General Public License v3.0
4.92k stars 517 forks source link

How to change openai's apikey settings #270

Open rwmjhb opened 4 months ago

rwmjhb commented 4 months ago

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):

mitstastic commented 4 months ago

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 commented 4 months ago

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.