We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent df68932 commit 8fcf8c9Copy full SHA for 8fcf8c9
pydantic_ai_slim/pydantic_ai/models/openai.py
@@ -119,9 +119,9 @@ def __init__(
119
"""
120
self._model_name = model_name
121
# This is a workaround for the OpenAI client requiring an API key, whilst locally served,
122
- # openai compatible models do not always need an API key.
+ # openai compatible models do not always need an API key, but a placeholder (non-empty) key is required.
123
if api_key is None and 'OPENAI_API_KEY' not in os.environ and base_url is not None and openai_client is None:
124
- api_key = ''
+ api_key = 'api-key-not-set'
125
126
if openai_client is not None:
127
assert http_client is None, 'Cannot provide both `openai_client` and `http_client`'
0 commit comments