Skip to content

7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.

TypeScript

fix: update tests for /v1/models api

Tazrif Raim92879eb4f1bf
diff --git a/server/src/__tests__/routes/proxy-auto-model.test.ts b/server/src/__tests__/routes/proxy-auto-model.test.ts
index e456a1cb..f159e805 100644
--- a/server/src/__tests__/routes/proxy-auto-model.test.ts
+++ b/server/src/__tests__/routes/proxy-auto-model.test.ts
@@ -58,7 +58,7 @@ describe('Virtual "auto" model', () => {
});
it('lists "auto" as the first /v1/models entry', async () => {
- const { status, body } = await request(app, 'GET', '/v1/models');
+ const { status, body } = await request(app, 'GET', '/v1/models', undefined, authHeaders());
expect(status).toBe(200);
expect(body.object).toBe('list');
expect(body.data[0]).toMatchObject({
@@ -70,8 +70,16 @@ describe('Virtual "auto" model', () => {
expect(body.data.length).toBeGreaterThan(1);
});
+ it('fails when authentication is missing or wrong', async () => {
+ const { status: status1 } = await request(app, 'GET', '/v1/models');
+ expect(status1).toBe(401);
+
+ const { status: status2 } = await request(app, 'GET', '/v1/models', undefined, { Authorization: 'Bearer wrongkey' });
+ expect(status2).toBe(401);
+ });
+
it('returns unique model ids from /v1/models', async () => {
- const { status, body } = await request(app, 'GET', '/v1/models');
+ const { status, body } = await request(app, 'GET', '/v1/models', undefined, authHeaders());
expect(status).toBe(200);
const ids = body.data.map((model: { id: string }) => model.id);