Skip to content

Commit f2571b1

Browse files
committed
fix: Pass fake api_key to the internal ai model
1 parent e8e3379 commit f2571b1

1 file changed

Lines changed: 2 additions & 17 deletions

File tree

tests/ai_test_model.py

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,6 @@ async def create_model(s: TestLLMSettings) -> PredefinedModel:
3737
raise Exception("unreachable")
3838

3939

40-
class _InternalAIAuth(Auth):
41-
token: str
42-
43-
def __init__(self, token: str) -> None:
44-
self.token = token
45-
46-
@override
47-
def auth_flow(
48-
self, request: Request
49-
) -> collections.abc.Generator[Request, Response, None]:
50-
request.headers["api-key"] = self.token
51-
yield request
52-
53-
5440
class _TokenResponse(BaseModel):
5541
access_token: str
5642

@@ -79,14 +65,13 @@ async def _buildInternalAIModel(
7965

8066
token = _TokenResponse.model_validate_json(response.text).access_token
8167

82-
auth_handler = _InternalAIAuth(token)
8368
model = "gpt-5-nano"
8469

8570
return OpenAIModel(
8671
model=model,
8772
base_url=f"{base_url}/{model}",
88-
api_key="", # unused
73+
api_key="test-api-key", # unused
8974
extra_body={"user": f'{{"appkey":"{app_key}"}}'},
90-
httpx_client=httpx.AsyncClient(auth=auth_handler),
75+
httpx_client=httpx.AsyncClient(headers={"api-key": token}),
9176
temperature=0.0,
9277
)

0 commit comments

Comments
 (0)