mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 20:20:42 +00:00
feat(fireworks): add Kimi K2.6 model
This commit is contained in:
@@ -12,6 +12,9 @@ import {
|
||||
FIREWORKS_DEFAULT_CONTEXT_WINDOW,
|
||||
FIREWORKS_DEFAULT_MAX_TOKENS,
|
||||
FIREWORKS_DEFAULT_MODEL_ID,
|
||||
FIREWORKS_K2_6_CONTEXT_WINDOW,
|
||||
FIREWORKS_K2_6_MAX_TOKENS,
|
||||
FIREWORKS_K2_6_MODEL_ID,
|
||||
} from "./provider-catalog.js";
|
||||
|
||||
function createFireworksDefaultRuntimeModel(params: { reasoning: boolean }): ProviderRuntimeModel {
|
||||
@@ -46,14 +49,23 @@ describe("fireworks provider plugin", () => {
|
||||
expect(resolved?.method.id).toBe("api-key");
|
||||
});
|
||||
|
||||
it("builds the Fireworks Fire Pass starter catalog", async () => {
|
||||
it("builds the Fireworks catalog", async () => {
|
||||
const provider = await registerSingleProviderPlugin(fireworksPlugin);
|
||||
const catalogProvider = await runSingleProviderCatalog(provider);
|
||||
|
||||
expect(catalogProvider.api).toBe("openai-completions");
|
||||
expect(catalogProvider.baseUrl).toBe(FIREWORKS_BASE_URL);
|
||||
expect(catalogProvider.models?.map((model) => model.id)).toEqual([FIREWORKS_DEFAULT_MODEL_ID]);
|
||||
expect(catalogProvider.models?.map((model) => model.id)).toEqual([
|
||||
FIREWORKS_K2_6_MODEL_ID,
|
||||
FIREWORKS_DEFAULT_MODEL_ID,
|
||||
]);
|
||||
expect(catalogProvider.models?.[0]).toMatchObject({
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
contextWindow: FIREWORKS_K2_6_CONTEXT_WINDOW,
|
||||
maxTokens: FIREWORKS_K2_6_MAX_TOKENS,
|
||||
});
|
||||
expect(catalogProvider.models?.[1]).toMatchObject({
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
contextWindow: FIREWORKS_DEFAULT_CONTEXT_WINDOW,
|
||||
@@ -113,4 +125,21 @@ describe("fireworks provider plugin", () => {
|
||||
reasoning: false,
|
||||
});
|
||||
});
|
||||
|
||||
it("disables reasoning metadata for Fireworks Kimi k2.6 dynamic models", async () => {
|
||||
const provider = await registerSingleProviderPlugin(fireworksPlugin);
|
||||
const resolved = provider.resolveDynamicModel?.(
|
||||
createProviderDynamicModelContext({
|
||||
provider: "fireworks",
|
||||
modelId: "accounts/fireworks/models/kimi-k2p6",
|
||||
models: [createFireworksDefaultRuntimeModel({ reasoning: false })],
|
||||
}),
|
||||
);
|
||||
|
||||
expect(resolved).toMatchObject({
|
||||
provider: "fireworks",
|
||||
id: "accounts/fireworks/models/kimi-k2p6",
|
||||
reasoning: false,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export function isFireworksKimiModelId(modelId: string): boolean {
|
||||
const normalized = modelId.trim().toLowerCase();
|
||||
const lastSegment = normalized.split("/").pop() ?? normalized;
|
||||
return /^kimi-k2(?:p5|\.5)(?:[-_].+)?$/.test(lastSegment);
|
||||
return /^kimi-k2(?:p[56]|[.-][56])(?:[-_].+)?$/.test(lastSegment);
|
||||
}
|
||||
|
||||
@@ -5,8 +5,11 @@ import type {
|
||||
|
||||
export const FIREWORKS_BASE_URL = "https://api.fireworks.ai/inference/v1";
|
||||
export const FIREWORKS_DEFAULT_MODEL_ID = "accounts/fireworks/routers/kimi-k2p5-turbo";
|
||||
export const FIREWORKS_K2_6_MODEL_ID = "accounts/fireworks/models/kimi-k2p6";
|
||||
export const FIREWORKS_DEFAULT_CONTEXT_WINDOW = 256000;
|
||||
export const FIREWORKS_DEFAULT_MAX_TOKENS = 256000;
|
||||
export const FIREWORKS_K2_6_CONTEXT_WINDOW = 262144;
|
||||
export const FIREWORKS_K2_6_MAX_TOKENS = 262144;
|
||||
|
||||
const ZERO_COST = {
|
||||
input: 0,
|
||||
@@ -15,8 +18,24 @@ const ZERO_COST = {
|
||||
cacheWrite: 0,
|
||||
} as const;
|
||||
|
||||
const FIREWORKS_K2_6_COST = {
|
||||
input: 0.95,
|
||||
output: 4,
|
||||
cacheRead: 0,
|
||||
cacheWrite: 0,
|
||||
} as const;
|
||||
|
||||
export function buildFireworksCatalogModels(): ModelDefinitionConfig[] {
|
||||
return [
|
||||
{
|
||||
id: FIREWORKS_K2_6_MODEL_ID,
|
||||
name: "Kimi K2.6",
|
||||
reasoning: false,
|
||||
input: ["text", "image"],
|
||||
cost: FIREWORKS_K2_6_COST,
|
||||
contextWindow: FIREWORKS_K2_6_CONTEXT_WINDOW,
|
||||
maxTokens: FIREWORKS_K2_6_MAX_TOKENS,
|
||||
},
|
||||
{
|
||||
id: FIREWORKS_DEFAULT_MODEL_ID,
|
||||
name: "Kimi K2.5 Turbo (Fire Pass)",
|
||||
|
||||
@@ -55,6 +55,24 @@ describe("createFireworksKimiThinkingDisabledWrapper", () => {
|
||||
).toMatchObject({ thinking: { type: "disabled" } });
|
||||
});
|
||||
|
||||
it("forces thinking disabled for Fireworks Kimi k2.6 models", () => {
|
||||
expect(
|
||||
capturePayload({
|
||||
provider: "fireworks",
|
||||
api: "openai-completions",
|
||||
modelId: "accounts/fireworks/models/kimi-k2p6",
|
||||
}),
|
||||
).toMatchObject({ thinking: { type: "disabled" } });
|
||||
|
||||
expect(
|
||||
capturePayload({
|
||||
provider: "fireworks",
|
||||
api: "openai-completions",
|
||||
modelId: "accounts/fireworks/routers/kimi-k2.6-turbo",
|
||||
}),
|
||||
).toMatchObject({ thinking: { type: "disabled" } });
|
||||
});
|
||||
|
||||
it("strips reasoning fields when disabling Fireworks Kimi thinking", () => {
|
||||
const payload = capturePayload({
|
||||
provider: "fireworks",
|
||||
|
||||
Reference in New Issue
Block a user