diff --git a/README.md b/README.md index 4419c0e..19aea89 100644 --- a/README.md +++ b/README.md @@ -115,7 +115,7 @@ codescanai --provider custom --host http://localhost --port 5000 --token your_to Using locally running [Ollama](https://github.com/ollama/ollama): ```bash -codescanai --provider custom --model llama3 --host http://localhost --port 11434 --endpoint /api/generate --directory path/to/code +codescanai --provider custom --model llama3 --host http://localhost --port 11434 --endpoint /v1 --directory path/to/code ``` ### Supported arguments diff --git a/core/code_scanner/agent_scanner.py b/core/code_scanner/agent_scanner.py index eedc176..90368d6 100644 --- a/core/code_scanner/agent_scanner.py +++ b/core/code_scanner/agent_scanner.py @@ -41,8 +41,9 @@ def __init__(self, args) -> None: if args.endpoint: host_url += args.endpoint os.environ["OPENAI_BASE_URL"] = host_url - if args.token: - os.environ["OPENAI_API_KEY"] = args.token + # The OpenAI SDK requires a non-empty API key even for local servers that + # don't authenticate. Fall back to a dummy value when no token is supplied. + os.environ["OPENAI_API_KEY"] = args.token if args.token else "dummy" self.agent = create_agent( model_str=model_str,