allow running without openai api key env var
Browse files- src/proxy_lite/client.py +2 -1
src/proxy_lite/client.py
CHANGED
|
@@ -73,7 +73,7 @@ class BaseClient(BaseModel, ABC):
|
|
| 73 |
class OpenAIClientConfig(BaseClientConfig):
|
| 74 |
name: Literal["openai"] = "openai"
|
| 75 |
model_id: str = "gpt-4o"
|
| 76 |
-
api_key: str = os.environ
|
| 77 |
|
| 78 |
|
| 79 |
class OpenAIClient(BaseClient):
|
|
@@ -137,6 +137,7 @@ class ConvergenceClient(OpenAIClient):
|
|
| 137 |
@cached_property
|
| 138 |
def external_client(self) -> AsyncOpenAI:
|
| 139 |
return AsyncOpenAI(
|
|
|
|
| 140 |
base_url=self.config.api_base,
|
| 141 |
http_client=self.http_client,
|
| 142 |
)
|
|
|
|
| 73 |
class OpenAIClientConfig(BaseClientConfig):
|
| 74 |
name: Literal["openai"] = "openai"
|
| 75 |
model_id: str = "gpt-4o"
|
| 76 |
+
api_key: str = os.environ.get("OPENAI_API_KEY")
|
| 77 |
|
| 78 |
|
| 79 |
class OpenAIClient(BaseClient):
|
|
|
|
| 137 |
@cached_property
|
| 138 |
def external_client(self) -> AsyncOpenAI:
|
| 139 |
return AsyncOpenAI(
|
| 140 |
+
api_key=self.config.api_key,
|
| 141 |
base_url=self.config.api_base,
|
| 142 |
http_client=self.http_client,
|
| 143 |
)
|