Skip to content

Skip OpenAI model registration when no API key is configured#1446

Open
antisilent wants to merge 4 commits into
simonw:mainfrom
antisilent:no-key-no-registration
Open

Skip OpenAI model registration when no API key is configured#1446
antisilent wants to merge 4 commits into
simonw:mainfrom
antisilent:no-key-no-registration

Conversation

@antisilent
Copy link
Copy Markdown

@antisilent antisilent commented May 15, 2026

Closes #1445.

Summary

  • register_models and register_embedding_models in the built-in OpenAI plugin now return early if no API key is found (via llm keys, keys.json, or OPENAI_API_KEY). If credentials are not configured, the plugin is invisible.
  • Test fixture (env_setup) now sets a dummy OPENAI_API_KEY so existing tests continue to work, and scrubs LLM_MODEL, LLM_EMBEDDING_MODEL, and LLM_EMBEDDINGS_DB to prevent host environment variables from leaking into tests.
  • Added test_openai_models_not_registered_without_key to cover the new behavior.

Test plan

  • uv run pytest passes (755 tests)
  • llm models shows no OpenAI models when OPENAI_API_KEY is unset and no key is stored
  • llm models shows OpenAI models normally once a key is configured

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

Successfully merging this pull request may close these issues.

register_models should skip model registration when no key is configured

1 participant