MCPcopy Create free account
hub / github.com/anomalyco/models.dev / parseModels

Function parseModels

packages/core/src/sync/providers/xai.ts:63–84  ·  view source on GitHub ↗
(raw)

Source from the content-addressed store, hash-verified

61 return { models: models.flat() };
62 },
63 parseModels(raw) {
64 const models = XAIResponse.parse(raw).models;
65 const seen = new Set<string>();
66 const expanded: XAIModel[] = [];
67
68 for (const model of models) {
69 if (!seen.has(model.id)) {
70 seen.add(model.id);
71 expanded.push(model);
72 }
73 }
74
75 for (const model of models) {
76 for (const alias of model.aliases ?? []) {
77 if (seen.has(alias)) continue;
78 seen.add(alias);
79 expanded.push({ ...model, id: alias, canonical_id: model.id });
80 }
81 }
82
83 return expanded;
84 },
85 translateModel(model, context) {
86 const existing = context.existing(model.id);
87 if (existing === undefined) return undefined;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected