feat(config): add model compatibility configuration and schema for OpenRouter routing preferences
This commit is contained in:
parent
87b1c2bfb7
commit
56ccee35a0
@ -16,6 +16,21 @@ export type AgentModelEntryConfig = {
|
||||
alias?: string;
|
||||
/** Provider-specific API parameters (e.g., GLM-4.7 thinking mode). */
|
||||
params?: Record<string, unknown>;
|
||||
/** Model compatibility overrides (e.g., OpenRouter routing preferences). */
|
||||
compat?: ModelCompatEntryConfig;
|
||||
};
|
||||
|
||||
export type ModelCompatEntryConfig = {
|
||||
supportsStore?: boolean;
|
||||
supportsDeveloperRole?: boolean;
|
||||
supportsReasoningEffort?: boolean;
|
||||
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
||||
openRouterRouting?: OpenRouterRoutingConfig;
|
||||
};
|
||||
|
||||
export type OpenRouterRoutingConfig = {
|
||||
only?: string[];
|
||||
order?: string[];
|
||||
};
|
||||
|
||||
export type AgentModelListConfig = {
|
||||
|
||||
@ -37,6 +37,24 @@ export const AgentDefaultsSchema = z
|
||||
alias: z.string().optional(),
|
||||
/** Provider-specific API parameters (e.g., GLM-4.7 thinking mode). */
|
||||
params: z.record(z.string(), z.unknown()).optional(),
|
||||
/** Model compatibility overrides (e.g., OpenRouter routing preferences). */
|
||||
compat: z
|
||||
.object({
|
||||
supportsStore: z.boolean().optional(),
|
||||
supportsDeveloperRole: z.boolean().optional(),
|
||||
supportsReasoningEffort: z.boolean().optional(),
|
||||
maxTokensField: z
|
||||
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
|
||||
.optional(),
|
||||
openRouterRouting: z
|
||||
.object({
|
||||
only: z.array(z.string()).optional(),
|
||||
order: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
})
|
||||
.strict(),
|
||||
)
|
||||
|
||||
@ -19,6 +19,12 @@ export const ModelCompatSchema = z
|
||||
maxTokensField: z
|
||||
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
|
||||
.optional(),
|
||||
openRouterRouting: z
|
||||
.object({
|
||||
only: z.array(z.string()).optional(),
|
||||
order: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user