mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
Adds deepinfra, nebius, ollama-cloud, scaleway, siliconflow, siliconflow-cn, stepfun, and stepfun-cn from models.dev. Hosts without verified support for OpenAI-only request features leave out store, developer messages, long cache retention, and max_completion_tokens, and send reasoning_effort only where models.dev lists effort levels. SiliconFlow toggles thinking with enable_thinking; StepFun uses DeepSeek-style reasoning.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import type { Model } from "../../src/types.ts";
|
|
import { defineProvider, modelsDevModels, type ProviderContext } from "../define.ts";
|
|
import { catalogedEffortCompat, OPENAI_COMPATIBLE_HOST_COMPAT } from "../openai-compatible.ts";
|
|
|
|
/**
|
|
* SiliconFlow. Reasoning models with a thinking toggle take a top-level
|
|
* `enable_thinking` flag (Qwen's thinking format); other reasoning models keep
|
|
* the server default unless models.dev lists effort levels.
|
|
*/
|
|
export function siliconflowModels(ctx: ProviderContext, source: string, baseUrl: string) {
|
|
return modelsDevModels(ctx, source, {
|
|
api: "openai-completions",
|
|
baseUrl,
|
|
map: (model, source): Model<"openai-completions"> => ({
|
|
...model,
|
|
compat: {
|
|
...catalogedEffortCompat(source),
|
|
...(source.reasoningOptions?.some((option) => option.type === "toggle") ? { thinkingFormat: "qwen" } : {}),
|
|
},
|
|
}),
|
|
});
|
|
}
|
|
|
|
export default defineProvider({
|
|
id: "siliconflow",
|
|
models: (ctx) => siliconflowModels(ctx, "siliconflow", "https://api.siliconflow.com/v1"),
|
|
compat: { "openai-completions": OPENAI_COMPATIBLE_HOST_COMPAT },
|
|
});
|