Skip to content

Commit 04fa8a7

Browse files
refactor(ai-gateway): remove model settings (#2806)
* refactor(ai-gateway): remove model settings * Remove unused import for isMinimaxModel Removed import statement for isMinimaxModel. --------- Co-authored-by: kiloconnect[bot] <240665456+kiloconnect[bot]@users.noreply.github.com> Co-authored-by: Christiaan Arnoldus <christiaan@kilocode.ai>
1 parent 15c898a commit 04fa8a7

6 files changed

Lines changed: 3 additions & 105 deletions

File tree

apps/web/src/lib/ai-gateway/kilo-auto/index.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
CLAUDE_SONNET_CURRENT_MODEL_ID,
66
} from '@/lib/ai-gateway/providers/anthropic.constants';
77
import type { OpenRouterReasoningConfig } from '@/lib/ai-gateway/providers/openrouter/types';
8-
import type { ModelSettings, OpenCodeSettings, Verbosity } from '@kilocode/db/schema-types';
8+
import type { OpenCodeSettings, Verbosity } from '@kilocode/db/schema-types';
99
import { qwen36_plus_model } from '@/lib/ai-gateway/providers/qwen';
1010

1111
type AutoModel = {
@@ -19,7 +19,6 @@ type AutoModel = {
1919
input_cache_read_price: string | undefined;
2020
input_cache_write_price: string | undefined;
2121
supports_images: boolean;
22-
roocode_settings: ModelSettings | undefined;
2322
opencode_settings: OpenCodeSettings | undefined;
2423
};
2524

@@ -110,7 +109,6 @@ export const KILO_AUTO_FRONTIER_MODEL: AutoModel = {
110109
input_cache_read_price: '0.0000005',
111110
input_cache_write_price: '0.00000625',
112111
supports_images: true,
113-
roocode_settings: undefined,
114112
opencode_settings: {
115113
family: 'claude',
116114
prompt: 'anthropic',
@@ -129,7 +127,6 @@ export const KILO_AUTO_FREE_MODEL: AutoModel = {
129127
input_cache_read_price: '0',
130128
input_cache_write_price: '0',
131129
supports_images: false,
132-
roocode_settings: undefined,
133130
opencode_settings: undefined,
134131
};
135132

@@ -144,7 +141,6 @@ export const KILO_AUTO_BALANCED_MODEL: AutoModel = {
144141
input_cache_read_price: '0.0000000325',
145142
input_cache_write_price: '0.00000040625',
146143
supports_images: true,
147-
roocode_settings: undefined,
148144
opencode_settings: {
149145
ai_sdk_provider: 'openai-compatible',
150146
},
@@ -161,7 +157,6 @@ export const KILO_AUTO_SMALL_MODEL: AutoModel = {
161157
input_cache_read_price: '0.000000005',
162158
input_cache_write_price: undefined,
163159
supports_images: true,
164-
roocode_settings: undefined,
165160
opencode_settings: undefined,
166161
};
167162

apps/web/src/lib/ai-gateway/providers/model-settings.ts

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { seed_20_pro_free_model } from '@/lib/ai-gateway/providers/bytedance';
2-
import { isGemini3Model, isGeminiModel, isGemmaModel } from '@/lib/ai-gateway/providers/google';
3-
import { isMinimaxModel } from '@/lib/ai-gateway/providers/minimax';
2+
import { isGemini3Model, isGemmaModel } from '@/lib/ai-gateway/providers/google';
43
import { modelStartsWith } from '@/lib/ai-gateway/providers/model-prefix';
54
import { isMoonshotModel } from '@/lib/ai-gateway/providers/moonshotai';
65
import { isOpenAiModel } from '@/lib/ai-gateway/providers/openai';
@@ -9,41 +8,11 @@ import { isXaiModel } from '@/lib/ai-gateway/providers/xai';
98
import { isZaiModel } from '@/lib/ai-gateway/providers/zai';
109
import type {
1110
CustomLlmProvider,
12-
ModelSettings,
1311
OpenClawModelSettings,
1412
OpenCodeSettings,
15-
VersionedSettings,
1613
} from '@kilocode/db/schema-types';
1714
import { ReasoningEffortSchema } from '@kilocode/db/schema-types';
1815

19-
export function getModelSettings(model: string): ModelSettings | undefined {
20-
if (isOpenAiModel(model)) {
21-
return {
22-
included_tools: ['apply_patch'],
23-
excluded_tools: ['apply_diff', 'delete_file', 'edit_file', 'write_to_file'],
24-
};
25-
}
26-
if (isMinimaxModel(model)) {
27-
return {
28-
included_tools: ['search_and_replace'],
29-
excluded_tools: ['apply_diff', 'edit_file'],
30-
};
31-
}
32-
return undefined;
33-
}
34-
35-
export function getVersionedModelSettings(model: string): VersionedSettings | undefined {
36-
if (isGeminiModel(model) || isZaiModel(model)) {
37-
return {
38-
'4.146.0': {
39-
included_tools: ['write_file', 'edit_file'],
40-
excluded_tools: ['apply_diff'],
41-
},
42-
};
43-
}
44-
return undefined;
45-
}
46-
4716
export const REASONING_VARIANTS_BINARY = {
4817
instant: { reasoning: { enabled: false, effort: 'none' } },
4918
thinking: { reasoning: { enabled: true, effort: 'medium' } },

apps/web/src/lib/ai-gateway/providers/openrouter/index.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,8 @@ import { captureException, captureMessage } from '@sentry/nextjs';
1010
import { convertFromKiloExclusiveModel } from '@/lib/ai-gateway/providers/kilo-exclusive-model';
1111
import { isForbiddenFreeModel } from '@/lib/ai-gateway/forbidden-free-models';
1212
import {
13-
getModelSettings,
1413
getOpenClawSettings,
1514
getOpenCodeSettings,
16-
getVersionedModelSettings,
1715
} from '@/lib/ai-gateway/providers/model-settings';
1816
import { AUTO_MODELS } from '@/lib/ai-gateway/kilo-auto';
1917

@@ -48,7 +46,6 @@ function buildAutoModels(): OpenRouterModel[] {
4846
},
4947
context_length: m.context_length,
5048
supported_parameters: ['max_tokens', 'temperature', 'tools', 'reasoning', 'include_reasoning'],
51-
settings: m.roocode_settings,
5249
opencode: m.opencode_settings,
5350
}));
5451
}
@@ -76,8 +73,6 @@ function enhancedModelList(models: OpenRouterModel[]) {
7673
name: skipSuffix ? model.name : isNew ? model.name + ' (new)' : model.name,
7774
preferredIndex: preferredIndex >= 0 ? preferredIndex : undefined,
7875
isFree: isFreeModel(model.id),
79-
settings: model.settings ?? getModelSettings(model.id),
80-
versioned_settings: model.versioned_settings ?? getVersionedModelSettings(model.id),
8176
opencode: model.opencode ?? getOpenCodeSettings(model.id),
8277
openclaw: model.openclaw ?? getOpenClawSettings(model.id),
8378
};

apps/web/src/lib/organizations/organization-types.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,7 @@ export {
1919

2020
import type { OrganizationRole, OrganizationPlan } from './organization-base-types';
2121
import { OrganizationPlanSchema, OrganizationSettingsSchema } from './organization-base-types';
22-
import {
23-
ModelSettingsSchema,
24-
OpenClawModelSettingsSchema,
25-
OpenCodeSettingsSchema,
26-
VersionedSettingsSchema,
27-
} from '@kilocode/db/schema-types';
22+
import { OpenClawModelSettingsSchema, OpenCodeSettingsSchema } from '@kilocode/db/schema-types';
2823

2924
// API-facing billing cycle values: 'monthly' | 'annual'
3025
// The DB stores 'yearly' instead of 'annual'; Stripe uses 'year'/'month'.
@@ -204,8 +199,6 @@ const OpenRouterModelSchema = z.object({
204199
// kilocode additions:
205200
preferredIndex: z.number().optional(),
206201
isFree: z.boolean().optional(),
207-
settings: ModelSettingsSchema.optional(),
208-
versioned_settings: VersionedSettingsSchema.optional(),
209202
opencode: OpenCodeSettingsSchema.optional(),
210203
openclaw: OpenClawModelSettingsSchema.optional(),
211204

apps/web/src/scripts/roo-tool-settings.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/db/src/schema-types.ts

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -681,34 +681,6 @@ export const NormalizedOpenRouterResponse = z.object({
681681
generated_at: z.string(),
682682
});
683683

684-
// --- Model settings ---
685-
686-
export const ToolSchema = z.enum([
687-
'apply_diff',
688-
'apply_patch',
689-
'delete_file',
690-
'edit_file',
691-
'search_replace',
692-
'search_and_replace',
693-
'write_file',
694-
'write_to_file',
695-
]);
696-
697-
export type Tool = z.infer<typeof ToolSchema>;
698-
699-
export const ToolArraySchema = z.array(ToolSchema);
700-
701-
export const ModelSettingsSchema = z.object({
702-
included_tools: ToolArraySchema,
703-
excluded_tools: ToolArraySchema,
704-
});
705-
706-
export type ModelSettings = z.infer<typeof ModelSettingsSchema>;
707-
708-
export const VersionedSettingsSchema = z.record(z.string(), ModelSettingsSchema);
709-
710-
export type VersionedSettings = z.infer<typeof VersionedSettingsSchema>;
711-
712684
export const OpenCodePromptSchema = z.enum([
713685
'codex',
714686
'gemini',

0 commit comments

Comments
 (0)