fix(providers): use x-api-key for xiaomi discovery

This commit is contained in:
Mikael Hugo 2026-05-15 14:43:09 +02:00
parent 09ea553b6d
commit d70d8d3b10
2 changed files with 6 additions and 5 deletions

View file

@ -228,15 +228,15 @@ export const PROVIDER_CATALOG_CONFIG = {
}, },
// ─── Xiaomi MiMo ──────────────────────────────────────────────────────────── // ─── Xiaomi MiMo ────────────────────────────────────────────────────────────
// Discovery uses OpenAI-shaped GET /v1/models (confirmed: returns 401 when // Discovery uses OpenAI-shaped GET /v1/models. Auth is x-api-key header
// auth-gated, proving the endpoint exists — same pattern as minimax). // (NOT Bearer) — verified empirically: Bearer → 401, x-api-key → 200.
// Inference uses the Anthropic-messages wire format at /anthropic. // Inference uses the Anthropic-messages wire format at /anthropic.
// Key: XIAOMI_API_KEY Dashboard: token-plan-ams.xiaomimimo.com // Key: XIAOMI_API_KEY Dashboard: token-plan-ams.xiaomimimo.com
xiaomi: { xiaomi: {
type: "openai", type: "openai",
baseUrl: "https://token-plan-ams.xiaomimimo.com", baseUrl: "https://token-plan-ams.xiaomimimo.com",
modelsPath: "/v1/models", modelsPath: "/v1/models",
auth: { type: "bearer" }, auth: { type: "x-api-key", header: "x-api-key" },
rateLimits: { scope: "provider" }, rateLimits: { scope: "provider" },
modelFilter: { excludePatterns: [] }, modelFilter: { excludePatterns: [] },
}, },

View file

@ -186,9 +186,10 @@ describe("xiaomi discovery config", () => {
assert.equal(cfg.modelsPath, "/v1/models"); assert.equal(cfg.modelsPath, "/v1/models");
}); });
test("auth type is bearer", () => { test("auth type is x-api-key", () => {
const cfg = getProviderCatalogConfig("xiaomi"); const cfg = getProviderCatalogConfig("xiaomi");
assert.equal(cfg.auth.type, "bearer"); assert.equal(cfg.auth.type, "x-api-key");
assert.equal(cfg.auth.header, "x-api-key");
}); });
test("is included in DISCOVERABLE_PROVIDER_IDS", () => { test("is included in DISCOVERABLE_PROVIDER_IDS", () => {