Skip to content

fix(models): honor custom_openai metadata during environment validation#5352

Open
rodboev wants to merge 2 commits into
Aider-AI:mainfrom
rodboev:pr/custom-openai-env-validation
Open

fix(models): honor custom_openai metadata during environment validation#5352
rodboev wants to merge 2 commits into
Aider-AI:mainfrom
rodboev:pr/custom-openai-env-validation

Conversation

@rodboev

@rodboev rodboev commented Jun 29, 2026

Copy link
Copy Markdown

Current Model.validate_environment() still lets metadata-backed custom_openai/<model> names fall through LiteLLM environment validation, so aider can report a missing OPENAI_API_KEY even when the model metadata already declares litellm_provider: custom_openai.

This keeps the fix in aider/models.py: metadata-declared custom_openai models stop forcing aider-side API-key validation, while every non-custom provider stays on the existing fast path, LiteLLM validation, AWS_PROFILE adjustment, and provider-specific checks. A prefix-only custom_openai/ name still does not bypass validation.

Closes #4955

Tests:

  • python -m pytest tests/basic/test_models.py -k "custom_openai_metadata_bypasses_litellm_validation or non_custom_metadata_still_uses_litellm_validation" -v
  • python -m pytest tests/basic/test_aws_credentials.py -v
  • pre-commit run --all-files

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.

Aider does not ignore API KEY when using custom_openai provider from litellm

1 participant