mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 15:03:31 +00:00
feat(ai): add OpenRouter provider routing support
Allows custom models to specify which upstream providers OpenRouter should route requests to via the `openRouterRouting` field in model definitions. Supported fields: - `only`: list of provider slugs to exclusively use - `order`: list of provider slugs to try in order
This commit is contained in:
parent
a6d878e804
commit
dac7474da2
5 changed files with 30 additions and 0 deletions
|
|
@ -25,6 +25,12 @@ import type { AuthStorage } from "./auth-storage.js";
|
|||
|
||||
const Ajv = (AjvModule as any).default || AjvModule;
|
||||
|
||||
// Schema for OpenRouter routing preferences
|
||||
const OpenRouterRoutingSchema = Type.Object({
|
||||
only: Type.Optional(Type.Array(Type.String())),
|
||||
order: Type.Optional(Type.Array(Type.String())),
|
||||
});
|
||||
|
||||
// Schema for OpenAI compatibility settings
|
||||
const OpenAICompletionsCompatSchema = Type.Object({
|
||||
supportsStore: Type.Optional(Type.Boolean()),
|
||||
|
|
@ -37,6 +43,7 @@ const OpenAICompletionsCompatSchema = Type.Object({
|
|||
requiresThinkingAsText: Type.Optional(Type.Boolean()),
|
||||
requiresMistralToolIds: Type.Optional(Type.Boolean()),
|
||||
thinkingFormat: Type.Optional(Type.Union([Type.Literal("openai"), Type.Literal("zai")])),
|
||||
openRouterRouting: Type.Optional(OpenRouterRoutingSchema),
|
||||
});
|
||||
|
||||
const OpenAIResponsesCompatSchema = Type.Object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue