Route all Muse Spark models (not just 1.2) on OpenCode Free to /zen/v1/responses via isMuseSparkModel(), fixing HTTP 500 on muse-spark-1.3-contributor-free. Declare vision:true on Muse Spark models so image input is no longer stripped; register 1.3 in the registry and capabilities. Scoped to opencode only — other providers keep Chat Completions routing.
28 lines
889 B
JavaScript
28 lines
889 B
JavaScript
// Codex auto-generates a "-review" variant for each llm model (review quota family)
|
|
export const CODEX_REVIEW_SUFFIX = "-review";
|
|
|
|
export function withCodexReviewModels(models) {
|
|
return models.flatMap((model) => {
|
|
if ((model.kind || model.type || "llm") !== "llm" || model.id.endsWith(CODEX_REVIEW_SUFFIX)) {
|
|
return [model];
|
|
}
|
|
return [
|
|
model,
|
|
{
|
|
...model,
|
|
id: `${model.id}${CODEX_REVIEW_SUFFIX}`,
|
|
name: `${model.name} Review`,
|
|
upstreamModelId: model.upstreamModelId || model.id,
|
|
quotaFamily: "review"
|
|
}
|
|
];
|
|
});
|
|
}
|
|
|
|
export function isMuseSparkModel(modelId) {
|
|
if (!modelId || typeof modelId !== "string") return false;
|
|
const clean = modelId.replace(/\([^()]+\)\s*$/, "").trim();
|
|
const base = clean.includes("/") ? clean.split("/").pop() : clean;
|
|
return /^muse[-_]?spark(?:$|[-_:.\s])/i.test(base);
|
|
}
|