mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 13:38:31 +00:00
fix: include free OpenCode models without -free suffix in suggested models (#1535)
The "opencode-free" suggested-models filter only kept models whose id ends in "-free", so free-but-unsuffixed models like `big-pickle` (routed via open-sse/executors/opencode.js MESSAGES_MODELS) never appeared in the import UI. Extract the filters into a testable module and include a KNOWN_FREE_OPENCODE_MODELS allowlist (big-pickle) alongside the "-free" suffix check. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
committed by
decolua
co-authored by
Claude Opus 4.8
Cursor
parent
4baaa5c7aa
commit
9ee8b32887
@@ -0,0 +1,20 @@
|
|||||||
|
// Free OpenCode models that don't use the "-free" id suffix
|
||||||
|
const KNOWN_FREE_OPENCODE_MODELS = ["big-pickle"];
|
||||||
|
|
||||||
|
export const FILTERS = {
|
||||||
|
"openrouter-free": (models) =>
|
||||||
|
models
|
||||||
|
.filter(
|
||||||
|
(m) =>
|
||||||
|
m.pricing?.prompt === "0" &&
|
||||||
|
m.pricing?.completion === "0" &&
|
||||||
|
m.context_length >= 200000
|
||||||
|
)
|
||||||
|
.map((m) => ({ id: m.id, name: m.name, contextLength: m.context_length }))
|
||||||
|
.sort((a, b) => b.contextLength - a.contextLength),
|
||||||
|
|
||||||
|
"opencode-free": (models) =>
|
||||||
|
models
|
||||||
|
.filter((m) => m.id?.endsWith("-free") || KNOWN_FREE_OPENCODE_MODELS.includes(m.id))
|
||||||
|
.map((m) => ({ id: m.id, name: m.id })),
|
||||||
|
};
|
||||||
@@ -1,25 +1,8 @@
|
|||||||
import { NextResponse } from "next/server";
|
import { NextResponse } from "next/server";
|
||||||
|
import { FILTERS } from "./filters.js";
|
||||||
|
|
||||||
export const dynamic = "force-dynamic";
|
export const dynamic = "force-dynamic";
|
||||||
|
|
||||||
const FILTERS = {
|
|
||||||
"openrouter-free": (models) =>
|
|
||||||
models
|
|
||||||
.filter(
|
|
||||||
(m) =>
|
|
||||||
m.pricing?.prompt === "0" &&
|
|
||||||
m.pricing?.completion === "0" &&
|
|
||||||
m.context_length >= 200000
|
|
||||||
)
|
|
||||||
.map((m) => ({ id: m.id, name: m.name, contextLength: m.context_length }))
|
|
||||||
.sort((a, b) => b.contextLength - a.contextLength),
|
|
||||||
|
|
||||||
"opencode-free": (models) =>
|
|
||||||
models
|
|
||||||
.filter((m) => m.id?.endsWith("-free"))
|
|
||||||
.map((m) => ({ id: m.id, name: m.id })),
|
|
||||||
};
|
|
||||||
|
|
||||||
export async function GET(request) {
|
export async function GET(request) {
|
||||||
const { searchParams } = new URL(request.url);
|
const { searchParams } = new URL(request.url);
|
||||||
const url = searchParams.get("url");
|
const url = searchParams.get("url");
|
||||||
|
|||||||
Reference in New Issue
Block a user