This reverts commit 38c6b26db9.
This commit is contained in:
@@ -34,7 +34,6 @@ export namespace ProviderTransform {
|
||||
case "@ai-sdk/gateway":
|
||||
return "gateway"
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
case "@kilocode/kilo-gateway": // kilocode_change
|
||||
return "openrouter"
|
||||
}
|
||||
return undefined
|
||||
@@ -331,8 +330,7 @@ export namespace ProviderTransform {
|
||||
|
||||
// see: https://docs.x.ai/docs/guides/reasoning#control-how-hard-the-model-thinks
|
||||
if (id.includes("grok") && id.includes("grok-3-mini")) {
|
||||
if (model.api.npm === "@openrouter/ai-sdk-provider" || model.api.npm === "@kilocode/kilo-gateway") {
|
||||
// kilocode_change
|
||||
if (model.api.npm === "@openrouter/ai-sdk-provider") {
|
||||
return {
|
||||
low: { reasoning: { effort: "low" } },
|
||||
high: { reasoning: { effort: "high" } },
|
||||
@@ -346,18 +344,8 @@ export namespace ProviderTransform {
|
||||
if (id.includes("grok")) return {}
|
||||
|
||||
switch (model.api.npm) {
|
||||
// kilocode_change start
|
||||
case "@kilocode/kilo-gateway":
|
||||
// Claude/Anthropic models support reasoning via effort levels
|
||||
// OpenRouter maps these to budget_tokens percentages (xhigh=95%, high=80%, medium=50%, low=20%, minimal=10%, none=0%)
|
||||
if (model.id.includes("claude") || model.id.includes("anthropic")) {
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
}
|
||||
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
// kilocode_change end
|
||||
|
||||
case "@openrouter/ai-sdk-provider":
|
||||
case "@kilocode/kilo-gateway": // kilocode_change
|
||||
if (!model.id.includes("gpt") && !model.id.includes("gemini-3")) return {}
|
||||
return Object.fromEntries(OPENAI_EFFORTS.map((effort) => [effort, { reasoning: { effort } }]))
|
||||
|
||||
@@ -644,12 +632,11 @@ export namespace ProviderTransform {
|
||||
}
|
||||
return { thinkingConfig: { thinkingBudget: 0 } }
|
||||
}
|
||||
if (model.providerID === "openrouter" || model.api.npm === "@kilocode/kilo-gateway") {
|
||||
// kilocode_change
|
||||
if (model.providerID === "openrouter") {
|
||||
if (model.api.id.includes("google")) {
|
||||
return { reasoning: { enabled: false } }
|
||||
}
|
||||
return { reasoning: { effort: "minimal" } } // kilocode_change - use reasoning.effort for OpenRouter API
|
||||
return { reasoningEffort: "minimal" }
|
||||
}
|
||||
return {}
|
||||
}
|
||||
|
||||
@@ -1206,103 +1206,6 @@ describe("ProviderTransform.variants", () => {
|
||||
})
|
||||
})
|
||||
|
||||
// kilocode_change start
|
||||
describe("@kilocode/kilo-gateway", () => {
|
||||
test("claude models return OPENAI_EFFORTS with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/anthropic/claude-sonnet-4",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "anthropic/claude-sonnet-4",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
|
||||
expect(result.none).toEqual({ reasoning: { effort: "none" } })
|
||||
expect(result.low).toEqual({ reasoning: { effort: "low" } })
|
||||
expect(result.medium).toEqual({ reasoning: { effort: "medium" } })
|
||||
expect(result.high).toEqual({ reasoning: { effort: "high" } })
|
||||
expect(result.xhigh).toEqual({ reasoning: { effort: "xhigh" } })
|
||||
})
|
||||
|
||||
test("anthropic models return OPENAI_EFFORTS with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/anthropic/claude-opus-4",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "anthropic/claude-opus-4",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
|
||||
expect(result.low).toEqual({ reasoning: { effort: "low" } })
|
||||
})
|
||||
|
||||
test("gpt models return OPENAI_EFFORTS with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/openai/gpt-5",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "openai/gpt-5",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
|
||||
expect(result.low).toEqual({ reasoning: { effort: "low" } })
|
||||
})
|
||||
|
||||
test("gemini-3 models return OPENAI_EFFORTS with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/google/gemini-3-pro",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "google/gemini-3-pro",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["none", "minimal", "low", "medium", "high", "xhigh"])
|
||||
})
|
||||
|
||||
test("non-qualifying models return empty object", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/meta/llama-4",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "meta/llama-4",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(result).toEqual({})
|
||||
})
|
||||
|
||||
test("grok-3-mini returns low and high with reasoning", () => {
|
||||
const model = createMockModel({
|
||||
id: "kilo/x-ai/grok-3-mini",
|
||||
providerID: "kilo",
|
||||
api: {
|
||||
id: "x-ai/grok-3-mini",
|
||||
url: "https://gateway.kilo.ai",
|
||||
npm: "@kilocode/kilo-gateway",
|
||||
},
|
||||
})
|
||||
const result = ProviderTransform.variants(model)
|
||||
expect(Object.keys(result)).toEqual(["low", "high"])
|
||||
expect(result.low).toEqual({ reasoning: { effort: "low" } })
|
||||
expect(result.high).toEqual({ reasoning: { effort: "high" } })
|
||||
})
|
||||
})
|
||||
// kilocode_change end
|
||||
|
||||
describe("@ai-sdk/gateway", () => {
|
||||
test("returns OPENAI_EFFORTS with reasoningEffort", () => {
|
||||
const model = createMockModel({
|
||||
|
||||
Reference in New Issue
Block a user