feat: add OpenRouter API client with free model support

This commit is contained in:
2026-05-14 07:48:51 +02:00
parent 4206b93614
commit 5a99273c9d
2 changed files with 86 additions and 0 deletions
+26
View File
@@ -0,0 +1,26 @@
import { describe, it, expect } from "vitest";
import { OpenRouterClient } from "../openrouter";
describe("OpenRouterClient", () => {
it("should create instance with API key", () => {
const client = new OpenRouterClient("test-api-key");
expect(client).toBeInstanceOf(OpenRouterClient);
});
it("should have default free models list", () => {
const client = new OpenRouterClient("test-api-key");
const models = client.getFreeModels();
expect(models).toContain("google/gemini-2.0-flash-exp:free");
});
it("should have available model providers", () => {
const client = new OpenRouterClient("test-api-key");
const providers = client.getProviders();
expect(providers).toContain("openai");
expect(providers).toContain("google");
expect(providers).toContain("anthropic");
expect(providers).toContain("deepseek");
expect(providers).toContain("meta");
expect(providers).toContain("xai");
});
});