Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions hatchling/config/openai_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ class OpenAISettings(BaseModel):
)

api_base: str = Field(
default="https://api.openai.com/v1",
default_factory=lambda: os.environ.get("OPENAI_API_URL", "https://api.openai.com/v1"),
description="The base URL for OpenAI API requests.",
json_schema_extra={"access_level": SettingAccessLevel.READ_ONLY},
json_schema_extra={"access_level": SettingAccessLevel.PROTECTED},
)

timeout: int = Field(
Expand Down
2 changes: 1 addition & 1 deletion hatchling/core/llm/model_manager_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ async def _list_openai_models(settings: AppSettings) -> List[ModelInfo]:
# model listing requires different permissions and pricing

try:
client = AsyncOpenAI(api_key=settings.openai.api_key)
client = AsyncOpenAI(api_key=settings.openai.api_key, base_url=settings.openai.api_base)

models_response = await client.models.list()
models = []
Expand Down