Skip to content

LLM ChatOpenAI connection test failed. #566

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

Open
JAVazquez007 opened this issue May 5, 2025 · 1 comment
Open

LLM ChatOpenAI connection test failed. #566

JAVazquez007 opened this issue May 5, 2025 · 1 comment

Comments

@JAVazquez007
Copy link

Upon launching agent. verified key in .env via script.....

import openai
import os
from dotenv import load_dotenv

def test_api_key():
load_dotenv()
api_key = os.getenv("OPENAI_API_KEY")

if not api_key:
    print("❗ OPENAI_API_KEY not found in .env file.")
    return

client = openai.OpenAI(api_key=api_key)

try:
    print("Testing API key...")
    models = client.models.list()
    print(f"API key is valid. {len(models.data)} models available:\n")

    for model in models.data:
        print(f"- {model.id}")

except openai.AuthenticationError:
    print("❌ Invalid API key.")
except Exception as e:
    print(f"⚠️ An error occurred: {e}")

if name == "main":
test_api_key()


Result from script:

Testing API key...
API key is valid. 64 models available:

  • gpt-4o-audio-preview-2024-12-17
  • dall-e-3
  • dall-e-2
  • gpt-4o-audio-preview-2024-10-01
  • gpt-4-turbo-preview
  • text-embedding-3-small
  • gpt-4-1106-preview
  • gpt-4-turbo
  • gpt-4-turbo-2024-04-09
  • gpt-4.1-nano
  • gpt-4.1-nano-2025-04-14
  • gpt-4o-realtime-preview-2024-10-01
  • gpt-4o-realtime-preview
  • babbage-002
  • gpt-4....

Error from Browser-Use WebUI

INFO [src.webui.components.browser_use_agent_tab] Submit button clicked for new task.
INFO [src.webui.components.browser_use_agent_tab] Initializing LLM: Provider=openai, Model=gpt-4.1-nano-2025-04-14, Temp=0.6
INFO [src.webui.components.browser_use_agent_tab] Launching new browser instance.
INFO [src.webui.components.browser_use_agent_tab] Creating new browser context.
INFO [src.webui.components.browser_use_agent_tab] Initializing new agent for task: go to google.com and type 'openai" click search and return the first url
INFO [agent] 🧠 Starting an agent with main_model=gpt-4.1-nano-2025-04-14 +tools +vision +memory, planner_model=None, extraction_model=gpt-4.1-nano-2025-04-14
ERROR [agent]

❌ LLM ChatOpenAI connection test failed. Check that OPENAI_API_KEY is set correctly in .env and that the LLM API account has sufficient funding.

Connection error.

:241: DeprecationWarning: builtin type SwigPyPacked has no module attribute
:241: DeprecationWarning: builtin type SwigPyObject has no module attribute
:241: DeprecationWarning: builtin type swigvarlink has no module attribute
INFO [mem0.vector_stores.faiss] Loaded FAISS index from /home/jim/.mem0/migrations_faiss/mem0_migrations.faiss with 19 vectors
INFO [mem0.vector_stores.faiss] Inserted 1 vectors into collection mem0_migrations
INFO [agent] 🚀 Starting task: go to google.com and type 'openai" click search and return the first url
INFO [agent] 📍 Step 1
ERROR [agent] ❌ Result failed 1/3 times:

@vvincent1234
Copy link
Contributor

LLM ChatOpenAI connection test failed. Check that OPENAI_API_KEY is set correctly in .env and that the LLM API account has sufficient funding.

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