Skip to content

Commit 8491555

Browse files
committed
Optimize the passing method for openai_base_url
1 parent bc68e14 commit 8491555

2 files changed

Lines changed: 1 addition & 3 deletions

File tree

stream_translator_gpt/common.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ def init(cls,
110110
key = key.strip()
111111
client = OpenAI(
112112
api_key=key,
113+
base_url=openai_base_url,
113114
default_headers={'User-Agent': f'stream-translator-gpt/{__version__}'},
114115
http_client=httpx.Client(proxy=proxy, verify=verify),
115116
)

stream_translator_gpt/main.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -235,9 +235,6 @@ class Config:
235235

236236
def run(config: Config):
237237
"""Run the transcription / translation pipeline until the input is exhausted."""
238-
if config.openai_base_url:
239-
os.environ['OPENAI_BASE_URL'] = config.openai_base_url
240-
241238
ClientPool.init(openai_api_key=config.openai_api_key,
242239
google_api_key=config.google_api_key,
243240
proxy=config.processing_proxy,

0 commit comments

Comments
 (0)