Skip to content

Authentication Error on Windows when using Claude models despite correct API key #1499

@umayado17

Description

@umayado17

Describe the bug

When running Open Interpreter on Windows with Claude models, it consistently throws an authentication error regardless of whether the API key is correctly set. This occurs both in regular mode and OS mode.

What Happens

  • The interpreter initially starts and recognizes Claude:
    • In OS mode, it shows: "Model set to Claude 3.5 Sonnet (New), OS control enabled"
  • However, when trying to interact with it, it always returns:
    An error occurred: Error code: 401 - {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'invalid x-api-key'}}
    

Reproduce

  1. Install Open Interpreter on Windows
  2. Set Anthropic API key using environment variable:
    setx ANTHROPIC_API_KEY your-api-key
    
    or directly in command:
    interpreter --api_key your-api-key
    
  3. Run either:
    interpreter
    
    or
    interpreter --os
    
  4. Try to interact with the interpreter

Expected behavior

The interpreter should properly authenticate with the Anthropic API when a valid API key is provided.

Screenshots

(.venv) PS C:\Users\hirao> interpreter --os
Welcome to Open Interpreter.
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
▌ Model set to Claude 3.5 Sonnet (New), OS control enabled
We recommend using our desktop app for the best experience. Type d for early access.
Warning: This AI has full system access and can modify files, install software, and execute commands. By continuing, you
accept all risks and responsibility.
Move your mouse to any corner of the screen to exit. Reduce display resolution for better performance.

Excelを開いて
An error occurred: Error code: 401 - {'type': 'error', 'error': {'type': 'authentication_error', 'message': 'invalid x-api-key'}}
Traceback (most recent call last):
File "", line 198, in runmodule_as_main
File "", line 88, in runcode
File "C:\Users\hirao.venv\Scripts\interpreter.exe\main.py", line 4, in
File "C:\Users\hirao.venv\Lib\site-packages\interpreter\init.py", line 54, in
run_async_main()
File "C:\Users\hirao.venv\Lib\site-packages\interpreter\computer_use\loop.py", line 520, in run_async_main
asyncio.run(main())
File "C:\Users\hirao\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 190, in run
return runner.run(main)
^^^^^^^^^^^^^^^^
File "C:\Users\hirao\AppData\Local\Programs\Python\Python311\Lib\asyncio\runners.py", line 118, in run
return self._loop.run_until_complete(task)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\hirao\AppData\Local\Programs\Python\Python311\Lib\asyncio\base_events.py", line 654, in run_until_complete
return future.result()
^^^^^^^^^^^^^^^
File "C:\Users\hirao.venv\Lib\site-packages\interpreter\computer_use\loop.py", line 463, in main
user_input = input("> ")
^^^^^^^^^^^
EOFError

Open Interpreter version

0.4.1

Python version

3.11

Operating System name and version

Windows 11

Additional context

Additional Notes

  • Installation Method: pip
  • The error occurs consistently regardless of how the API key is provided (environment variable or command line argument)
  • The initial recognition of Claude suggests that the model selection is working, but the authentication mechanism fails during actual interaction
  • The same API key works correctly with other tools/applications that use Anthropic's API

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions