mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-05 09:32:54 +00:00
* feat(providers): add GMI provider * feat(providers): add Novita provider * feat(providers): add Qwen OAuth provider * feat(providers): add Ollama Cloud provider * docs: add hosted provider pages * test(providers): align qwen catalog result typing
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
import { registerSingleProviderPlugin } from "openclaw/plugin-sdk/plugin-test-runtime";
|
|
import { describe, expect, it } from "vitest";
|
|
import plugin from "./index.js";
|
|
|
|
function requireCatalogProvider(
|
|
result:
|
|
| { provider: { baseUrl?: string; models?: Array<{ id: string }> } }
|
|
| { providers: Record<string, unknown> }
|
|
| null
|
|
| undefined,
|
|
): { baseUrl?: string; models?: Array<{ id: string }> } {
|
|
if (!result || !("provider" in result)) {
|
|
throw new Error("single provider catalog result missing");
|
|
}
|
|
return result.provider;
|
|
}
|
|
|
|
describe("gmi provider plugin", () => {
|
|
it("registers GMI Cloud as an OpenAI-compatible provider", async () => {
|
|
const provider = await registerSingleProviderPlugin(plugin);
|
|
|
|
expect(provider.id).toBe("gmi");
|
|
expect(provider.aliases).toEqual(["gmi-cloud", "gmicloud"]);
|
|
expect(provider.envVars).toEqual(["GMI_API_KEY"]);
|
|
expect(provider.auth?.map((method) => method.id)).toEqual(["api-key"]);
|
|
|
|
const result = await provider.staticCatalog?.run({
|
|
config: {},
|
|
env: {},
|
|
resolveProviderApiKey: () => ({}),
|
|
} as never);
|
|
const catalogProvider = requireCatalogProvider(result);
|
|
expect(catalogProvider.baseUrl).toBe("https://api.gmi-serving.com/v1");
|
|
expect(catalogProvider.models?.map((model) => model.id)).toContain(
|
|
"google/gemini-3.1-flash-lite",
|
|
);
|
|
});
|
|
});
|